diff options
Diffstat (limited to 'src/rps/test_rps_api.c')
-rw-r--r-- | src/rps/test_rps_api.c | 61 |
1 files changed, 31 insertions, 30 deletions
diff --git a/src/rps/test_rps_api.c b/src/rps/test_rps_api.c index 97dccd789..6fca7ea12 100644 --- a/src/rps/test_rps_api.c +++ b/src/rps/test_rps_api.c | |||
@@ -30,56 +30,57 @@ static int ok = 1; | |||
30 | 30 | ||
31 | 31 | ||
32 | static void | 32 | static void |
33 | run(void *cls, | 33 | run (void *cls, |
34 | char *const *args, | 34 | char *const *args, |
35 | const char *cfgfile, | 35 | const char *cfgfile, |
36 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 36 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
37 | { | 37 | { |
38 | ok = 0; | 38 | ok = 0; |
39 | } | 39 | } |
40 | 40 | ||
41 | 41 | ||
42 | static int | 42 | static int |
43 | check() | 43 | check () |
44 | { | 44 | { |
45 | char *const argv[] = { "test-rps-api", NULL }; | 45 | char *const argv[] = { "test-rps-api", NULL }; |
46 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 46 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
47 | GNUNET_GETOPT_OPTION_END | 47 | GNUNET_GETOPT_OPTION_END |
48 | }; | 48 | }; |
49 | struct GNUNET_OS_Process *proc; | 49 | struct GNUNET_OS_Process *proc; |
50 | char *path = GNUNET_OS_get_libexec_binary_path("gnunet-service-rps"); | 50 | char *path = GNUNET_OS_get_libexec_binary_path ("gnunet-service-rps"); |
51 | 51 | ||
52 | if (NULL == path) | 52 | if (NULL == path) |
53 | { | 53 | { |
54 | fprintf(stderr, "Service executable not found `%s'\n", "gnunet-service-rps"); | 54 | fprintf (stderr, "Service executable not found `%s'\n", |
55 | return; | 55 | "gnunet-service-rps"); |
56 | } | 56 | return; |
57 | 57 | } | |
58 | proc = GNUNET_OS_start_process(GNUNET_NO, GNUNET_OS_INHERIT_STD_ALL, NULL, | 58 | |
59 | NULL, NULL, path, "gnunet-service-rps", NULL); | 59 | proc = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_ALL, NULL, |
60 | 60 | NULL, NULL, path, "gnunet-service-rps", NULL); | |
61 | GNUNET_free(path); | 61 | |
62 | GNUNET_assert(NULL != proc); | 62 | GNUNET_free (path); |
63 | GNUNET_PROGRAM_run(1, argv, "test-rps-api", "nohelp", | 63 | GNUNET_assert (NULL != proc); |
64 | options, &run, &ok); | 64 | GNUNET_PROGRAM_run (1, argv, "test-rps-api", "nohelp", |
65 | if (0 != GNUNET_OS_process_kill(proc, SIGTERM)) | 65 | options, &run, &ok); |
66 | { | 66 | if (0 != GNUNET_OS_process_kill (proc, SIGTERM)) |
67 | GNUNET_log_strerror(GNUNET_ERROR_TYPE_WARNING, "kill"); | 67 | { |
68 | ok = 1; | 68 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); |
69 | } | 69 | ok = 1; |
70 | GNUNET_OS_process_wait(proc); | 70 | } |
71 | GNUNET_OS_process_destroy(proc); | 71 | GNUNET_OS_process_wait (proc); |
72 | GNUNET_OS_process_destroy (proc); | ||
72 | return ok; | 73 | return ok; |
73 | } | 74 | } |
74 | 75 | ||
75 | 76 | ||
76 | int | 77 | int |
77 | main(int argc, char *argv[]) | 78 | main (int argc, char *argv[]) |
78 | { | 79 | { |
79 | GNUNET_log_setup("test_statistics_api", | 80 | GNUNET_log_setup ("test_statistics_api", |
80 | "WARNING", | 81 | "WARNING", |
81 | NULL); | 82 | NULL); |
82 | return check(); | 83 | return check (); |
83 | } | 84 | } |
84 | 85 | ||
85 | /* end of test_rps_api.c */ | 86 | /* end of test_rps_api.c */ |