summaryrefslogtreecommitdiff
path: root/auto_tests
diff options
context:
space:
mode:
Diffstat (limited to 'auto_tests')
-rw-r--r--auto_tests/Makefile.inc56
-rw-r--r--auto_tests/toxav_basic_test.c10
-rw-r--r--auto_tests/toxav_many_test.c10
3 files changed, 56 insertions, 20 deletions
diff --git a/auto_tests/Makefile.inc b/auto_tests/Makefile.inc
index 02f4af67..b33f1cef 100644
--- a/auto_tests/Makefile.inc
+++ b/auto_tests/Makefile.inc
@@ -1,7 +1,7 @@
1if BUILD_TESTS 1if BUILD_TESTS
2 2
3TESTS = messenger_autotest# crypto_test network_test assoc_test onion_test TCP_test tox_test 3TESTS = messenger_autotest crypto_test network_test assoc_test onion_test TCP_test tox_test
4check_PROGRAMS = messenger_autotest# crypto_test network_test assoc_test onion_test TCP_test tox_test 4check_PROGRAMS = messenger_autotest crypto_test network_test assoc_test onion_test TCP_test tox_test
5 5
6AUTOTEST_CFLAGS = \ 6AUTOTEST_CFLAGS = \
7 $(LIBSODIUM_CFLAGS) \ 7 $(LIBSODIUM_CFLAGS) \
@@ -20,8 +20,8 @@ AUTOTEST_LDADD = \
20 20
21 21
22if BUILD_AV 22if BUILD_AV
23TESTS += toxav_basic_test #toxav_many_test 23TESTS += toxav_basic_test toxav_many_test
24check_PROGRAMS += toxav_basic_test #toxav_many_test 24check_PROGRAMS += toxav_basic_test toxav_many_test
25AUTOTEST_LDADD += libtoxav.la 25AUTOTEST_LDADD += libtoxav.la
26endif 26endif
27 27
@@ -32,7 +32,46 @@ messenger_autotest_CFLAGS = $(AUTOTEST_CFLAGS)
32messenger_autotest_LDADD = $(AUTOTEST_LDADD) 32messenger_autotest_LDADD = $(AUTOTEST_LDADD)
33 33
34 34
35crypto_test_SOURCES = ../auto_tests/crypto_test.c
35 36
37crypto_test_CFLAGS = $(AUTOTEST_CFLAGS)
38
39crypto_test_LDADD = $(AUTOTEST_LDADD)
40
41
42network_test_SOURCES = ../auto_tests/network_test.c
43
44network_test_CFLAGS = $(AUTOTEST_CFLAGS)
45
46network_test_LDADD = $(AUTOTEST_LDADD)
47
48
49assoc_test_SOURCES = ../auto_tests/assoc_test.c
50
51assoc_test_CFLAGS = $(AUTOTEST_CFLAGS)
52
53assoc_test_LDADD = $(AUTOTEST_LDADD)
54
55
56onion_test_SOURCES = ../auto_tests/onion_test.c
57
58onion_test_CFLAGS = $(AUTOTEST_CFLAGS)
59
60onion_test_LDADD = $(AUTOTEST_LDADD)
61
62
63TCP_test_SOURCES = ../auto_tests/TCP_test.c
64
65TCP_test_CFLAGS = $(AUTOTEST_CFLAGS)
66
67TCP_test_LDADD = $(AUTOTEST_LDADD)
68
69
70tox_test_SOURCES = ../auto_tests/tox_test.c
71
72tox_test_CFLAGS = $(AUTOTEST_CFLAGS)
73
74tox_test_LDADD = $(AUTOTEST_LDADD)
36 75
37 76
38 77
@@ -44,14 +83,13 @@ toxav_basic_test_CFLAGS = $(AUTOTEST_CFLAGS)
44toxav_basic_test_LDADD = $(AUTOTEST_LDADD) 83toxav_basic_test_LDADD = $(AUTOTEST_LDADD)
45 84
46 85
47#toxav_many_test_SOURCES = ../auto_tests/toxav_many_test.c 86toxav_many_test_SOURCES = ../auto_tests/toxav_many_test.c
48 87
49#toxav_many_test_CFLAGS = $(AUTOTEST_CFLAGS) 88toxav_many_test_CFLAGS = $(AUTOTEST_CFLAGS)
50 89
51#toxav_many_test_LDADD = $(AUTOTEST_LDADD) 90toxav_many_test_LDADD = $(AUTOTEST_LDADD)
52endif 91endif
53 92
54endif 93endif
55 94
56EXTRA_DIST += $(top_srcdir)/auto_tests/friends_test.c 95EXTRA_DIST += $(top_srcdir)/auto_tests/friends_test.c \ No newline at end of file
57
diff --git a/auto_tests/toxav_basic_test.c b/auto_tests/toxav_basic_test.c
index 528b1f9d..5c292168 100644
--- a/auto_tests/toxav_basic_test.c
+++ b/auto_tests/toxav_basic_test.c
@@ -49,7 +49,7 @@ typedef struct _Status {
49} Status; 49} Status;
50 50
51/* My default settings */ 51/* My default settings */
52static ToxAvCodecSettings muhcaps; 52static ToxAvCSettings muhcaps;
53 53
54void accept_friend_request(Tox *m, const uint8_t *public_key, const uint8_t *data, uint16_t length, void *userdata) 54void accept_friend_request(Tox *m, const uint8_t *public_key, const uint8_t *data, uint16_t length, void *userdata)
55{ 55{
@@ -82,7 +82,7 @@ void callback_recv_starting ( void *av, int32_t call_index, void *_arg )
82 /* Alice always sends invite */ 82 /* Alice always sends invite */
83 printf("Call started on Alice side...\n"); 83 printf("Call started on Alice side...\n");
84 cast->Alice.status = InCall; 84 cast->Alice.status = InCall;
85 toxav_prepare_transmission(av, call_index, 3, 0, 1); 85 toxav_prepare_transmission(av, call_index, av_jbufdc, av_VADd, 1);
86} 86}
87void callback_recv_ending ( void *av, int32_t call_index, void *_arg ) 87void callback_recv_ending ( void *av, int32_t call_index, void *_arg )
88{ 88{
@@ -105,7 +105,7 @@ void callback_call_started ( void *av, int32_t call_index, void *_arg )
105 /* Alice always sends invite */ 105 /* Alice always sends invite */
106 printf("Call started on Bob side...\n"); 106 printf("Call started on Bob side...\n");
107 cast->Bob.status = InCall; 107 cast->Bob.status = InCall;
108 toxav_prepare_transmission(av, call_index, 3, 0, 1); 108 toxav_prepare_transmission(av, call_index, av_jbufdc, av_VADd, 1);
109} 109}
110void callback_call_canceled ( void *av, int32_t call_index, void *_arg ) 110void callback_call_canceled ( void *av, int32_t call_index, void *_arg )
111{ 111{
@@ -133,7 +133,7 @@ void callback_call_ended ( void *av, int32_t call_index, void *_arg )
133 133
134void callback_call_type_change ( void *av, int32_t call_index, void *_arg ) 134void callback_call_type_change ( void *av, int32_t call_index, void *_arg )
135{ 135{
136 ToxAvCodecSettings csettings; 136 ToxAvCSettings csettings;
137 toxav_get_peer_csettings(av, call_index, 0, &csettings); 137 toxav_get_peer_csettings(av, call_index, 0, &csettings);
138 138
139 printf("New settings: \n" 139 printf("New settings: \n"
@@ -312,7 +312,7 @@ START_TEST(test_AV_flows)
312 step++; /* This terminates the loop */ 312 step++; /* This terminates the loop */
313 toxav_kill_transmission(status_control.Alice.av, status_control.Alice.call_index); 313 toxav_kill_transmission(status_control.Alice.av, status_control.Alice.call_index);
314 toxav_kill_transmission(status_control.Bob.av, status_control.Bob.call_index); 314 toxav_kill_transmission(status_control.Bob.av, status_control.Bob.call_index);
315 315
316 /* Call over Alice hangs up */ 316 /* Call over Alice hangs up */
317 toxav_hangup(status_control.Alice.av, status_control.Alice.call_index); 317 toxav_hangup(status_control.Alice.av, status_control.Alice.call_index);
318 } 318 }
diff --git a/auto_tests/toxav_many_test.c b/auto_tests/toxav_many_test.c
index 18058c1f..6a70ff33 100644
--- a/auto_tests/toxav_many_test.c
+++ b/auto_tests/toxav_many_test.c
@@ -174,7 +174,7 @@ void *in_thread_call (void *arg)
174 174
175 switch ( step ) { 175 switch ( step ) {
176 case 0: /* CALLER */ 176 case 0: /* CALLER */
177 toxav_call(this_call->Caller.av, &call_idx, this_call->Callee.id, TypeVideo, 10); 177 toxav_call(this_call->Caller.av, &call_idx, this_call->Callee.id, &av_DefaultSettings, 10);
178 call_print(call_idx, "Calling ..."); 178 call_print(call_idx, "Calling ...");
179 step++; 179 step++;
180 break; 180 break;
@@ -182,7 +182,7 @@ void *in_thread_call (void *arg)
182 case 1: /* CALLEE */ 182 case 1: /* CALLEE */
183 if (this_call->Caller.status == Ringing) { 183 if (this_call->Caller.status == Ringing) {
184 call_print(call_idx, "Callee answers ..."); 184 call_print(call_idx, "Callee answers ...");
185 toxav_answer(this_call->Callee.av, 0, TypeVideo); 185 toxav_answer(this_call->Callee.av, 0, &av_DefaultSettings);
186 step++; 186 step++;
187 start = time(NULL); 187 start = time(NULL);
188 } 188 }
@@ -193,11 +193,9 @@ void *in_thread_call (void *arg)
193 if (this_call->Caller.status == InCall) { /* I think this is okay */ 193 if (this_call->Caller.status == InCall) { /* I think this is okay */
194 call_print(call_idx, "Sending rtp ..."); 194 call_print(call_idx, "Sending rtp ...");
195 195
196 ToxAvCodecSettings cast = av_DefaultSettings;
197
198 c_sleep(1000); /* We have race condition here */ 196 c_sleep(1000); /* We have race condition here */
199 toxav_prepare_transmission(this_call->Callee.av, 0, &cast, 1); 197 toxav_prepare_transmission(this_call->Callee.av, 0, 3, 0, 1);
200 toxav_prepare_transmission(this_call->Caller.av, call_idx, &cast, 1); 198 toxav_prepare_transmission(this_call->Caller.av, call_idx, 3, 0, 1);
201 199
202 int payload_size = toxav_prepare_audio_frame(this_call->Caller.av, call_idx, prepared_payload, RTP_PAYLOAD_SIZE, 200 int payload_size = toxav_prepare_audio_frame(this_call->Caller.av, call_idx, prepared_payload, RTP_PAYLOAD_SIZE,
203 sample_payload, frame_size); 201 sample_payload, frame_size);