summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2014-02-26 12:46:11 -0500
committerirungentoo <irungentoo@gmail.com>2014-02-26 12:46:11 -0500
commit1c676147a2fb50e1513fa6f7a1bb5d61b75fb98f (patch)
tree482c91280fbb88819175757f02f5b8d1601fccd6
parentcebae58ddc492869b627eb7b69c7565084a74a34 (diff)
Fixed/updated tests.
-rw-r--r--auto_tests/onion_test.c21
-rw-r--r--auto_tests/tox_test.c6
2 files changed, 16 insertions, 11 deletions
diff --git a/auto_tests/onion_test.c b/auto_tests/onion_test.c
index 1a458f65..e3198095 100644
--- a/auto_tests/onion_test.c
+++ b/auto_tests/onion_test.c
@@ -149,7 +149,10 @@ START_TEST(test_basic)
149 nodes[1] = n2; 149 nodes[1] = n2;
150 nodes[2] = n1; 150 nodes[2] = n1;
151 nodes[3] = n2; 151 nodes[3] = n2;
152 int ret = send_onion_packet(onion1->dht, nodes, (uint8_t *)"Install Gentoo", sizeof("Install Gentoo")); 152 Onion_Path path;
153 create_onion_path(onion1->dht, &path, nodes);
154 int ret = send_onion_packet(onion1->net, &path, nodes[3].ip_port, (uint8_t *)"Install Gentoo",
155 sizeof("Install Gentoo"));
153 ck_assert_msg(ret == 0, "Failed to create/send onion packet."); 156 ck_assert_msg(ret == 0, "Failed to create/send onion packet.");
154 157
155 handled_test_1 = 0; 158 handled_test_1 = 0;
@@ -174,7 +177,8 @@ START_TEST(test_basic)
174 uint8_t zeroes[64] = {0}; 177 uint8_t zeroes[64] = {0};
175 randombytes(sb_data, sizeof(sb_data)); 178 randombytes(sb_data, sizeof(sb_data));
176 memcpy(test_3_pub_key, nodes[3].client_id, crypto_box_PUBLICKEYBYTES); 179 memcpy(test_3_pub_key, nodes[3].client_id, crypto_box_PUBLICKEYBYTES);
177 ret = send_announce_request(onion1->dht, nodes, onion1->dht->c->self_public_key, onion1->dht->c->self_secret_key, 180 ret = send_announce_request(onion1->net, &path, nodes[3], onion1->dht->c->self_public_key,
181 onion1->dht->c->self_secret_key,
178 zeroes, onion1->dht->c->self_public_key, onion1->dht->c->self_public_key, sb_data); 182 zeroes, onion1->dht->c->self_public_key, onion1->dht->c->self_public_key, sb_data);
179 ck_assert_msg(ret == 0, "Failed to create/send onion announce_request packet."); 183 ck_assert_msg(ret == 0, "Failed to create/send onion announce_request packet.");
180 handled_test_3 = 0; 184 handled_test_3 = 0;
@@ -188,7 +192,7 @@ START_TEST(test_basic)
188 memcpy(onion2_a->entries[1].public_key, onion2->dht->self_public_key, crypto_box_PUBLICKEYBYTES); 192 memcpy(onion2_a->entries[1].public_key, onion2->dht->self_public_key, crypto_box_PUBLICKEYBYTES);
189 onion2_a->entries[1].time = unix_time(); 193 onion2_a->entries[1].time = unix_time();
190 networking_registerhandler(onion1->net, NET_PACKET_ONION_DATA_RESPONSE, &handle_test_4, onion1); 194 networking_registerhandler(onion1->net, NET_PACKET_ONION_DATA_RESPONSE, &handle_test_4, onion1);
191 send_announce_request(onion1->dht, nodes, onion1->dht->c->self_public_key, onion1->dht->c->self_secret_key, 195 send_announce_request(onion1->net, &path, nodes[3], onion1->dht->c->self_public_key, onion1->dht->c->self_secret_key,
192 test_3_ping_id, onion1->dht->c->self_public_key, onion1->dht->c->self_public_key, sb_data); 196 test_3_ping_id, onion1->dht->c->self_public_key, onion1->dht->c->self_public_key, sb_data);
193 197
194 while (memcmp(onion2_a->entries[ONION_ANNOUNCE_MAX_ENTRIES - 2].public_key, onion1->dht->c->self_public_key, 198 while (memcmp(onion2_a->entries[ONION_ANNOUNCE_MAX_ENTRIES - 2].public_key, onion1->dht->c->self_public_key,
@@ -203,7 +207,8 @@ START_TEST(test_basic)
203 ck_assert_msg((onion3 != NULL), "Onion failed initializing."); 207 ck_assert_msg((onion3 != NULL), "Onion failed initializing.");
204 208
205 new_nonce(nonce); 209 new_nonce(nonce);
206 ret = send_data_request(onion3->dht, nodes, onion1->dht->c->self_public_key, onion1->dht->c->self_public_key, 210 ret = send_data_request(onion3->net, &path, nodes[3].ip_port, onion1->dht->c->self_public_key,
211 onion1->dht->c->self_public_key,
207 nonce, (uint8_t *)"Install gentoo", sizeof("Install gentoo")); 212 nonce, (uint8_t *)"Install gentoo", sizeof("Install gentoo"));
208 ck_assert_msg(ret == 0, "Failed to create/send onion data_request packet."); 213 ck_assert_msg(ret == 0, "Failed to create/send onion data_request packet.");
209 handled_test_4 = 0; 214 handled_test_4 = 0;
@@ -284,8 +289,8 @@ START_TEST(test_announce)
284 c_sleep(50); 289 c_sleep(50);
285 } 290 }
286 291
287 onion_addfriend(onions[7]->onion_c, onions[27]->onion->dht->c->self_public_key); 292 onion_addfriend(onions[7]->onion_c, onions[37]->onion->dht->c->self_public_key);
288 int frnum = onion_addfriend(onions[27]->onion_c, onions[7]->onion->dht->c->self_public_key); 293 int frnum = onion_addfriend(onions[37]->onion_c, onions[7]->onion->dht->c->self_public_key);
289 294
290 int ok = -1; 295 int ok = -1;
291 296
@@ -297,7 +302,7 @@ START_TEST(test_announce)
297 do_onion_client(onions[i]->onion_c); 302 do_onion_client(onions[i]->onion_c);
298 } 303 }
299 304
300 ok = onion_getfriendip(onions[27]->onion_c, frnum, &ip_port); 305 ok = onion_getfriendip(onions[37]->onion_c, frnum, &ip_port);
301 306
302 c_sleep(50); 307 c_sleep(50);
303 } 308 }
@@ -309,7 +314,7 @@ START_TEST(test_announce)
309 do_onions(onions[i]); 314 do_onions(onions[i]);
310 } 315 }
311 316
312 ok = onion_getfriendip(onions[27]->onion_c, frnum, &ip_port); 317 ok = onion_getfriendip(onions[37]->onion_c, frnum, &ip_port);
313 318
314 c_sleep(50); 319 c_sleep(50);
315 } 320 }
diff --git a/auto_tests/tox_test.c b/auto_tests/tox_test.c
index 7e74fba7..5b033544 100644
--- a/auto_tests/tox_test.c
+++ b/auto_tests/tox_test.c
@@ -255,8 +255,8 @@ START_TEST(test_few_clients)
255} 255}
256END_TEST 256END_TEST
257 257
258#define NUM_TOXES 33 258#define NUM_TOXES 66
259#define NUM_FRIENDS 10 259#define NUM_FRIENDS 20
260 260
261START_TEST(test_many_clients) 261START_TEST(test_many_clients)
262{ 262{
@@ -328,7 +328,7 @@ Suite *tox_suite(void)
328 Suite *s = suite_create("Tox"); 328 Suite *s = suite_create("Tox");
329 329
330 DEFTESTCASE_SLOW(few_clients, 50); 330 DEFTESTCASE_SLOW(few_clients, 50);
331 DEFTESTCASE_SLOW(many_clients, 240); 331 DEFTESTCASE_SLOW(many_clients, 300);
332 return s; 332 return s;
333} 333}
334 334