diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2010-11-30 14:02:25 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2010-11-30 14:02:25 +0000 |
commit | e14f682ca1de9f26c90420dd33ffad215bfef45c (patch) | |
tree | d50cc2c185108ff448667cae87a923ed0e26b23a /src | |
parent | 28824d44aba065b4a0afe6c9ee8526d7d8082611 (diff) | |
download | gnunet-e14f682ca1de9f26c90420dd33ffad215bfef45c.tar.gz gnunet-e14f682ca1de9f26c90420dd33ffad215bfef45c.zip |
added multi plugin transport api testcase
Diffstat (limited to 'src')
-rw-r--r-- | src/transport/Makefile.am | 10 | ||||
-rw-r--r-- | src/transport/test_transport_api.c | 24 | ||||
-rw-r--r-- | src/transport/test_transport_api_multi_peer1.conf | 132 | ||||
-rw-r--r-- | src/transport/test_transport_api_multi_peer2.conf | 134 |
4 files changed, 298 insertions, 2 deletions
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am index 313d94854..e2d5acda8 100644 --- a/src/transport/Makefile.am +++ b/src/transport/Makefile.am | |||
@@ -200,6 +200,7 @@ check_PROGRAMS = \ | |||
200 | $(HTTP_API_TEST) \ | 200 | $(HTTP_API_TEST) \ |
201 | $(HTTPS_PLUGIN_TEST) \ | 201 | $(HTTPS_PLUGIN_TEST) \ |
202 | $(HTTPS_API_TEST) \ | 202 | $(HTTPS_API_TEST) \ |
203 | test_transport_api_multi \ | ||
203 | test_transport_api_reliability_tcp \ | 204 | test_transport_api_reliability_tcp \ |
204 | test_transport_api_reliability_tcp_nat \ | 205 | test_transport_api_reliability_tcp_nat \ |
205 | test_transport_api_reliability_udp \ | 206 | test_transport_api_reliability_udp \ |
@@ -223,6 +224,7 @@ TESTS = \ | |||
223 | $(HTTP_API_TEST) \ | 224 | $(HTTP_API_TEST) \ |
224 | $(HTTPS_PLUGIN_TEST) \ | 225 | $(HTTPS_PLUGIN_TEST) \ |
225 | $(HTTPS_API_TEST) \ | 226 | $(HTTPS_API_TEST) \ |
227 | test_transport_api_multi \ | ||
226 | test_transport_api_reliability_tcp \ | 228 | test_transport_api_reliability_tcp \ |
227 | test_transport_api_reliability_tcp_nat \ | 229 | test_transport_api_reliability_tcp_nat \ |
228 | $(HTTP_REL_TEST) \ | 230 | $(HTTP_REL_TEST) \ |
@@ -391,6 +393,12 @@ test_quota_compliance_udp_asymmetric_recv_constant_LDADD = \ | |||
391 | # $(top_builddir)/src/transport/libgnunettransport.la \ | 393 | # $(top_builddir)/src/transport/libgnunettransport.la \ |
392 | # $(top_builddir)/src/util/libgnunetutil.la | 394 | # $(top_builddir)/src/util/libgnunetutil.la |
393 | 395 | ||
396 | test_transport_api_multi_SOURCES = \ | ||
397 | test_transport_api.c | ||
398 | test_transport_api_multi_LDADD = \ | ||
399 | $(top_builddir)/src/transport/libgnunettransport.la \ | ||
400 | $(top_builddir)/src/util/libgnunetutil.la | ||
401 | |||
394 | endif | 402 | endif |
395 | 403 | ||
396 | 404 | ||
@@ -409,6 +417,8 @@ EXTRA_DIST = \ | |||
409 | test_transport_api_http_peer2.conf \ | 417 | test_transport_api_http_peer2.conf \ |
410 | test_transport_api_https_peer1.conf \ | 418 | test_transport_api_https_peer1.conf \ |
411 | test_transport_api_https_peer2.conf \ | 419 | test_transport_api_https_peer2.conf \ |
420 | test_transport_api_multi_peer1.conf \ | ||
421 | test_transport_api_multi_peer2.conf \ | ||
412 | test_transport_api_rel_http_peer1.conf \ | 422 | test_transport_api_rel_http_peer1.conf \ |
413 | test_transport_api_rel_http_peer2.conf \ | 423 | test_transport_api_rel_http_peer2.conf \ |
414 | test_transport_api_rel_https_peer1.conf \ | 424 | test_transport_api_rel_https_peer1.conf \ |
diff --git a/src/transport/test_transport_api.c b/src/transport/test_transport_api.c index 488471e7a..1f9c56974 100644 --- a/src/transport/test_transport_api.c +++ b/src/transport/test_transport_api.c | |||
@@ -82,6 +82,8 @@ static int is_http; | |||
82 | 82 | ||
83 | static int is_https; | 83 | static int is_https; |
84 | 84 | ||
85 | static int is_multi_protocol; | ||
86 | |||
85 | static GNUNET_SCHEDULER_TaskIdentifier die_task; | 87 | static GNUNET_SCHEDULER_TaskIdentifier die_task; |
86 | 88 | ||
87 | static char * key_file_p1; | 89 | static char * key_file_p1; |
@@ -344,6 +346,12 @@ run (void *cls, | |||
344 | die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, | 346 | die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
345 | &end_badly, NULL); | 347 | &end_badly, NULL); |
346 | 348 | ||
349 | if (is_multi_protocol) | ||
350 | { | ||
351 | setup_peer (&p1, "test_transport_api_multi_peer1.conf"); | ||
352 | setup_peer (&p2, "test_transport_api_multi_peer2.conf"); | ||
353 | } | ||
354 | |||
347 | if (is_udp) | 355 | if (is_udp) |
348 | { | 356 | { |
349 | setup_peer (&p1, "test_transport_api_udp_peer1.conf"); | 357 | setup_peer (&p1, "test_transport_api_udp_peer1.conf"); |
@@ -559,10 +567,22 @@ main (int argc, char *argv[]) | |||
559 | { | 567 | { |
560 | is_http = GNUNET_YES; | 568 | is_http = GNUNET_YES; |
561 | } | 569 | } |
570 | else if (strstr(argv[0], "multi") != NULL) | ||
571 | { | ||
572 | is_multi_protocol = GNUNET_YES; | ||
573 | } | ||
562 | 574 | ||
563 | ret = check (); | 575 | ret = check (); |
564 | GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-transport-peer-1"); | 576 | if (is_multi_protocol) |
565 | GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-transport-peer-2"); | 577 | { |
578 | GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-transport-multi-peer-1/"); | ||
579 | GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-transport-multi-peer-2/"); | ||
580 | } | ||
581 | else | ||
582 | { | ||
583 | GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-transport-peer-1"); | ||
584 | GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-transport-peer-2"); | ||
585 | } | ||
566 | return ret; | 586 | return ret; |
567 | } | 587 | } |
568 | 588 | ||
diff --git a/src/transport/test_transport_api_multi_peer1.conf b/src/transport/test_transport_api_multi_peer1.conf new file mode 100644 index 000000000..0208ac29e --- /dev/null +++ b/src/transport/test_transport_api_multi_peer1.conf | |||
@@ -0,0 +1,132 @@ | |||
1 | [transport-tcp] | ||
2 | DISABLEV6 = YES | ||
3 | PORT = 30001 | ||
4 | BINDTO = 127.0.0.1 | ||
5 | BEHIND_NAT = NO | ||
6 | ALLOW_NAT = NO | ||
7 | ENABLE_UPNP = NO | ||
8 | INTERNAL_ADDRESS = 127.0.0.1 | ||
9 | EXTERNAL_ADDRESS = 127.0.0.1 | ||
10 | |||
11 | [transport-udp] | ||
12 | PORT = 30001 | ||
13 | |||
14 | [transport-http] | ||
15 | PORT = 30002 | ||
16 | DEBUG = NO | ||
17 | USE_IPv6 = YES | ||
18 | USE_IPv4 = YES | ||
19 | #BINDTO4 = 127.0.0.1 | ||
20 | #BINDTO6 = ::1 | ||
21 | |||
22 | [transport-https] | ||
23 | PORT = 30003 | ||
24 | DEBUG = NO | ||
25 | USE_IPv6 = YES | ||
26 | USE_IPv4 = YES | ||
27 | #BINDTO4 = 127.0.0.1 | ||
28 | #BINDTO6 = ::1 | ||
29 | |||
30 | [fs] | ||
31 | AUTOSTART = NO | ||
32 | |||
33 | [datastore] | ||
34 | AUTOSTART = NO | ||
35 | |||
36 | [core] | ||
37 | AUTOSTART = NO | ||
38 | |||
39 | [hostlist] | ||
40 | HTTP-PROXY = | ||
41 | SERVERS = http://gnunet.org:8080/ | ||
42 | OPTIONS = -b | ||
43 | BINARY = gnunet-daemon-hostlist | ||
44 | CONFIG = $DEFAULTCONFIG | ||
45 | HOME = $SERVICEHOME | ||
46 | HOSTNAME = localhost | ||
47 | HTTPPORT = 8080 | ||
48 | |||
49 | [topology] | ||
50 | BINARY = gnunet-daemon-topology | ||
51 | CONFIG = $DEFAULTCONFIG | ||
52 | FRIENDS = $SERVICEHOME/friends | ||
53 | TARGET-CONNECTION-COUNT = 16 | ||
54 | AUTOCONNECT = YES | ||
55 | FRIENDS-ONLY = NO | ||
56 | MINIMUM-FRIENDS = 0 | ||
57 | |||
58 | [transport] | ||
59 | PLUGINS = tcp udp http https | ||
60 | #DEBUG = YES | ||
61 | #PREFIX = xterm -T transport2 -e gdb --command=cmd --args | ||
62 | #PREFIX = valgrind --tool=memcheck --leak-check=full --log-file=transport%p | ||
63 | ACCEPT_FROM6 = ::1; | ||
64 | ACCEPT_FROM = 127.0.0.1; | ||
65 | NEIGHBOUR_LIMIT = 50 | ||
66 | BINARY = gnunet-service-transport | ||
67 | #BINARY = /home/mrwiggles/documents/research/gnunet/gnunet-ng/src/transport/.libs/gnunet-service-transport | ||
68 | CONFIG = $DEFAULTCONFIG | ||
69 | HOME = $SERVICEHOME | ||
70 | HOSTNAME = localhost | ||
71 | PORT = 12365 | ||
72 | UNIXPATH = /tmp/gnunet-p1-service-transport.sock | ||
73 | |||
74 | [peerinfo] | ||
75 | TRUST = $SERVICEHOME/data/credit/ | ||
76 | HOSTS = $SERVICEHOME/data/hosts/ | ||
77 | ACCEPT_FROM6 = ::1; | ||
78 | ACCEPT_FROM = 127.0.0.1; | ||
79 | BINARY = gnunet-service-peerinfo | ||
80 | CONFIG = $DEFAULTCONFIG | ||
81 | HOME = $SERVICEHOME | ||
82 | HOSTNAME = localhost | ||
83 | PORT = 12369 | ||
84 | UNIXPATH = /tmp/gnunet-p1-service-peerinfo.sock | ||
85 | |||
86 | [resolver] | ||
87 | ACCEPT_FROM6 = ::1; | ||
88 | ACCEPT_FROM = 127.0.0.1; | ||
89 | BINARY = gnunet-service-resolver | ||
90 | CONFIG = $DEFAULTCONFIG | ||
91 | HOME = $SERVICEHOME | ||
92 | HOSTNAME = localhost | ||
93 | PORT = 1236 | ||
94 | UNIXPATH = /tmp/gnunet-p1-service-resolver.sock | ||
95 | |||
96 | [statistics] | ||
97 | AUTOSTART = YES | ||
98 | ACCEPT_FROM6 = ::1; | ||
99 | ACCEPT_FROM = 127.0.0.1; | ||
100 | BINARY = gnunet-service-statistics | ||
101 | CONFIG = $DEFAULTCONFIG | ||
102 | HOME = $SERVICEHOME | ||
103 | HOSTNAME = localhost | ||
104 | PORT = 12367 | ||
105 | UNIXPATH = /tmp/gnunet-p1-service-statistics.sock | ||
106 | |||
107 | [arm] | ||
108 | DEFAULTSERVICES = transport | ||
109 | ACCEPT_FROM6 = ::1; | ||
110 | ACCEPT_FROM = 127.0.0.1; | ||
111 | BINARY = gnunet-service-arm | ||
112 | CONFIG = $DEFAULTCONFIG | ||
113 | HOME = $SERVICEHOME | ||
114 | HOSTNAME = localhost | ||
115 | PORT = 12366 | ||
116 | UNIXPATH = /tmp/gnunet-p1-service-arm.sock | ||
117 | |||
118 | [TESTING] | ||
119 | WEAKRANDOM = YES | ||
120 | |||
121 | [gnunetd] | ||
122 | HOSTKEY = $SERVICEHOME/.hostkey | ||
123 | |||
124 | [PATHS] | ||
125 | DEFAULTCONFIG = test_transport_api_multi_peer1.conf | ||
126 | SERVICEHOME = /tmp/test-gnunetd-transport-multi-peer-1/ | ||
127 | |||
128 | |||
129 | [dht] | ||
130 | AUTOSTART = NO | ||
131 | |||
132 | |||
diff --git a/src/transport/test_transport_api_multi_peer2.conf b/src/transport/test_transport_api_multi_peer2.conf new file mode 100644 index 000000000..d00f0a0be --- /dev/null +++ b/src/transport/test_transport_api_multi_peer2.conf | |||
@@ -0,0 +1,134 @@ | |||
1 | [transport-tcp] | ||
2 | DISABLEV6 = YES | ||
3 | PORT = 0 | ||
4 | BINDTO = 127.0.0.1 | ||
5 | BEHIND_NAT = NO | ||
6 | ALLOW_NAT = NO | ||
7 | ENABLE_UPNP = NO | ||
8 | EXTERNAL_ADDRESS = 127.0.0.1 | ||
9 | INTERNAL_ADDRESS = 127.0.0.1 | ||
10 | |||
11 | [transport-udp] | ||
12 | PORT = 40001 | ||
13 | |||
14 | [transport-http] | ||
15 | PORT = 40002 | ||
16 | DEBUG = NO | ||
17 | USE_IPv6 = YES | ||
18 | USE_IPv4 = YES | ||
19 | #BINDTO4 = 127.0.0.1 | ||
20 | #BINDTO6 = ::1 | ||
21 | |||
22 | [transport-https] | ||
23 | PORT = 40003 | ||
24 | DEBUG = NO | ||
25 | USE_IPv6 = YES | ||
26 | USE_IPv4 = YES | ||
27 | #BINDTO4 = 127.0.0.1 | ||
28 | #BINDTO6 = ::1 | ||
29 | |||
30 | |||
31 | [core] | ||
32 | AUTOSTART = NO | ||
33 | |||
34 | [fs] | ||
35 | AUTOSTART = NO | ||
36 | |||
37 | [datastore] | ||
38 | AUTOSTART = NO | ||
39 | |||
40 | [hostlist] | ||
41 | HTTP-PROXY = | ||
42 | SERVERS = http://gnunet.org:8080/ | ||
43 | OPTIONS = -b | ||
44 | BINARY = gnunet-daemon-hostlist | ||
45 | CONFIG = $DEFAULTCONFIG | ||
46 | HOME = $SERVICEHOME | ||
47 | HOSTNAME = localhost | ||
48 | HTTPPORT = 8080 | ||
49 | |||
50 | [topology] | ||
51 | BINARY = gnunet-daemon-topology | ||
52 | CONFIG = $DEFAULTCONFIG | ||
53 | FRIENDS = $SERVICEHOME/friends | ||
54 | TARGET-CONNECTION-COUNT = 16 | ||
55 | AUTOCONNECT = YES | ||
56 | FRIENDS-ONLY = NO | ||
57 | MINIMUM-FRIENDS = 0 | ||
58 | |||
59 | [transport] | ||
60 | PLUGINS = tcp udp http https | ||
61 | #DEBUG = YES | ||
62 | ACCEPT_FROM6 = ::1; | ||
63 | ACCEPT_FROM = 127.0.0.1; | ||
64 | NEIGHBOUR_LIMIT = 50 | ||
65 | #BINARY = /home/mrwiggles/documents/research/gnunet/gnunet-ng/src/transport/.libs/gnunet-service-transport | ||
66 | BINARY = gnunet-service-transport | ||
67 | CONFIG = $DEFAULTCONFIG | ||
68 | HOME = $SERVICEHOME | ||
69 | HOSTNAME = localhost | ||
70 | PORT = 22365 | ||
71 | UNIXPATH = /tmp/gnunet-p2-service-transport.sock | ||
72 | #PREFIX = valgrind --tool=callgrind | ||
73 | #PREFIX = xterm -T transport2 -e gdb --command=cmd --args | ||
74 | #PREFIX = valgrind --leak-check=full | ||
75 | |||
76 | [peerinfo] | ||
77 | TRUST = $SERVICEHOME/data/credit/ | ||
78 | HOSTS = $SERVICEHOME/data/hosts/ | ||
79 | ACCEPT_FROM6 = ::1; | ||
80 | ACCEPT_FROM = 127.0.0.1; | ||
81 | BINARY = gnunet-service-peerinfo | ||
82 | CONFIG = $DEFAULTCONFIG | ||
83 | HOME = $SERVICEHOME | ||
84 | HOSTNAME = localhost | ||
85 | PORT = 22369 | ||
86 | UNIXPATH = /tmp/gnunet-p2-service-peerinfo.sock | ||
87 | |||
88 | [resolver] | ||
89 | ACCEPT_FROM6 = ::1; | ||
90 | ACCEPT_FROM = 127.0.0.1; | ||
91 | BINARY = gnunet-service-resolver | ||
92 | CONFIG = $DEFAULTCONFIG | ||
93 | HOME = $SERVICEHOME | ||
94 | HOSTNAME = localhost | ||
95 | PORT = 22364 | ||
96 | UNIXPATH = /tmp/gnunet-p2-service-resolver.sock | ||
97 | |||
98 | [statistics] | ||
99 | AUTOSTART = YES | ||
100 | ACCEPT_FROM6 = ::1; | ||
101 | ACCEPT_FROM = 127.0.0.1; | ||
102 | BINARY = gnunet-service-statistics | ||
103 | CONFIG = $DEFAULTCONFIG | ||
104 | HOME = $SERVICEHOME | ||
105 | HOSTNAME = localhost | ||
106 | PORT = 22367 | ||
107 | UNIXPATH = /tmp/gnunet-p2-service-statistics.sock | ||
108 | |||
109 | [arm] | ||
110 | DEFAULTSERVICES = transport | ||
111 | ACCEPT_FROM6 = ::1; | ||
112 | ACCEPT_FROM = 127.0.0.1; | ||
113 | BINARY = gnunet-service-arm | ||
114 | CONFIG = $DEFAULTCONFIG | ||
115 | HOME = $SERVICEHOME | ||
116 | HOSTNAME = localhost | ||
117 | PORT = 22366 | ||
118 | UNIXPATH = /tmp/gnunet-p2-service-arm.sock | ||
119 | |||
120 | [TESTING] | ||
121 | WEAKRANDOM = YES | ||
122 | |||
123 | [gnunetd] | ||
124 | HOSTKEY = $SERVICEHOME/.hostkey | ||
125 | |||
126 | [PATHS] | ||
127 | DEFAULTCONFIG = test_transport_api_multi_peer2.conf | ||
128 | SERVICEHOME = /tmp/test-gnunetd-transport-multi-peer-2/ | ||
129 | |||
130 | |||
131 | [dht] | ||
132 | AUTOSTART = NO | ||
133 | |||
134 | |||