X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fcore%2Ftest_core_api_start_only.c;h=d9cb4150d43ebaffffc4e60e735689a7456e7b1a;hb=d0b4927e6ab7e8b9874dd7807055e77fb4c5163f;hp=8c8132043dcbd6a6329c19536eaa3e749600de24;hpb=16546613251edfcd595e4f584b1a2d2a414d0b1a;p=oweals%2Fgnunet.git diff --git a/src/core/test_core_api_start_only.c b/src/core/test_core_api_start_only.c index 8c8132043..d9cb4150d 100644 --- a/src/core/test_core_api_start_only.c +++ b/src/core/test_core_api_start_only.c @@ -31,12 +31,8 @@ #include "gnunet_program_lib.h" #include "gnunet_scheduler_lib.h" -#define VERBOSE GNUNET_NO - #define TIMEOUT 5 -#define START_ARM GNUNET_YES - #define MTYPE 12345 struct PeerContext @@ -44,9 +40,7 @@ struct PeerContext struct GNUNET_CONFIGURATION_Handle *cfg; struct GNUNET_CORE_Handle *ch; struct GNUNET_PeerIdentity id; -#if START_ARM struct GNUNET_OS_Process *arm_proc; -#endif }; static struct PeerContext p1; @@ -115,8 +109,6 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) } - - static void init_notify (void *cls, struct GNUNET_CORE_Handle *server, const struct GNUNET_PeerIdentity *my_identity) @@ -129,7 +121,7 @@ init_notify (void *cls, struct GNUNET_CORE_Handle *server, { /* connect p2 */ p2.ch = - GNUNET_CORE_connect (p2.cfg, 1, &p2, &init_notify, &connect_notify, + GNUNET_CORE_connect (p2.cfg, &p2, &init_notify, &connect_notify, &disconnect_notify, &inbound_notify, GNUNET_YES, &outbound_notify, GNUNET_YES, handlers); } @@ -145,17 +137,18 @@ init_notify (void *cls, struct GNUNET_CORE_Handle *server, static void setup_peer (struct PeerContext *p, const char *cfgname) { + char *binary; + + binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm"); p->cfg = GNUNET_CONFIGURATION_create (); -#if START_ARM p->arm_proc = - GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", - "gnunet-service-arm", -#if VERBOSE - "-L", "DEBUG", -#endif - "-c", cfgname, NULL); -#endif + GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, + NULL, NULL, + binary, + "gnunet-service-arm", + "-c", cfgname, NULL); GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); + GNUNET_free (binary); } @@ -177,7 +170,6 @@ timeout_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) } - static void run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) @@ -191,7 +183,7 @@ run (void *cls, char *const *args, const char *cfgfile, (GNUNET_TIME_UNIT_MINUTES, TIMEOUT), &timeout_task, NULL); p1.ch = - GNUNET_CORE_connect (p1.cfg, 1, &p1, &init_notify, &connect_notify, + GNUNET_CORE_connect (p1.cfg, &p1, &init_notify, &connect_notify, &disconnect_notify, &inbound_notify, GNUNET_YES, &outbound_notify, GNUNET_YES, handlers); } @@ -201,7 +193,6 @@ static void stop_arm (struct PeerContext *p) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peer\n"); -#if START_ARM if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM)) GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); if (GNUNET_OS_process_wait (p->arm_proc) != GNUNET_OK) @@ -210,7 +201,6 @@ stop_arm (struct PeerContext *p) GNUNET_OS_process_get_pid (p->arm_proc)); GNUNET_OS_process_destroy (p->arm_proc); p->arm_proc = NULL; -#endif GNUNET_CONFIGURATION_destroy (p->cfg); } @@ -221,9 +211,6 @@ check () char *const argv[] = { "test-core-api-start-only", "-c", "test_core_api_data.conf", -#if VERBOSE - "-L", "DEBUG", -#endif NULL }; struct GNUNET_GETOPT_CommandLineOption options[] = { @@ -241,17 +228,14 @@ check () return ok; } + int main (int argc, char *argv[]) { int ret; GNUNET_log_setup ("test-core-api-start-only", -#if VERBOSE - "DEBUG", -#else "WARNING", -#endif NULL); ret = check (); GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-peer-1");