diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-05-22 12:42:58 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-05-22 12:42:58 +0000 |
commit | 7b636c9e74039f14b25e70d1050432d9782efef9 (patch) | |
tree | 123c283ba01ca97ff885628c5bf62e8109e30cc3 /src/regex/test_regex_integration.c | |
parent | 157f7872646546aa956e36b3c3629eed00013f45 (diff) | |
download | gnunet-7b636c9e74039f14b25e70d1050432d9782efef9.tar.gz gnunet-7b636c9e74039f14b25e70d1050432d9782efef9.zip |
-improving testcase
Diffstat (limited to 'src/regex/test_regex_integration.c')
-rw-r--r-- | src/regex/test_regex_integration.c | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/src/regex/test_regex_integration.c b/src/regex/test_regex_integration.c index 734b1c604..b28ab15d0 100644 --- a/src/regex/test_regex_integration.c +++ b/src/regex/test_regex_integration.c | |||
@@ -25,6 +25,7 @@ | |||
25 | * @author Christian Grothoff | 25 | * @author Christian Grothoff |
26 | */ | 26 | */ |
27 | #include "platform.h" | 27 | #include "platform.h" |
28 | #include "gnunet_applications.h" | ||
28 | #include "gnunet_util_lib.h" | 29 | #include "gnunet_util_lib.h" |
29 | #include "gnunet_tun_lib.h" | 30 | #include "gnunet_tun_lib.h" |
30 | #include "gnunet_testing_lib.h" | 31 | #include "gnunet_testing_lib.h" |
@@ -75,7 +76,6 @@ end (void *cls, | |||
75 | static void | 76 | static void |
76 | end_badly () | 77 | end_badly () |
77 | { | 78 | { |
78 | die_task = NULL; | ||
79 | FPRINTF (stderr, "%s", "Testcase failed (timeout).\n"); | 79 | FPRINTF (stderr, "%s", "Testcase failed (timeout).\n"); |
80 | end (NULL, NULL); | 80 | end (NULL, NULL); |
81 | ok = 1; | 81 | ok = 1; |
@@ -125,9 +125,13 @@ run (void *cls, | |||
125 | struct GNUNET_TESTING_Peer *peer) | 125 | struct GNUNET_TESTING_Peer *peer) |
126 | { | 126 | { |
127 | char rxstr4[GNUNET_TUN_IPV4_REGEXLEN]; | 127 | char rxstr4[GNUNET_TUN_IPV4_REGEXLEN]; |
128 | char rxstr6[GNUNET_TUN_IPV4_REGEXLEN]; | 128 | char rxstr6[GNUNET_TUN_IPV6_REGEXLEN]; |
129 | char *p4r; | ||
130 | char *p6r; | ||
129 | char *p4; | 131 | char *p4; |
130 | char *p6; | 132 | char *p6; |
133 | char *ss4; | ||
134 | char *ss6; | ||
131 | struct in_addr i4; | 135 | struct in_addr i4; |
132 | struct in6_addr i6; | 136 | struct in6_addr i6; |
133 | 137 | ||
@@ -148,8 +152,26 @@ run (void *cls, | |||
148 | GNUNET_TUN_ipv6toregexsearch (&i6, | 152 | GNUNET_TUN_ipv6toregexsearch (&i6, |
149 | 8686, | 153 | 8686, |
150 | rxstr6); | 154 | rxstr6); |
151 | p4 = GNUNET_TUN_ipv4policy2regex ("0.0.0.0/0:!25;"); | 155 | GNUNET_asprintf (&ss4, |
152 | p6 = GNUNET_TUN_ipv6policy2regex ("::/0:!25;"); | 156 | "%s%s", |
157 | GNUNET_APPLICATION_TYPE_EXIT_REGEX_PREFIX, | ||
158 | rxstr4); | ||
159 | GNUNET_asprintf (&ss6, | ||
160 | "%s%s", | ||
161 | GNUNET_APPLICATION_TYPE_EXIT_REGEX_PREFIX, | ||
162 | rxstr6); | ||
163 | p4r = GNUNET_TUN_ipv4policy2regex ("0.0.0.0/0:!25;"); | ||
164 | p6r = GNUNET_TUN_ipv6policy2regex ("::/0:!25;"); | ||
165 | GNUNET_asprintf (&p4, | ||
166 | "%s%s", | ||
167 | GNUNET_APPLICATION_TYPE_EXIT_REGEX_PREFIX, | ||
168 | p4r); | ||
169 | GNUNET_asprintf (&p6, | ||
170 | "%s%s", | ||
171 | GNUNET_APPLICATION_TYPE_EXIT_REGEX_PREFIX, | ||
172 | p6r); | ||
173 | GNUNET_free (p4r); | ||
174 | GNUNET_free (p6r); | ||
153 | a4 = GNUNET_REGEX_announce (cfg, | 175 | a4 = GNUNET_REGEX_announce (cfg, |
154 | p4, | 176 | p4, |
155 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, | 177 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, |
@@ -164,11 +186,13 @@ run (void *cls, | |||
164 | GNUNET_free (p6); | 186 | GNUNET_free (p6); |
165 | 187 | ||
166 | s4 = GNUNET_REGEX_search (cfg, | 188 | s4 = GNUNET_REGEX_search (cfg, |
167 | rxstr4, | 189 | ss4, |
168 | &found_cb, "4"); | 190 | &found_cb, "4"); |
169 | s6 = GNUNET_REGEX_search (cfg, | 191 | s6 = GNUNET_REGEX_search (cfg, |
170 | rxstr6, | 192 | ss6, |
171 | &found_cb, "6"); | 193 | &found_cb, "6"); |
194 | GNUNET_free (ss4); | ||
195 | GNUNET_free (ss6); | ||
172 | } | 196 | } |
173 | 197 | ||
174 | 198 | ||