aboutsummaryrefslogtreecommitdiff
path: root/src/contrib/service/rps/test_rps_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/contrib/service/rps/test_rps_api.c')
-rw-r--r--src/contrib/service/rps/test_rps_api.c87
1 files changed, 87 insertions, 0 deletions
diff --git a/src/contrib/service/rps/test_rps_api.c b/src/contrib/service/rps/test_rps_api.c
new file mode 100644
index 000000000..06dad2887
--- /dev/null
+++ b/src/contrib/service/rps/test_rps_api.c
@@ -0,0 +1,87 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C)
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
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/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20/**
21 * @file rps/test_rps_api.c
22 * @brief testcase for rps_api.c
23 */
24#include "platform.h"
25#include "gnunet_util_lib.h"
26#include "gnunet_rps_service.h"
27
28
29static int ok = 1;
30
31
32static void
33run (void *cls,
34 char *const *args,
35 const char *cfgfile,
36 const struct GNUNET_CONFIGURATION_Handle *cfg)
37{
38 ok = 0;
39}
40
41
42static int
43check ()
44{
45 char *const argv[] = { "test-rps-api", NULL };
46 struct GNUNET_GETOPT_CommandLineOption options[] = {
47 GNUNET_GETOPT_OPTION_END
48 };
49 struct GNUNET_OS_Process *proc;
50 char *path = GNUNET_OS_get_libexec_binary_path ("gnunet-service-rps");
51
52 if (NULL == path)
53 {
54 fprintf (stderr, "Service executable not found `%s'\n",
55 "gnunet-service-rps");
56 return;
57 }
58
59 proc = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_ALL, NULL,
60 NULL, NULL, path, "gnunet-service-rps", NULL);
61
62 GNUNET_free (path);
63 GNUNET_assert (NULL != proc);
64 GNUNET_PROGRAM_run (1, argv, "test-rps-api", "nohelp",
65 options, &run, &ok);
66 if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
67 {
68 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
69 ok = 1;
70 }
71 GNUNET_OS_process_wait (proc);
72 GNUNET_OS_process_destroy (proc);
73 return ok;
74}
75
76
77int
78main (int argc, char *argv[])
79{
80 GNUNET_log_setup ("test_statistics_api",
81 "WARNING",
82 NULL);
83 return check ();
84}
85
86
87/* end of test_rps_api.c */