diff options
Diffstat (limited to 'src/testing/test_testing.c')
-rw-r--r-- | src/testing/test_testing.c | 41 |
1 files changed, 16 insertions, 25 deletions
diff --git a/src/testing/test_testing.c b/src/testing/test_testing.c index 1a52f3681..15b7e10ec 100644 --- a/src/testing/test_testing.c +++ b/src/testing/test_testing.c | |||
@@ -28,28 +28,26 @@ | |||
28 | 28 | ||
29 | static int ok; | 29 | static int ok; |
30 | 30 | ||
31 | static void end_cb(void *cls, | 31 | static void |
32 | const char *emsg) | 32 | end_cb (void *cls, const char *emsg) |
33 | { | 33 | { |
34 | GNUNET_assert (emsg == NULL); | 34 | GNUNET_assert (emsg == NULL); |
35 | #if VERBOSE | 35 | #if VERBOSE |
36 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 36 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Daemon terminated, will now exit.\n"); |
37 | "Daemon terminated, will now exit.\n"); | ||
38 | #endif | 37 | #endif |
39 | ok = 0; | 38 | ok = 0; |
40 | } | 39 | } |
41 | 40 | ||
42 | static void my_cb(void *cls, | 41 | static void |
43 | const struct GNUNET_PeerIdentity *id, | 42 | my_cb (void *cls, |
44 | const struct GNUNET_CONFIGURATION_Handle *cfg, | 43 | const struct GNUNET_PeerIdentity *id, |
45 | struct GNUNET_TESTING_Daemon *d, | 44 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
46 | const char *emsg) | 45 | struct GNUNET_TESTING_Daemon *d, const char *emsg) |
47 | { | 46 | { |
48 | GNUNET_assert (id != NULL); | 47 | GNUNET_assert (id != NULL); |
49 | #if VERBOSE | 48 | #if VERBOSE |
50 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 49 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
51 | "Daemon `%s' started, will now stop it.\n", | 50 | "Daemon `%s' started, will now stop it.\n", GNUNET_i2s (id)); |
52 | GNUNET_i2s (id)); | ||
53 | #endif | 51 | #endif |
54 | GNUNET_TESTING_daemon_stop (d, &end_cb, NULL); | 52 | GNUNET_TESTING_daemon_stop (d, &end_cb, NULL); |
55 | } | 53 | } |
@@ -59,21 +57,15 @@ static void | |||
59 | run (void *cls, | 57 | run (void *cls, |
60 | struct GNUNET_SCHEDULER_Handle *sched, | 58 | struct GNUNET_SCHEDULER_Handle *sched, |
61 | char *const *args, | 59 | char *const *args, |
62 | const char *cfgfile, | 60 | const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) |
63 | const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
64 | { | 61 | { |
65 | struct GNUNET_TESTING_Daemon *d; | 62 | struct GNUNET_TESTING_Daemon *d; |
66 | 63 | ||
67 | ok = 1; | 64 | ok = 1; |
68 | #if VERBOSE | 65 | #if VERBOSE |
69 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 66 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting daemon.\n"); |
70 | "Starting daemon.\n"); | ||
71 | #endif | 67 | #endif |
72 | d = GNUNET_TESTING_daemon_start (sched, | 68 | d = GNUNET_TESTING_daemon_start (sched, cfg, NULL, &my_cb, NULL); |
73 | cfg, | ||
74 | NULL, | ||
75 | &my_cb, | ||
76 | NULL); | ||
77 | GNUNET_assert (d != NULL); | 69 | GNUNET_assert (d != NULL); |
78 | } | 70 | } |
79 | 71 | ||
@@ -92,8 +84,7 @@ check () | |||
92 | GNUNET_GETOPT_OPTION_END | 84 | GNUNET_GETOPT_OPTION_END |
93 | }; | 85 | }; |
94 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, | 86 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, |
95 | argv, "test-testing", "nohelp", | 87 | argv, "test-testing", "nohelp", options, &run, &ok); |
96 | options, &run, &ok); | ||
97 | return ok; | 88 | return ok; |
98 | } | 89 | } |
99 | 90 | ||
@@ -110,7 +101,7 @@ main (int argc, char *argv[]) | |||
110 | #endif | 101 | #endif |
111 | NULL); | 102 | NULL); |
112 | ret = check (); | 103 | ret = check (); |
113 | sleep (1); /* FIXME: make this unnecessary */ | 104 | sleep (1); /* FIXME: make this unnecessary */ |
114 | GNUNET_DISK_directory_remove ("/tmp/test-gnunet-testing"); | 105 | GNUNET_DISK_directory_remove ("/tmp/test-gnunet-testing"); |
115 | return ret; | 106 | return ret; |
116 | } | 107 | } |