aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2010-10-29 16:12:25 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2010-10-29 16:12:25 +0000
commite427e88c6ae96e9b7eb30ebdf4c6b238226ad3e7 (patch)
treecf9d51ab95d53da443c8d32519e2f9664d71cacd
parentc9120ae89d8ff588162c49ffa4553567d59f0351 (diff)
downloadgnunet-e427e88c6ae96e9b7eb30ebdf4c6b238226ad3e7.tar.gz
gnunet-e427e88c6ae96e9b7eb30ebdf4c6b238226ad3e7.zip
a lot of new testcases
-rw-r--r--src/transport/Makefile.am49
-rw-r--r--src/transport/test_quota_compliance.c67
2 files changed, 100 insertions, 16 deletions
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am
index a5bf9dbe2..666c4af06 100644
--- a/src/transport/Makefile.am
+++ b/src/transport/Makefile.am
@@ -18,13 +18,17 @@ if HAVE_MHD
18 HTTP_PLUGIN_TEST = test_plugin_transport_http 18 HTTP_PLUGIN_TEST = test_plugin_transport_http
19 HTTP_API_TEST = test_transport_api_http 19 HTTP_API_TEST = test_transport_api_http
20 HTTP_REL_TEST = test_transport_api_reliability_http 20 HTTP_REL_TEST = test_transport_api_reliability_http
21 HTTP_QUOTA_TEST = test_quota_compliance_http 21 HTTP_QUOTA_TEST = test_quota_compliance_http \
22 test_quota_compliance_http_asymmetric_recv_constant \
23 test_quota_compliance_http_asymmetric_send_constant
22 24
23 HTTPS_PLUGIN_LA = libgnunet_plugin_transport_https.la 25 HTTPS_PLUGIN_LA = libgnunet_plugin_transport_https.la
24 HTTPS_PLUGIN_TEST = test_plugin_transport_https 26 HTTPS_PLUGIN_TEST = test_plugin_transport_https
25 HTTPS_API_TEST = test_transport_api_https 27 HTTPS_API_TEST = test_transport_api_https
26 HTTPS_REL_TEST = test_transport_api_reliability_https 28 HTTPS_REL_TEST = test_transport_api_reliability_https
27 HTTPS_QUOTA_TEST = test_quota_compliance_https 29 HTTPS_QUOTA_TEST = test_quota_compliance_https \
30 test_quota_compliance_https_asymmetric_recv_constant \
31 test_quota_compliance_https_asymmetric_send_constant
28endif 32endif
29 33
30if USE_COVERAGE 34if USE_COVERAGE
@@ -207,6 +211,8 @@ check_PROGRAMS = \
207 test_quota_compliance_tcp_asymmetric_recv_constant \ 211 test_quota_compliance_tcp_asymmetric_recv_constant \
208 test_quota_compliance_tcp_asymmetric_send_constant \ 212 test_quota_compliance_tcp_asymmetric_send_constant \
209 test_quota_compliance_udp \ 213 test_quota_compliance_udp \
214 test_quota_compliance_udp_asymmetric_send_constant \
215 test_quota_compliance_udp_asymmetric_recv_constant \
210 $(HTTP_QUOTA_TEST) \ 216 $(HTTP_QUOTA_TEST) \
211 $(HTTPS_QUOTA_TEST) 217 $(HTTPS_QUOTA_TEST)
212# TODO: add tests for nat, etc. 218# TODO: add tests for nat, etc.
@@ -229,6 +235,8 @@ TESTS = \
229 test_quota_compliance_tcp_asymmetric_recv_constant \ 235 test_quota_compliance_tcp_asymmetric_recv_constant \
230 test_quota_compliance_tcp_asymmetric_send_constant \ 236 test_quota_compliance_tcp_asymmetric_send_constant \
231 test_quota_compliance_udp \ 237 test_quota_compliance_udp \
238 test_quota_compliance_udp_asymmetric_send_constant \
239 test_quota_compliance_udp_asymmetric_recv_constant \
232 $(HTTP_QUOTA_TEST) \ 240 $(HTTP_QUOTA_TEST) \
233 $(HTTPS_QUOTA_TEST) 241 $(HTTPS_QUOTA_TEST)
234endif 242endif
@@ -340,6 +348,18 @@ test_quota_compliance_http_SOURCES = \
340test_quota_compliance_http_LDADD = \ 348test_quota_compliance_http_LDADD = \
341 $(top_builddir)/src/transport/libgnunettransport.la \ 349 $(top_builddir)/src/transport/libgnunettransport.la \
342 $(top_builddir)/src/util/libgnunetutil.la 350 $(top_builddir)/src/util/libgnunetutil.la
351
352 test_quota_compliance_http_asymmetric_recv_constant_SOURCES = \
353 test_quota_compliance.c
354test_quota_compliance_http_asymmetric_recv_constant_LDADD = \
355 $(top_builddir)/src/transport/libgnunettransport.la \
356 $(top_builddir)/src/util/libgnunetutil.la
357
358 test_quota_compliance_http_asymmetric_send_constant_SOURCES = \
359 test_quota_compliance.c
360test_quota_compliance_http_asymmetric_send_constant_LDADD = \
361 $(top_builddir)/src/transport/libgnunettransport.la \
362 $(top_builddir)/src/util/libgnunetutil.la
343 363
344test_quota_compliance_https_SOURCES = \ 364test_quota_compliance_https_SOURCES = \
345 test_quota_compliance.c 365 test_quota_compliance.c
@@ -347,11 +367,36 @@ test_quota_compliance_https_LDADD = \
347 $(top_builddir)/src/transport/libgnunettransport.la \ 367 $(top_builddir)/src/transport/libgnunettransport.la \
348 $(top_builddir)/src/util/libgnunetutil.la 368 $(top_builddir)/src/util/libgnunetutil.la
349 369
370 test_quota_compliance_https_asymmetric_recv_constant_SOURCES = \
371 test_quota_compliance.c
372test_quota_compliance_https_asymmetric_recv_constant_LDADD = \
373 $(top_builddir)/src/transport/libgnunettransport.la \
374 $(top_builddir)/src/util/libgnunetutil.la
375
376 test_quota_compliance_https_asymmetric_send_constant_SOURCES = \
377 test_quota_compliance.c
378test_quota_compliance_https_asymmetric_send_constant_LDADD = \
379 $(top_builddir)/src/transport/libgnunettransport.la \
380 $(top_builddir)/src/util/libgnunetutil.la
381
382
350test_quota_compliance_udp_SOURCES = \ 383test_quota_compliance_udp_SOURCES = \
351 test_quota_compliance.c 384 test_quota_compliance.c
352test_quota_compliance_udp_LDADD = \ 385test_quota_compliance_udp_LDADD = \
353 $(top_builddir)/src/transport/libgnunettransport.la \ 386 $(top_builddir)/src/transport/libgnunettransport.la \
354 $(top_builddir)/src/util/libgnunetutil.la 387 $(top_builddir)/src/util/libgnunetutil.la
388
389test_quota_compliance_udp_asymmetric_recv_constant_SOURCES = \
390 test_quota_compliance.c
391test_quota_compliance_udp_asymmetric_recv_constant_LDADD = \
392 $(top_builddir)/src/transport/libgnunettransport.la \
393 $(top_builddir)/src/util/libgnunetutil.la
394
395test_quota_compliance_udp_asymmetric_send_constant_SOURCES = \
396 test_quota_compliance.c
397test_quota_compliance_udp_asymmetric_send_constant_LDADD = \
398 $(top_builddir)/src/transport/libgnunettransport.la \
399 $(top_builddir)/src/util/libgnunetutil.la
355 400
356endif 401endif
357 402
diff --git a/src/transport/test_quota_compliance.c b/src/transport/test_quota_compliance.c
index 895b5c36a..d7f549b2d 100644
--- a/src/transport/test_quota_compliance.c
+++ b/src/transport/test_quota_compliance.c
@@ -680,6 +680,57 @@ main (int argc, char *argv[])
680 is_udp = GNUNET_YES; 680 is_udp = GNUNET_YES;
681 } 681 }
682 682
683 if (strstr(argv[0], "asymmetric_recv") != NULL)
684 {
685 is_asymmetric_recv_constant = GNUNET_YES;
686 }
687 else
688 is_asymmetric_recv_constant = GNUNET_NO;
689 if (strstr(argv[0], "asymmetric_send") != NULL)
690 {
691 is_asymmetric_send_constant = GNUNET_YES;
692 }
693 else
694 is_asymmetric_send_constant = GNUNET_NO;
695
696 char * logger;
697 if (is_tcp == GNUNET_YES)
698 {
699 if (is_asymmetric_recv_constant == GNUNET_YES)
700 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","tcp","asymmetric_recv_constant");
701 else if (is_asymmetric_send_constant == GNUNET_YES)
702 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","tcp","asymmetric_send_constant");
703 else
704 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","tcp","symmetric");
705 }
706 if (is_udp == GNUNET_YES)
707 {
708 if (is_asymmetric_recv_constant == GNUNET_YES)
709 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","udp","asymmetric_recv_constant");
710 else if (is_asymmetric_send_constant == GNUNET_YES)
711 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","udp","asymmetric_send_constant");
712 else
713 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","udp","symmetric");
714 }
715 if (is_http == GNUNET_YES)
716 {
717 if (is_asymmetric_recv_constant == GNUNET_YES)
718 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","http","asymmetric_recv_constant");
719 else if (is_asymmetric_send_constant == GNUNET_YES)
720 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","http","asymmetric_send_constant");
721 else
722 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","http","symmetric");
723 }
724 if (is_https == GNUNET_YES)
725 {
726 if (is_asymmetric_recv_constant == GNUNET_YES)
727 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","https","asymmetric_recv_constant");
728 else if (is_asymmetric_send_constant == GNUNET_YES)
729 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","https","asymmetric_send_constant");
730 else
731 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","https","symmetric");
732 }
733
683 GNUNET_log_setup ("test-quota-compliance", 734 GNUNET_log_setup ("test-quota-compliance",
684#if VERBOSE 735#if VERBOSE
685 "DEBUG", 736 "DEBUG",
@@ -698,26 +749,14 @@ main (int argc, char *argv[])
698 struct GNUNET_GETOPT_CommandLineOption options[] = { 749 struct GNUNET_GETOPT_CommandLineOption options[] = {
699 GNUNET_GETOPT_OPTION_END 750 GNUNET_GETOPT_OPTION_END
700 }; 751 };
701
702 if (strstr(argv[0], "asymmetric_recv") != NULL)
703 {
704 is_asymmetric_recv_constant = GNUNET_YES;
705 }
706 else
707 is_asymmetric_recv_constant = GNUNET_NO;
708 if (strstr(argv[0], "asymmetric_send") != NULL)
709 {
710 is_asymmetric_send_constant = GNUNET_YES;
711 }
712 else
713 is_asymmetric_send_constant = GNUNET_NO;
714 ok = 1; 752 ok = 1;
715 GNUNET_PROGRAM_run ((sizeof (argv1) / sizeof (char *)) - 1, 753 GNUNET_PROGRAM_run ((sizeof (argv1) / sizeof (char *)) - 1,
716 argv1, "test-quota-compliance", "nohelp", 754 argv1, logger , "nohelp",
717 options, &run, &ok); 755 options, &run, &ok);
718 ret = ok; 756 ret = ok;
719 stop_arm (&p1); 757 stop_arm (&p1);
720 stop_arm (&p2); 758 stop_arm (&p2);
759 GNUNET_free(logger);
721 GNUNET_DISK_directory_remove ("/tmp/test_quota_compliance_peer1"); 760 GNUNET_DISK_directory_remove ("/tmp/test_quota_compliance_peer1");
722 GNUNET_DISK_directory_remove ("/tmp/test_quota_compliance_peer2"); 761 GNUNET_DISK_directory_remove ("/tmp/test_quota_compliance_peer2");
723 return ret; 762 return ret;