diff options
author | Nathan S. Evans <evans@in.tum.de> | 2011-01-05 16:44:08 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2011-01-05 16:44:08 +0000 |
commit | 00a8fb6d0433d4c9a8e8cb92ab224ff01d3c639b (patch) | |
tree | abe2f6ff5fe6adcf281a74a7c7527f7e8513cc65 /src/core/test_core_api_send_to_self.c | |
parent | 40199d8739a6aa36b279b31aa7532b66a5c8b735 (diff) | |
download | gnunet-00a8fb6d0433d4c9a8e8cb92ab224ff01d3c639b.tar.gz gnunet-00a8fb6d0433d4c9a8e8cb92ab224ff01d3c639b.zip |
hopefully send to self test will run on buildbots
Diffstat (limited to 'src/core/test_core_api_send_to_self.c')
-rw-r--r-- | src/core/test_core_api_send_to_self.c | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/src/core/test_core_api_send_to_self.c b/src/core/test_core_api_send_to_self.c index e8121e327..48dd0ee73 100644 --- a/src/core/test_core_api_send_to_self.c +++ b/src/core/test_core_api_send_to_self.c | |||
@@ -48,6 +48,11 @@ static struct GNUNET_PeerIdentity myself; | |||
48 | struct GNUNET_CORE_Handle *core; | 48 | struct GNUNET_CORE_Handle *core; |
49 | 49 | ||
50 | /** | 50 | /** |
51 | * Handle to gnunet-service-arm. | ||
52 | */ | ||
53 | struct GNUNET_OS_Process *arm_proc; | ||
54 | |||
55 | /** | ||
51 | * Function scheduled as very last function, cleans up after us | 56 | * Function scheduled as very last function, cleans up after us |
52 | */ | 57 | */ |
53 | static void | 58 | static void |
@@ -62,6 +67,19 @@ cleanup (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tskctx) | |||
62 | core = NULL; | 67 | core = NULL; |
63 | } | 68 | } |
64 | 69 | ||
70 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
71 | "Stopping peer\n"); | ||
72 | if (0 != GNUNET_OS_process_kill (arm_proc, SIGTERM)) | ||
73 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); | ||
74 | |||
75 | if (GNUNET_OS_process_wait(arm_proc) != GNUNET_OK) | ||
76 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid"); | ||
77 | |||
78 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
79 | "ARM process %u stopped\n", GNUNET_OS_process_get_pid (arm_proc)); | ||
80 | GNUNET_OS_process_close (arm_proc); | ||
81 | arm_proc = NULL; | ||
82 | |||
65 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Ending test.\n"); | 83 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Ending test.\n"); |
66 | } | 84 | } |
67 | 85 | ||
@@ -137,18 +155,28 @@ connect_cb (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
137 | static void | 155 | static void |
138 | run (void *cls, | 156 | run (void *cls, |
139 | char *const *args, | 157 | char *const *args, |
140 | const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg_) | 158 | const char *cfgfile, |
159 | const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
141 | { | 160 | { |
142 | const static struct GNUNET_CORE_MessageHandler handlers[] = { | 161 | const static struct GNUNET_CORE_MessageHandler handlers[] = { |
143 | {receive, GNUNET_MESSAGE_TYPE_SERVICE_UDP, 0}, | 162 | {&receive, GNUNET_MESSAGE_TYPE_SERVICE_UDP, 0}, |
144 | {NULL, 0, 0} | 163 | {NULL, 0, 0} |
145 | }; | 164 | }; |
146 | core = GNUNET_CORE_connect (cfg_, | 165 | |
166 | arm_proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | ||
167 | "gnunet-service-arm", | ||
168 | #if VERBOSE | ||
169 | "-L", "DEBUG", | ||
170 | #endif | ||
171 | "-c", "test_core_api_data.conf", NULL); | ||
172 | |||
173 | core = GNUNET_CORE_connect (cfg, | ||
147 | 42, | 174 | 42, |
148 | NULL, | 175 | NULL, |
149 | init, | 176 | &init, |
150 | connect_cb, | 177 | &connect_cb, |
151 | NULL, NULL, NULL, 0, NULL, 0, handlers); | 178 | NULL, NULL, NULL, 0, NULL, 0, handlers); |
179 | |||
152 | die_task = GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 60), &cleanup, cls); | 180 | die_task = GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 60), &cleanup, cls); |
153 | } | 181 | } |
154 | 182 | ||