diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-10-29 16:14:03 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-10-29 16:14:03 +0000 |
commit | bcbcf005b4864ac5557c31da10521126d8880849 (patch) | |
tree | 444cafefb16e1c5a4ba13ce2db07d6ec1f37675e /src/statistics/test_statistics_api_watch_zero_value.c | |
parent | 119193d6350bbbd8c6ecbd60ccc8301223d6f6d6 (diff) | |
download | gnunet-bcbcf005b4864ac5557c31da10521126d8880849.tar.gz gnunet-bcbcf005b4864ac5557c31da10521126d8880849.zip |
installing all service, daemon and helper binaries to lib/gnunet/libexec/; updating code to run binaries from new location, which is no longer in PATH
Diffstat (limited to 'src/statistics/test_statistics_api_watch_zero_value.c')
-rw-r--r-- | src/statistics/test_statistics_api_watch_zero_value.c | 50 |
1 files changed, 16 insertions, 34 deletions
diff --git a/src/statistics/test_statistics_api_watch_zero_value.c b/src/statistics/test_statistics_api_watch_zero_value.c index fe3974fc9..d78de9a9e 100644 --- a/src/statistics/test_statistics_api_watch_zero_value.c +++ b/src/statistics/test_statistics_api_watch_zero_value.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2009, 2011 Christian Grothoff (and other contributing authors) | 3 | (C) 2009, 2011, 2012 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -22,21 +22,15 @@ | |||
22 | * @brief testcase for statistics_api.c watch functions with initial 0 value | 22 | * @brief testcase for statistics_api.c watch functions with initial 0 value |
23 | */ | 23 | */ |
24 | #include "platform.h" | 24 | #include "platform.h" |
25 | #include "gnunet_common.h" | 25 | #include "gnunet_util_lib.h" |
26 | #include "gnunet_getopt_lib.h" | ||
27 | #include "gnunet_os_lib.h" | ||
28 | #include "gnunet_program_lib.h" | ||
29 | #include "gnunet_scheduler_lib.h" | ||
30 | #include "gnunet_statistics_service.h" | 26 | #include "gnunet_statistics_service.h" |
31 | 27 | ||
32 | #define VERBOSE GNUNET_NO | ||
33 | |||
34 | #define START_SERVICE GNUNET_YES | ||
35 | |||
36 | static int ok; | 28 | static int ok; |
29 | |||
37 | static int ok2; | 30 | static int ok2; |
38 | 31 | ||
39 | static struct GNUNET_STATISTICS_Handle *h; | 32 | static struct GNUNET_STATISTICS_Handle *h; |
33 | |||
40 | static struct GNUNET_STATISTICS_Handle *h2; | 34 | static struct GNUNET_STATISTICS_Handle *h2; |
41 | 35 | ||
42 | static GNUNET_SCHEDULER_TaskIdentifier shutdown_task; | 36 | static GNUNET_SCHEDULER_TaskIdentifier shutdown_task; |
@@ -92,6 +86,7 @@ watch_1 (void *cls, const char *subsystem, const char *name, uint64_t value, | |||
92 | return GNUNET_OK; | 86 | return GNUNET_OK; |
93 | } | 87 | } |
94 | 88 | ||
89 | |||
95 | static int | 90 | static int |
96 | watch_2 (void *cls, const char *subsystem, const char *name, uint64_t value, | 91 | watch_2 (void *cls, const char *subsystem, const char *name, uint64_t value, |
97 | int is_persistent) | 92 | int is_persistent) |
@@ -121,6 +116,7 @@ watch_2 (void *cls, const char *subsystem, const char *name, uint64_t value, | |||
121 | return GNUNET_OK; | 116 | return GNUNET_OK; |
122 | } | 117 | } |
123 | 118 | ||
119 | |||
124 | static void | 120 | static void |
125 | run (void *cls, char *const *args, const char *cfgfile, | 121 | run (void *cls, char *const *args, const char *cfgfile, |
126 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 122 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
@@ -145,8 +141,8 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
145 | } | 141 | } |
146 | 142 | ||
147 | 143 | ||
148 | static int | 144 | int |
149 | check () | 145 | main (int argc, char *argv_ign[]) |
150 | { | 146 | { |
151 | char *const argv[] = { "test-statistics-api", | 147 | char *const argv[] = { "test-statistics-api", |
152 | "-c", | 148 | "-c", |
@@ -156,23 +152,20 @@ check () | |||
156 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 152 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
157 | GNUNET_GETOPT_OPTION_END | 153 | GNUNET_GETOPT_OPTION_END |
158 | }; | 154 | }; |
159 | #if START_SERVICE | ||
160 | struct GNUNET_OS_Process *proc; | 155 | struct GNUNET_OS_Process *proc; |
156 | char *binary; | ||
161 | 157 | ||
158 | binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-statistics"); | ||
162 | proc = | 159 | proc = |
163 | GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-service-statistics", | 160 | GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, |
164 | "gnunet-service-statistics", | 161 | binary, |
165 | #if VERBOSE | 162 | "gnunet-service-statistics", |
166 | "-L", "DEBUG", | 163 | "-c", "test_statistics_api_data.conf", NULL); |
167 | #endif | ||
168 | "-c", "test_statistics_api_data.conf", NULL); | ||
169 | #endif | ||
170 | GNUNET_assert (NULL != proc); | 164 | GNUNET_assert (NULL != proc); |
171 | ok = 3; | 165 | ok = 3; |
172 | ok2 = 1; | 166 | ok2 = 1; |
173 | GNUNET_PROGRAM_run (3, argv, "test-statistics-api", "nohelp", options, &run, | 167 | GNUNET_PROGRAM_run (3, argv, "test-statistics-api", "nohelp", options, &run, |
174 | NULL); | 168 | NULL); |
175 | #if START_SERVICE | ||
176 | if (0 != GNUNET_OS_process_kill (proc, SIGTERM)) | 169 | if (0 != GNUNET_OS_process_kill (proc, SIGTERM)) |
177 | { | 170 | { |
178 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); | 171 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); |
@@ -181,21 +174,10 @@ check () | |||
181 | GNUNET_OS_process_wait (proc); | 174 | GNUNET_OS_process_wait (proc); |
182 | GNUNET_OS_process_destroy (proc); | 175 | GNUNET_OS_process_destroy (proc); |
183 | proc = NULL; | 176 | proc = NULL; |
184 | #endif | 177 | GNUNET_free (binary); |
185 | if ((0 == ok) && (0 == ok2)) | 178 | if ((0 == ok) && (0 == ok2)) |
186 | return 0; | 179 | return 0; |
187 | else | 180 | return 1; |
188 | return 1; | ||
189 | } | ||
190 | |||
191 | int | ||
192 | main (int argc, char *argv[]) | ||
193 | { | ||
194 | int ret; | ||
195 | |||
196 | ret = check (); | ||
197 | |||
198 | return ret; | ||
199 | } | 181 | } |
200 | 182 | ||
201 | /* end of test_statistics_api_watch_zero_value.c */ | 183 | /* end of test_statistics_api_watch_zero_value.c */ |