From e427e88c6ae96e9b7eb30ebdf4c6b238226ad3e7 Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Fri, 29 Oct 2010 16:12:25 +0000 Subject: [PATCH] a lot of new testcases --- src/transport/Makefile.am | 49 +++++++++++++++++++- src/transport/test_quota_compliance.c | 67 +++++++++++++++++++++------ 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 HTTP_PLUGIN_TEST = test_plugin_transport_http HTTP_API_TEST = test_transport_api_http HTTP_REL_TEST = test_transport_api_reliability_http - HTTP_QUOTA_TEST = test_quota_compliance_http + HTTP_QUOTA_TEST = test_quota_compliance_http \ + test_quota_compliance_http_asymmetric_recv_constant \ + test_quota_compliance_http_asymmetric_send_constant HTTPS_PLUGIN_LA = libgnunet_plugin_transport_https.la HTTPS_PLUGIN_TEST = test_plugin_transport_https HTTPS_API_TEST = test_transport_api_https HTTPS_REL_TEST = test_transport_api_reliability_https - HTTPS_QUOTA_TEST = test_quota_compliance_https + HTTPS_QUOTA_TEST = test_quota_compliance_https \ + test_quota_compliance_https_asymmetric_recv_constant \ + test_quota_compliance_https_asymmetric_send_constant endif if USE_COVERAGE @@ -207,6 +211,8 @@ check_PROGRAMS = \ test_quota_compliance_tcp_asymmetric_recv_constant \ test_quota_compliance_tcp_asymmetric_send_constant \ test_quota_compliance_udp \ + test_quota_compliance_udp_asymmetric_send_constant \ + test_quota_compliance_udp_asymmetric_recv_constant \ $(HTTP_QUOTA_TEST) \ $(HTTPS_QUOTA_TEST) # TODO: add tests for nat, etc. @@ -229,6 +235,8 @@ TESTS = \ test_quota_compliance_tcp_asymmetric_recv_constant \ test_quota_compliance_tcp_asymmetric_send_constant \ test_quota_compliance_udp \ + test_quota_compliance_udp_asymmetric_send_constant \ + test_quota_compliance_udp_asymmetric_recv_constant \ $(HTTP_QUOTA_TEST) \ $(HTTPS_QUOTA_TEST) endif @@ -340,6 +348,18 @@ test_quota_compliance_http_SOURCES = \ test_quota_compliance_http_LDADD = \ $(top_builddir)/src/transport/libgnunettransport.la \ $(top_builddir)/src/util/libgnunetutil.la + + test_quota_compliance_http_asymmetric_recv_constant_SOURCES = \ + test_quota_compliance.c +test_quota_compliance_http_asymmetric_recv_constant_LDADD = \ + $(top_builddir)/src/transport/libgnunettransport.la \ + $(top_builddir)/src/util/libgnunetutil.la + + test_quota_compliance_http_asymmetric_send_constant_SOURCES = \ + test_quota_compliance.c +test_quota_compliance_http_asymmetric_send_constant_LDADD = \ + $(top_builddir)/src/transport/libgnunettransport.la \ + $(top_builddir)/src/util/libgnunetutil.la test_quota_compliance_https_SOURCES = \ test_quota_compliance.c @@ -347,11 +367,36 @@ test_quota_compliance_https_LDADD = \ $(top_builddir)/src/transport/libgnunettransport.la \ $(top_builddir)/src/util/libgnunetutil.la + test_quota_compliance_https_asymmetric_recv_constant_SOURCES = \ + test_quota_compliance.c +test_quota_compliance_https_asymmetric_recv_constant_LDADD = \ + $(top_builddir)/src/transport/libgnunettransport.la \ + $(top_builddir)/src/util/libgnunetutil.la + + test_quota_compliance_https_asymmetric_send_constant_SOURCES = \ + test_quota_compliance.c +test_quota_compliance_https_asymmetric_send_constant_LDADD = \ + $(top_builddir)/src/transport/libgnunettransport.la \ + $(top_builddir)/src/util/libgnunetutil.la + + test_quota_compliance_udp_SOURCES = \ test_quota_compliance.c test_quota_compliance_udp_LDADD = \ $(top_builddir)/src/transport/libgnunettransport.la \ $(top_builddir)/src/util/libgnunetutil.la + +test_quota_compliance_udp_asymmetric_recv_constant_SOURCES = \ + test_quota_compliance.c +test_quota_compliance_udp_asymmetric_recv_constant_LDADD = \ + $(top_builddir)/src/transport/libgnunettransport.la \ + $(top_builddir)/src/util/libgnunetutil.la + +test_quota_compliance_udp_asymmetric_send_constant_SOURCES = \ + test_quota_compliance.c +test_quota_compliance_udp_asymmetric_send_constant_LDADD = \ + $(top_builddir)/src/transport/libgnunettransport.la \ + $(top_builddir)/src/util/libgnunetutil.la endif 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[]) is_udp = GNUNET_YES; } + if (strstr(argv[0], "asymmetric_recv") != NULL) + { + is_asymmetric_recv_constant = GNUNET_YES; + } + else + is_asymmetric_recv_constant = GNUNET_NO; + if (strstr(argv[0], "asymmetric_send") != NULL) + { + is_asymmetric_send_constant = GNUNET_YES; + } + else + is_asymmetric_send_constant = GNUNET_NO; + + char * logger; + if (is_tcp == GNUNET_YES) + { + if (is_asymmetric_recv_constant == GNUNET_YES) + GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","tcp","asymmetric_recv_constant"); + else if (is_asymmetric_send_constant == GNUNET_YES) + GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","tcp","asymmetric_send_constant"); + else + GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","tcp","symmetric"); + } + if (is_udp == GNUNET_YES) + { + if (is_asymmetric_recv_constant == GNUNET_YES) + GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","udp","asymmetric_recv_constant"); + else if (is_asymmetric_send_constant == GNUNET_YES) + GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","udp","asymmetric_send_constant"); + else + GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","udp","symmetric"); + } + if (is_http == GNUNET_YES) + { + if (is_asymmetric_recv_constant == GNUNET_YES) + GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","http","asymmetric_recv_constant"); + else if (is_asymmetric_send_constant == GNUNET_YES) + GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","http","asymmetric_send_constant"); + else + GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","http","symmetric"); + } + if (is_https == GNUNET_YES) + { + if (is_asymmetric_recv_constant == GNUNET_YES) + GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","https","asymmetric_recv_constant"); + else if (is_asymmetric_send_constant == GNUNET_YES) + GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","https","asymmetric_send_constant"); + else + GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","https","symmetric"); + } + GNUNET_log_setup ("test-quota-compliance", #if VERBOSE "DEBUG", @@ -698,26 +749,14 @@ main (int argc, char *argv[]) struct GNUNET_GETOPT_CommandLineOption options[] = { GNUNET_GETOPT_OPTION_END }; - - if (strstr(argv[0], "asymmetric_recv") != NULL) - { - is_asymmetric_recv_constant = GNUNET_YES; - } - else - is_asymmetric_recv_constant = GNUNET_NO; - if (strstr(argv[0], "asymmetric_send") != NULL) - { - is_asymmetric_send_constant = GNUNET_YES; - } - else - is_asymmetric_send_constant = GNUNET_NO; ok = 1; GNUNET_PROGRAM_run ((sizeof (argv1) / sizeof (char *)) - 1, - argv1, "test-quota-compliance", "nohelp", + argv1, logger , "nohelp", options, &run, &ok); ret = ok; stop_arm (&p1); stop_arm (&p2); + GNUNET_free(logger); GNUNET_DISK_directory_remove ("/tmp/test_quota_compliance_peer1"); GNUNET_DISK_directory_remove ("/tmp/test_quota_compliance_peer2"); return ret; -- 2.25.1