diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-06-10 11:43:20 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-06-10 11:43:20 +0000 |
commit | dadbf4c950bf4cd459c95ac4ab61a02af7b3668b (patch) | |
tree | ddaf0644dcd97fbef7f67a68eff2a5cf204b0bb7 /src/datacache/test_datacache.c | |
parent | 8efaae301b29ec7cbdb921ac5e6b30ae2c143568 (diff) | |
download | gnunet-dadbf4c950bf4cd459c95ac4ab61a02af7b3668b.tar.gz gnunet-dadbf4c950bf4cd459c95ac4ab61a02af7b3668b.zip |
-using new testing api to determine plugin name
Diffstat (limited to 'src/datacache/test_datacache.c')
-rw-r--r-- | src/datacache/test_datacache.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/src/datacache/test_datacache.c b/src/datacache/test_datacache.c index 97e2cda30..c818daaa8 100644 --- a/src/datacache/test_datacache.c +++ b/src/datacache/test_datacache.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include "platform.h" | 25 | #include "platform.h" |
26 | #include "gnunet_util_lib.h" | 26 | #include "gnunet_util_lib.h" |
27 | #include "gnunet_datacache_lib.h" | 27 | #include "gnunet_datacache_lib.h" |
28 | #include "gnunet_testing_lib-new.h" | ||
28 | 29 | ||
29 | #define ASSERT(x) do { if (! (x)) { printf("Error at %s:%d\n", __FILE__, __LINE__); goto FAILURE;} } while (0) | 30 | #define ASSERT(x) do { if (! (x)) { printf("Error at %s:%d\n", __FILE__, __LINE__); goto FAILURE;} } while (0) |
30 | 31 | ||
@@ -114,9 +115,7 @@ FAILURE: | |||
114 | int | 115 | int |
115 | main (int argc, char *argv[]) | 116 | main (int argc, char *argv[]) |
116 | { | 117 | { |
117 | char *pos; | ||
118 | char cfg_name[128]; | 118 | char cfg_name[128]; |
119 | |||
120 | char *const xargv[] = { | 119 | char *const xargv[] = { |
121 | "test-datacache", | 120 | "test-datacache", |
122 | "-c", | 121 | "-c", |
@@ -130,22 +129,12 @@ main (int argc, char *argv[]) | |||
130 | GNUNET_log_setup ("test-datacache", | 129 | GNUNET_log_setup ("test-datacache", |
131 | "WARNING", | 130 | "WARNING", |
132 | NULL); | 131 | NULL); |
133 | /* determine name of plugin to use */ | 132 | plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]); |
134 | plugin_name = argv[0]; | ||
135 | while (NULL != (pos = strstr (plugin_name, "_"))) | ||
136 | plugin_name = pos + 1; | ||
137 | if (NULL != (pos = strstr (plugin_name, "."))) | ||
138 | pos[0] = 0; | ||
139 | else | ||
140 | pos = (char *) plugin_name; | ||
141 | |||
142 | GNUNET_snprintf (cfg_name, sizeof (cfg_name), "test_datacache_data_%s.conf", | 133 | GNUNET_snprintf (cfg_name, sizeof (cfg_name), "test_datacache_data_%s.conf", |
143 | plugin_name); | 134 | plugin_name); |
144 | if (pos != plugin_name) | ||
145 | pos[0] = '.'; | ||
146 | GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv, | 135 | GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv, |
147 | "test-datacache", "nohelp", options, &run, NULL); | 136 | "test-datacache", "nohelp", options, &run, NULL); |
148 | if (ok != 0) | 137 | if (0 != ok) |
149 | FPRINTF (stderr, "Missed some testcases: %d\n", ok); | 138 | FPRINTF (stderr, "Missed some testcases: %d\n", ok); |
150 | return ok; | 139 | return ok; |
151 | } | 140 | } |