summaryrefslogtreecommitdiff
path: root/auto_tests/tox_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'auto_tests/tox_test.c')
-rw-r--r--auto_tests/tox_test.c45
1 files changed, 26 insertions, 19 deletions
diff --git a/auto_tests/tox_test.c b/auto_tests/tox_test.c
index 7efb5465..3928bc9c 100644
--- a/auto_tests/tox_test.c
+++ b/auto_tests/tox_test.c
@@ -647,7 +647,7 @@ START_TEST(test_few_clients)
647 ck_assert_msg(err_t == TOX_ERR_FRIEND_QUERY_OK, "Typing fail"); 647 ck_assert_msg(err_t == TOX_ERR_FRIEND_QUERY_OK, "Typing fail");
648 648
649 uint32_t packet_number = 160; 649 uint32_t packet_number = 160;
650 tox_callback_friend_lossless_packet(tox3, &handle_custom_packet, &packet_number); 650 tox_callback_friend_lossless_packet(tox3, &handle_custom_packet);
651 uint8_t data_c[TOX_MAX_CUSTOM_PACKET_SIZE + 1]; 651 uint8_t data_c[TOX_MAX_CUSTOM_PACKET_SIZE + 1];
652 memset(data_c, ((uint8_t)packet_number), sizeof(data_c)); 652 memset(data_c, ((uint8_t)packet_number), sizeof(data_c));
653 int ret = tox_friend_send_lossless_packet(tox2, 0, data_c, sizeof(data_c), 0); 653 int ret = tox_friend_send_lossless_packet(tox2, 0, data_c, sizeof(data_c), 0);
@@ -659,7 +659,7 @@ START_TEST(test_few_clients)
659 custom_packet = 0; 659 custom_packet = 0;
660 tox_iterate(tox1, &to_compare); 660 tox_iterate(tox1, &to_compare);
661 tox_iterate(tox2, &to_compare); 661 tox_iterate(tox2, &to_compare);
662 tox_iterate(tox3, &to_compare); 662 tox_iterate(tox3, &packet_number);
663 663
664 if (custom_packet == 1) { 664 if (custom_packet == 1) {
665 break; 665 break;
@@ -671,7 +671,7 @@ START_TEST(test_few_clients)
671 } 671 }
672 672
673 packet_number = 200; 673 packet_number = 200;
674 tox_callback_friend_lossy_packet(tox3, &handle_custom_packet, &packet_number); 674 tox_callback_friend_lossy_packet(tox3, &handle_custom_packet);
675 memset(data_c, ((uint8_t)packet_number), sizeof(data_c)); 675 memset(data_c, ((uint8_t)packet_number), sizeof(data_c));
676 ret = tox_friend_send_lossy_packet(tox2, 0, data_c, sizeof(data_c), 0); 676 ret = tox_friend_send_lossy_packet(tox2, 0, data_c, sizeof(data_c), 0);
677 ck_assert_msg(ret == 0, "tox_friend_send_lossy_packet bigger fail %i", ret); 677 ck_assert_msg(ret == 0, "tox_friend_send_lossy_packet bigger fail %i", ret);
@@ -682,7 +682,7 @@ START_TEST(test_few_clients)
682 custom_packet = 0; 682 custom_packet = 0;
683 tox_iterate(tox1, &to_compare); 683 tox_iterate(tox1, &to_compare);
684 tox_iterate(tox2, &to_compare); 684 tox_iterate(tox2, &to_compare);
685 tox_iterate(tox3, &to_compare); 685 tox_iterate(tox3, &packet_number);
686 686
687 if (custom_packet == 1) { 687 if (custom_packet == 1) {
688 break; 688 break;
@@ -699,11 +699,11 @@ START_TEST(test_few_clients)
699 file_recv = 0; 699 file_recv = 0;
700 max_sending = UINT64_MAX; 700 max_sending = UINT64_MAX;
701 long long unsigned int f_time = time(NULL); 701 long long unsigned int f_time = time(NULL);
702 tox_callback_file_recv_chunk(tox3, write_file, &to_compare); 702 tox_callback_file_recv_chunk(tox3, write_file);
703 tox_callback_file_recv_control(tox2, file_print_control, &to_compare); 703 tox_callback_file_recv_control(tox2, file_print_control);
704 tox_callback_file_chunk_request(tox2, tox_file_chunk_request, &to_compare); 704 tox_callback_file_chunk_request(tox2, tox_file_chunk_request);
705 tox_callback_file_recv_control(tox3, file_print_control, &to_compare); 705 tox_callback_file_recv_control(tox3, file_print_control);
706 tox_callback_file_recv(tox3, tox_file_receive, &to_compare); 706 tox_callback_file_recv(tox3, tox_file_receive);
707 uint64_t totalf_size = 100 * 1024 * 1024; 707 uint64_t totalf_size = 100 * 1024 * 1024;
708 uint32_t fnum = tox_file_send(tox2, 0, TOX_FILE_KIND_DATA, totalf_size, 0, (const uint8_t *)"Gentoo.exe", 708 uint32_t fnum = tox_file_send(tox2, 0, TOX_FILE_KIND_DATA, totalf_size, 0, (const uint8_t *)"Gentoo.exe",
709 sizeof("Gentoo.exe"), 0); 709 sizeof("Gentoo.exe"), 0);
@@ -746,11 +746,11 @@ START_TEST(test_few_clients)
746 746
747 file_sending_done = file_accepted = file_size = sendf_ok = size_recv = 0; 747 file_sending_done = file_accepted = file_size = sendf_ok = size_recv = 0;
748 file_recv = 0; 748 file_recv = 0;
749 tox_callback_file_recv_chunk(tox3, write_file, &to_compare); 749 tox_callback_file_recv_chunk(tox3, write_file);
750 tox_callback_file_recv_control(tox2, file_print_control, &to_compare); 750 tox_callback_file_recv_control(tox2, file_print_control);
751 tox_callback_file_chunk_request(tox2, tox_file_chunk_request, &to_compare); 751 tox_callback_file_chunk_request(tox2, tox_file_chunk_request);
752 tox_callback_file_recv_control(tox3, file_print_control, &to_compare); 752 tox_callback_file_recv_control(tox3, file_print_control);
753 tox_callback_file_recv(tox3, tox_file_receive, &to_compare); 753 tox_callback_file_recv(tox3, tox_file_receive);
754 totalf_size = UINT64_MAX; 754 totalf_size = UINT64_MAX;
755 fnum = tox_file_send(tox2, 0, TOX_FILE_KIND_DATA, totalf_size, 0, (const uint8_t *)"Gentoo.exe", sizeof("Gentoo.exe"), 755 fnum = tox_file_send(tox2, 0, TOX_FILE_KIND_DATA, totalf_size, 0, (const uint8_t *)"Gentoo.exe", sizeof("Gentoo.exe"),
756 0); 756 0);
@@ -794,11 +794,11 @@ START_TEST(test_few_clients)
794 794
795 file_sending_done = file_accepted = file_size = sendf_ok = size_recv = 0; 795 file_sending_done = file_accepted = file_size = sendf_ok = size_recv = 0;
796 file_recv = 0; 796 file_recv = 0;
797 tox_callback_file_recv_chunk(tox3, write_file, &to_compare); 797 tox_callback_file_recv_chunk(tox3, write_file);
798 tox_callback_file_recv_control(tox2, file_print_control, &to_compare); 798 tox_callback_file_recv_control(tox2, file_print_control);
799 tox_callback_file_chunk_request(tox2, tox_file_chunk_request, &to_compare); 799 tox_callback_file_chunk_request(tox2, tox_file_chunk_request);
800 tox_callback_file_recv_control(tox3, file_print_control, &to_compare); 800 tox_callback_file_recv_control(tox3, file_print_control);
801 tox_callback_file_recv(tox3, tox_file_receive, &to_compare); 801 tox_callback_file_recv(tox3, tox_file_receive);
802 totalf_size = 0; 802 totalf_size = 0;
803 fnum = tox_file_send(tox2, 0, TOX_FILE_KIND_DATA, totalf_size, 0, (const uint8_t *)"Gentoo.exe", sizeof("Gentoo.exe"), 803 fnum = tox_file_send(tox2, 0, TOX_FILE_KIND_DATA, totalf_size, 0, (const uint8_t *)"Gentoo.exe", sizeof("Gentoo.exe"),
804 0); 804 0);
@@ -908,6 +908,8 @@ loop_top:
908 908
909 ck_assert_msg(num_f == NUM_FRIENDS, "bad num friends: %u", num_f); 909 ck_assert_msg(num_f == NUM_FRIENDS, "bad num friends: %u", num_f);
910 910
911 uint16_t last_count = 0;
912
911 while (1) { 913 while (1) {
912 uint16_t counter = 0; 914 uint16_t counter = 0;
913 915
@@ -919,6 +921,11 @@ loop_top:
919 } 921 }
920 } 922 }
921 923
924 if (counter != last_count) {
925 printf("got to %u\n", counter);
926 last_count = counter;
927 }
928
922 if (counter == NUM_FRIENDS * 2) { 929 if (counter == NUM_FRIENDS * 2) {
923 break; 930 break;
924 } 931 }