summaryrefslogtreecommitdiff
path: root/src/rps/test_rps_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rps/test_rps_api.c')
-rw-r--r--src/rps/test_rps_api.c59
1 files changed, 30 insertions, 29 deletions
diff --git a/src/rps/test_rps_api.c b/src/rps/test_rps_api.c
index c0ebac6c4..97dccd789 100644
--- a/src/rps/test_rps_api.c
+++ b/src/rps/test_rps_api.c
@@ -11,12 +11,12 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
18 SPDX-License-Identifier: AGPL3.0-or-later 18 SPDX-License-Identifier: AGPL3.0-or-later
19*/ 19 */
20/** 20/**
21 * @file rps/test_rps_api.c 21 * @file rps/test_rps_api.c
22 * @brief testcase for rps_api.c 22 * @brief testcase for rps_api.c
@@ -30,55 +30,56 @@ static int ok = 1;
30 30
31 31
32static void 32static void
33run (void *cls, 33run(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
42static int 42static int
43check () 43check()
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 if (NULL == path) 52 if (NULL == path)
52 {
53 fprintf (stderr, "Service executable not found `%s'\n", "gnunet-service-rps");
54 return;
55 }
56
57 proc = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_ALL, NULL,
58 NULL, NULL, path, "gnunet-service-rps", NULL);
59
60 GNUNET_free (path);
61 GNUNET_assert (NULL != proc);
62 GNUNET_PROGRAM_run (1, argv, "test-rps-api", "nohelp",
63 options, &run, &ok);
64 if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
65 { 53 {
66 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); 54 fprintf(stderr, "Service executable not found `%s'\n", "gnunet-service-rps");
55 return;
56 }
57
58 proc = GNUNET_OS_start_process(GNUNET_NO, GNUNET_OS_INHERIT_STD_ALL, NULL,
59 NULL, NULL, path, "gnunet-service-rps", NULL);
60
61 GNUNET_free(path);
62 GNUNET_assert(NULL != proc);
63 GNUNET_PROGRAM_run(1, argv, "test-rps-api", "nohelp",
64 options, &run, &ok);
65 if (0 != GNUNET_OS_process_kill(proc, SIGTERM))
66 {
67 GNUNET_log_strerror(GNUNET_ERROR_TYPE_WARNING, "kill");
67 ok = 1; 68 ok = 1;
68 } 69 }
69 GNUNET_OS_process_wait (proc); 70 GNUNET_OS_process_wait(proc);
70 GNUNET_OS_process_destroy (proc); 71 GNUNET_OS_process_destroy(proc);
71 return ok; 72 return ok;
72} 73}
73 74
74 75
75int 76int
76main (int argc, char *argv[]) 77main(int argc, char *argv[])
77{ 78{
78 GNUNET_log_setup ("test_statistics_api", 79 GNUNET_log_setup("test_statistics_api",
79 "WARNING", 80 "WARNING",
80 NULL); 81 NULL);
81 return check (); 82 return check();
82} 83}
83 84
84/* end of test_rps_api.c */ 85/* end of test_rps_api.c */