diff options
author | ng0 <ng0@n0.is> | 2019-09-08 12:33:09 +0000 |
---|---|---|
committer | ng0 <ng0@n0.is> | 2019-09-08 12:33:09 +0000 |
commit | d41ed82a4ea0cc8e1674b6d5d2c49fd6462610bb (patch) | |
tree | 9efd18ea7d425652085ed0bd5e8e45604bc5f6b9 /src/rps/test_rps_api.c | |
parent | a0fce305c565c0937d917a92712f15e9c5736260 (diff) | |
download | gnunet-d41ed82a4ea0cc8e1674b6d5d2c49fd6462610bb.tar.gz gnunet-d41ed82a4ea0cc8e1674b6d5d2c49fd6462610bb.zip |
uncrustify as demanded.
Diffstat (limited to 'src/rps/test_rps_api.c')
-rw-r--r-- | src/rps/test_rps_api.c | 59 |
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 | ||
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 | 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 | ||
75 | int | 76 | int |
76 | main (int argc, char *argv[]) | 77 | main(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 */ |