aboutsummaryrefslogtreecommitdiff
path: root/src/fs/test_fs_start_stop.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/test_fs_start_stop.c')
-rw-r--r--src/fs/test_fs_start_stop.c55
1 files changed, 26 insertions, 29 deletions
diff --git a/src/fs/test_fs_start_stop.c b/src/fs/test_fs_start_stop.c
index 5080ecc18..e38a4b965 100644
--- a/src/fs/test_fs_start_stop.c
+++ b/src/fs/test_fs_start_stop.c
@@ -45,8 +45,7 @@ struct PeerContext
45 45
46 46
47static void * 47static void *
48progress_cb (void *cls, 48progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event)
49 const struct GNUNET_FS_ProgressInfo *event)
50{ 49{
51 return NULL; 50 return NULL;
52} 51}
@@ -58,11 +57,11 @@ setup_peer (struct PeerContext *p, const char *cfgname)
58 p->cfg = GNUNET_CONFIGURATION_create (); 57 p->cfg = GNUNET_CONFIGURATION_create ();
59#if START_ARM 58#if START_ARM
60 p->arm_proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", 59 p->arm_proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm",
61 "gnunet-service-arm", 60 "gnunet-service-arm",
62#if VERBOSE 61#if VERBOSE
63 "-L", "DEBUG", 62 "-L", "DEBUG",
64#endif 63#endif
65 "-c", cfgname, NULL); 64 "-c", cfgname, NULL);
66#endif 65#endif
67 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); 66 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
68} 67}
@@ -73,16 +72,17 @@ stop_arm (struct PeerContext *p)
73{ 72{
74#if START_ARM 73#if START_ARM
75 if (NULL != p->arm_proc) 74 if (NULL != p->arm_proc)
76 { 75 {
77 if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM)) 76 if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
78 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); 77 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
79 if (GNUNET_OS_process_wait(p->arm_proc) != GNUNET_OK) 78 if (GNUNET_OS_process_wait (p->arm_proc) != GNUNET_OK)
80 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid"); 79 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
81 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 80 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
82 "ARM process %u stopped\n", GNUNET_OS_process_get_pid (p->arm_proc)); 81 "ARM process %u stopped\n",
83 GNUNET_OS_process_close (p->arm_proc); 82 GNUNET_OS_process_get_pid (p->arm_proc));
84 p->arm_proc = NULL; 83 GNUNET_OS_process_close (p->arm_proc);
85 } 84 p->arm_proc = NULL;
85 }
86#endif 86#endif
87 GNUNET_CONFIGURATION_destroy (p->cfg); 87 GNUNET_CONFIGURATION_destroy (p->cfg);
88} 88}
@@ -91,19 +91,16 @@ stop_arm (struct PeerContext *p)
91static void 91static void
92run (void *cls, 92run (void *cls,
93 char *const *args, 93 char *const *args,
94 const char *cfgfile, 94 const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
95 const struct GNUNET_CONFIGURATION_Handle *cfg)
96{ 95{
97 struct GNUNET_FS_Handle *fs; 96 struct GNUNET_FS_Handle *fs;
98 97
99 setup_peer (&p1, "test_fs_data.conf"); 98 setup_peer (&p1, "test_fs_data.conf");
100 fs = GNUNET_FS_start (cfg, 99 fs = GNUNET_FS_start (cfg,
101 "test-fs-start-stop", 100 "test-fs-start-stop",
102 &progress_cb, 101 &progress_cb,
103 NULL, 102 NULL, GNUNET_FS_FLAGS_NONE, GNUNET_FS_OPTIONS_END);
104 GNUNET_FS_FLAGS_NONE, 103 GNUNET_assert (NULL != fs);
105 GNUNET_FS_OPTIONS_END);
106 GNUNET_assert (NULL != fs);
107 GNUNET_FS_stop (fs); 104 GNUNET_FS_stop (fs);
108} 105}
109 106
@@ -111,7 +108,7 @@ run (void *cls,
111int 108int
112main (int argc, char *argv[]) 109main (int argc, char *argv[])
113{ 110{
114 char *const argvx[] = { 111 char *const argvx[] = {
115 "test-fs-start-stop", 112 "test-fs-start-stop",
116 "-c", 113 "-c",
117 "test_fs_data.conf", 114 "test_fs_data.conf",
@@ -124,16 +121,16 @@ main (int argc, char *argv[])
124 GNUNET_GETOPT_OPTION_END 121 GNUNET_GETOPT_OPTION_END
125 }; 122 };
126 123
127 GNUNET_log_setup ("test_fs_start_stop", 124 GNUNET_log_setup ("test_fs_start_stop",
128#if VERBOSE 125#if VERBOSE
129 "DEBUG", 126 "DEBUG",
130#else 127#else
131 "WARNING", 128 "WARNING",
132#endif 129#endif
133 NULL); 130 NULL);
134 GNUNET_PROGRAM_run ((sizeof (argvx) / sizeof (char *)) - 1, 131 GNUNET_PROGRAM_run ((sizeof (argvx) / sizeof (char *)) - 1,
135 argvx, "test-fs-start-stop", 132 argvx, "test-fs-start-stop",
136 "nohelp", options, &run, NULL); 133 "nohelp", options, &run, NULL);
137 stop_arm (&p1); 134 stop_arm (&p1);
138 GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs/"); 135 GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs/");
139 return 0; 136 return 0;