HTTP_REL_TEST = test_transport_api_reliability_http
HTTP_NAT_REL_TEST = test_transport_api_reliability_http_nat
HTTP_QUOTA_TEST = test_quota_compliance_http \
- test_quota_compliance_http_asymmetric_recv_constant
+ test_quota_compliance_http_asymmetric
HTTPS_PLUGIN_LA = libgnunet_plugin_transport_https.la
HTTPS_API_TEST = test_transport_api_https
HTTPS_NAT_API_TEST = test_transport_api_https_nat
HTTPS_REL_TEST = test_transport_api_reliability_https
HTTPS_NAT_REL_TEST = test_transport_api_reliability_https_nat
HTTPS_QUOTA_TEST = test_quota_compliance_https \
- test_quota_compliance_https_asymmetric_recv_constant
+ test_quota_compliance_https_asymmetric
endif
if USE_COVERAGE
UNIX_PLUGIN_TEST = test_transport_api_unix
UNIX_REL_TEST = test_transport_api_unreliability_unix
UNIX_QUOTA_TEST = test_quota_compliance_unix \
- test_quota_compliance_unix_asymmetric_recv_constant
+ test_quota_compliance_unix_asymmetric
endif
noinst_PROGRAMS = \
$(HTTPS_REL_TEST) \
$(HTTPS_NAT_REL_TEST) \
test_quota_compliance_tcp \
- test_quota_compliance_tcp_asymmetric_recv_constant \
+ test_quota_compliance_tcp_asymmetric \
test_quota_compliance_udp \
- test_quota_compliance_udp_asymmetric_recv_constant \
+ test_quota_compliance_udp_asymmetric \
$(UNIX_QUOTA_TEST) \
$(HTTP_QUOTA_TEST) \
$(HTTPS_QUOTA_TEST) \
$(HTTPS_REL_TEST) \
$(HTTPS_NAT_REL_TEST) \
test_quota_compliance_tcp \
- test_quota_compliance_tcp_asymmetric_recv_constant \
+ test_quota_compliance_tcp_asymmetric \
test_quota_compliance_udp \
- test_quota_compliance_udp_asymmetric_recv_constant \
+ test_quota_compliance_udp_asymmetric \
$(UNIX_QUOTA_TEST) \
$(HTTP_QUOTA_TEST) \
$(HTTPS_QUOTA_TEST) \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/transport/libgnunettransporttesting.la
-test_quota_compliance_tcp_asymmetric_recv_constant_SOURCES = \
+test_quota_compliance_tcp_asymmetric_SOURCES = \
test_quota_compliance.c
-test_quota_compliance_tcp_asymmetric_recv_constant_LDADD = \
+test_quota_compliance_tcp_asymmetric_LDADD = \
$(top_builddir)/src/transport/libgnunettransport.la \
$(top_builddir)/src/hello/libgnunethello.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/transport/libgnunettransporttesting.la
- test_quota_compliance_http_asymmetric_recv_constant_SOURCES = \
+ test_quota_compliance_http_asymmetric_SOURCES = \
test_quota_compliance.c
-test_quota_compliance_http_asymmetric_recv_constant_LDADD = \
+test_quota_compliance_http_asymmetric_LDADD = \
$(top_builddir)/src/transport/libgnunettransport.la \
$(top_builddir)/src/hello/libgnunethello.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/transport/libgnunettransporttesting.la
- test_quota_compliance_https_asymmetric_recv_constant_SOURCES = \
+ test_quota_compliance_https_asymmetric_SOURCES = \
test_quota_compliance.c
-test_quota_compliance_https_asymmetric_recv_constant_LDADD = \
+test_quota_compliance_https_asymmetric_LDADD = \
$(top_builddir)/src/transport/libgnunettransport.la \
$(top_builddir)/src/hello/libgnunethello.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/transport/libgnunettransporttesting.la
-test_quota_compliance_udp_asymmetric_recv_constant_SOURCES = \
+test_quota_compliance_udp_asymmetric_SOURCES = \
test_quota_compliance.c
-test_quota_compliance_udp_asymmetric_recv_constant_LDADD = \
+test_quota_compliance_udp_asymmetric_LDADD = \
$(top_builddir)/src/transport/libgnunettransport.la \
$(top_builddir)/src/hello/libgnunethello.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/transport/libgnunettransporttesting.la
-test_quota_compliance_unix_asymmetric_recv_constant_SOURCES = \
+test_quota_compliance_unix_asymmetric_SOURCES = \
test_quota_compliance.c
-test_quota_compliance_unix_asymmetric_recv_constant_LDADD = \
+test_quota_compliance_unix_asymmetric_LDADD = \
$(top_builddir)/src/transport/libgnunettransport.la \
$(top_builddir)/src/hello/libgnunethello.la \
$(top_builddir)/src/util/libgnunetutil.la \
* @file transport/test_quota_compliance.c
* @brief base test case for transport implementations
*
- * This test case tests quota compliance both on core and transport level
+ * This test case tests quota compliance both on transport level
*/
#include "platform.h"
#include "gnunet_common.h"
}
#endif
n++;
- if (0 == (n % (TOTAL_MSGS / 100)))
- {
- fprintf (stderr, ".");
- if (die_task != GNUNET_SCHEDULER_NO_TASK)
- GNUNET_SCHEDULER_cancel (die_task);
- die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL);
- }
- if (n == TOTAL_MSGS)
- {
- ok = 0;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "\nAll messages received\n");
- end ();
- }
}
NULL);
}
+
+static void
+measure (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+ static int counter;
+ measure_task = GNUNET_SCHEDULER_NO_TASK;
+
+ counter++;
+ if ((DURATION.rel_value / 1000) < counter )
+ {
+ fprintf (stderr, ".\n");
+ GNUNET_SCHEDULER_add_now (&end, NULL);
+ }
+ else
+ {
+ fprintf (stderr, ".");
+ measure_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &measure, NULL);
+ }
+}
+
+
static void
testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls)
{
cc = NULL;
test_connected = GNUNET_YES;
- measure_task = GNUNET_SCHEDULER_add_delayed (DURATION, &end, NULL);
+ measure_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &measure, NULL);
GNUNET_SCHEDULER_add_now (&sendtask, NULL);
}
run (void *cls, char *const *args, const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
- run_measurement (10000, 10000, 10000, 10000);
+ unsigned long long p1_quota_in = 10000;
+ unsigned long long p1_quota_out = 10000;
+ unsigned long long p2_quota_in = 10000;
+ unsigned long long p2_quota_out = 10000;
+
+ if (NULL != strstr (test_name,"asymmetric"))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Running asymmetric test with sending peer unlimited, receiving peer (in/out): %llu/%llu b/s \n",
+ p2_quota_in, p2_quota_out);
+ p1_quota_out = 1024 * 1024 * 1024;
+ p1_quota_in = 1024 * 1024 * 1024;
+ }
+ else
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Running symmetric test with (in/out) %llu/%llu b/s \n",
+ p2_quota_in, p2_quota_out);
+ }
+ run_measurement (p1_quota_in, p1_quota_out, p2_quota_in, p2_quota_out);
}
static int
if (GNUNET_YES == GNUNET_DISK_file_test (gen_cfg_p2))
{
- //GNUNET_DISK_directory_remove (gen_cfg_p2);
+ GNUNET_DISK_directory_remove (gen_cfg_p2);
GNUNET_free (gen_cfg_p2);
}
--- /dev/null
+@INLINE@ template_cfg_peer1.conf
+[PATHS]
+SERVICEHOME = /tmp/test_quota_compliance_peer1
+DEFAULTCONFIG = test_quota_compliance_http_peer1.conf
+
+[transport-http]
+PORT = 4010
+DEBUG = NO
+USE_IPv4 = YES
+USE_IPv6 = NO
+BINDTO4 = 127.0.0.1
+
+[arm]
+PORT = 4015
+UNIXPATH = /tmp/test_quota_compliance_http_arm_peer1.sock
+
+[statistics]
+PORT = 4014
+UNIXPATH = /tmp/test_quota_compliance_http_statistics_peer1.sock
+
+[resolver]
+PORT = 4013
+UNIXPATH = /tmp/test_quota_compliance_http_resolver_peer1.sock
+
+[peerinfo]
+PORT = 4012
+UNIXPATH = /tmp/test_quota_compliance_http_peerinfo_peer1.sock
+
+[transport]
+PORT = 4011
+PLUGINS = http
+UNIXPATH = /tmp/test_quota_compliance_http_transport_peer1.sock
+
+
--- /dev/null
+@INLINE@ template_cfg_peer2.conf
+[PATHS]
+SERVICEHOME = /tmp/test_quota_compliance_peer2
+DEFAULTCONFIG = test_quota_compliance_http_peer2.conf
+
+[transport-http]
+PORT = 3010
+DEBUG = NO
+USE_IPv4 = YES
+USE_IPv6 = NO
+BINDTO4 = 127.0.0.1
+
+[arm]
+PORT = 3015
+UNIXPATH = /tmp/test_quota_compliance_http_arm_peer2.sock
+
+[statistics]
+PORT = 3014
+UNIXPATH = /tmp/test_quota_compliance_http_statistics_peer2.sock
+
+[resolver]
+PORT = 3013
+UNIXPATH = /tmp/test_quota_compliance_http_resolver_peer2.sock
+
+[peerinfo]
+PORT = 3012
+UNIXPATH = /tmp/test_quota_compliance_http_peerinfo_peer2.sock
+
+[transport]
+PORT = 3011
+PLUGINS = http
+UNIXPATH = /tmp/test_quota_compliance_http_transport_peer2.sock
+
+
--- /dev/null
+@INLINE@ template_cfg_peer1.conf
+[PATHS]
+SERVICEHOME = /tmp/test_quota_compliance_peer1/
+DEFAULTCONFIG = test_quota_compliance_https_peer1.conf
+
+[transport-https]
+PORT = 4001
+CRYPTO_INIT = NONE:+VERS-TLS1.0:+ARCFOUR-128:+SHA1:+RSA:+COMP-NULL
+KEY_FILE = https_key_quota_p1.key
+CERT_FILE = https_cert_quota_p1.crt
+USE_IPv4 = YES
+USE_IPv6 = NO
+BINDTO4 = 127.0.0.1
+
+[arm]
+PORT = 4006
+UNIXPATH = /tmp/test_quota_compliance_https_arm_peer1.sock
+
+[statistics]
+PORT = 4005
+UNIXPATH = /tmp/test_quota_compliance_https_statistics_peer1.sock
+
+[resolver]
+PORT = 4004
+UNIXPATH = /tmp/test_quota_compliance_https_resolver_peer1.sock
+
+[peerinfo]
+PORT = 4003
+UNIXPATH = /tmp/test_quota_compliance_https_peerinfo_peer1.sock
+
+[transport]
+PORT = 4002
+PLUGINS = https
+UNIXPATH = /tmp/test_quota_compliance_https_transport_peer1.sock
+
+
--- /dev/null
+@INLINE@ template_cfg_peer2.conf
+[PATHS]
+SERVICEHOME = /tmp/test_quota_compliance_peer2
+DEFAULTCONFIG = test_quota_compliance_https_peer2.conf
+
+[transport-https]
+PORT = 3001
+CRYPTO_INIT = NONE:+VERS-TLS1.0:+ARCFOUR-128:+SHA1:+RSA:+COMP-NULL
+KEY_FILE = https_key_quota_p2.key
+CERT_FILE = https_cert_qutoa_p2.crt
+USE_IPv4 = YES
+USE_IPv6 = NO
+BINDTO4 = 127.0.0.1
+
+[arm]
+PORT = 3006
+UNIXPATH = /tmp/test_quota_compliance_https_arm_peer2.sock
+
+[statistics]
+PORT = 3005
+UNIXPATH = /tmp/test_quota_compliance_https_statistics_peer2.sock
+
+[resolver]
+PORT = 3004
+UNIXPATH = /tmp/test_quota_compliance_https_resolver_peer2.sock
+
+[peerinfo]
+PORT = 3003
+UNIXPATH = /tmp/test_quota_compliance_https_peerinfo_peer2.sock
+
+[transport]
+PORT = 3002
+PLUGINS = https
+UNIXPATH = /tmp/https_transport_peer2.sock
+
+
--- /dev/null
+@INLINE@ template_cfg_peer1.conf
+[PATHS]
+SERVICEHOME = /tmp/test-transport/quota-tcp-p1/
+DEFAULTCONFIG = test_quota_compliance_tcp_peer1.conf
+
+[transport-tcp]
+PORT = 4094
+
+[transport-udp]
+PORT = 4094
+
+[arm]
+PORT = 4087
+UNIXPATH = /tmp/test_quota_compliance_tcp_arm_peer1.sock
+
+[statistics]
+PORT = 4088
+UNIXPATH = /tmp/test_quota_compliance_tcp_statistics_peer1.sock
+
+[resolver]
+PORT = 4089
+UNIXPATH = /tmp/test_quota_compliance_tcp_resolver_peer1.sock
+
+[peerinfo]
+PORT = 4090
+UNIXPATH = /tmp/test_quota_compliance_tcp_peerinfo_peer1.sock
+
+[transport]
+PORT = 4091
+UNIXPATH = /tmp/test_quota_compliance_tcp_transport_peer1.sock
+
+
--- /dev/null
+@INLINE@ template_cfg_peer2.conf
+[PATHS]
+SERVICEHOME = /tmp/test_quota_compliance_peer2
+DEFAULTCONFIG = test_quota_compliance_tcp_peer2.conf
+
+[transport-tcp]
+PORT = 3094
+
+[transport-udp]
+PORT = 3094
+
+[arm]
+PORT = 3087
+UNIXPATH = /tmp/test_quota_compliance_tcp_arm_peer2.sock
+
+[statistics]
+PORT = 3088
+UNIXPATH = /tmp/test_quota_compliance_tcp_statistics_peer2.sock
+
+[resolver]
+PORT = 3089
+UNIXPATH = /tmp/test_quota_compliance_tcp_resolver_peer2.sock
+
+[peerinfo]
+PORT = 3090
+UNIXPATH = /tmp/test_quota_compliance_tcp_peerinfo_peer2.sock
+
+[transport]
+PORT = 3091
+UNIXPATH = /tmp/test_quota_compliance_tcp_transport_peer2.sock
+
+
--- /dev/null
+@INLINE@ template_cfg_peer2.conf
+[PATHS]
+SERVICEHOME = /tmp/test_quota_compliance_peer1/
+DEFAULTCONFIG = test_quota_compliance_udp_peer1.conf
+
+[transport-udp]
+PORT = 4368
+MAX_BPS = 50000000
+
+[arm]
+PORT = 4087
+UNIXPATH = /tmp/test_quota_compliance_udp_arm_peer1.sock
+
+[statistics]
+PORT = 4088
+UNIXPATH = /tmp/test_quota_compliance_udp_statistics_peer1.sock
+
+[resolver]
+PORT = 4089
+UNIXPATH = /tmp/test_quota_compliance_udp_resolver_peer1.sock
+
+[peerinfo]
+PORT = 4090
+UNIXPATH = /tmp/test_quota_compliance_udp_peerinfo_peer1.sock
+
+[transport]
+PORT = 4091
+PLUGINS = udp
+UNIXPATH = /tmp/test_quota_compliance_udp_transport_peer1.sock
+
--- /dev/null
+@INLINE@ template_cfg_peer2.conf
+[PATHS]
+SERVICEHOME = /tmp/test_quota_compliance_peer2
+DEFAULTCONFIG = test_quota_compliance_udp_peer2.conf
+
+[transport-udp]
+PORT = 3368
+MAX_BPS = 50000000
+
+[arm]
+PORT = 3087
+UNIXPATH = /tmp/test_quota_compliance_udp_arm_peer2.sock
+
+[statistics]
+PORT = 3088
+UNIXPATH = /tmp/test_quota_compliance_udp_statistics_peer2.sock
+
+[resolver]
+PORT = 3089
+UNIXPATH = /tmp/test_quota_compliance_udp_resolver_peer2.sock
+
+[peerinfo]
+PORT = 3090
+UNIXPATH = /tmp/test_quota_compliance_udp_peerinfo_peer2.sock
+
+[transport]
+PORT = 3091
+PLUGINS = udp
+UNIXPATH = /tmp/test_quota_compliance_udp_transport_peer2.sock
+
+
--- /dev/null
+@INLINE@ template_cfg_peer1.conf
+[PATHS]
+SERVICEHOME = /tmp/test_quota_compliance_peer1/
+DEFAULTCONFIG = test_quota_compliance_unix_peer1.conf
+
+[arm]
+PORT = 4087
+UNIXPATH = /tmp/test_quota_compliance_unix_arm_peer1.sock
+
+[statistics]
+PORT = 4088
+UNIXPATH = /tmp/test_quota_compliance_unix_statistics_peer1.sock
+
+[resolver]
+PORT = 4089
+UNIXPATH = /tmp/test_quota_compliance_unix_resolver_peer1.sock
+
+[peerinfo]
+PORT = 4090
+UNIXPATH = /tmp/test_quota_compliance_unix_peerinfo_peer1.sock
+
+[transport]
+PORT = 4091
+PLUGINS = unix
+UNIXPATH = /tmp/test_quota_compliance_unix_transport_peer1.sock
+
+
+
--- /dev/null
+@INLINE@ template_cfg_peer1.conf
+[PATHS]
+SERVICEHOME = /tmp/test_quota_compliance_peer2
+DEFAULTCONFIG = test_quota_compliance_unix_peer2.conf
+
+[arm]
+PORT = 3087
+UNIXPATH = /tmp/test_quota_compliance_unix_arm_peer2.sock
+
+[statistics]
+PORT = 3088
+UNIXPATH = /tmp/test_quota_compliance_unix_statistics_peer2.sock
+
+[resolver]
+PORT = 3089
+UNIXPATH = /tmp/test_quota_compliance_unix_resolver_peer2.sock
+
+[peerinfo]
+PORT = 3090
+UNIXPATH = /tmp/test_quota_compliance_unix_peerinfo_peer2.sock
+
+[transport]
+PORT = 3091
+PLUGINS = unix
+UNIXPATH = /tmp/test_quota_compliance_unix_transport_peer2.sock
+
+[transport-unix]
+PORT = 3368
+
TOTAL_QUOTA_IN = 1073741824
[transport-tcp]
-PORT = 12016
+PORT = 12015
TIMEOUT = 5000
[arm]