aboutsummaryrefslogtreecommitdiff
path: root/src/statistics/test_statistics_api_watch.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/statistics/test_statistics_api_watch.c')
-rw-r--r--src/statistics/test_statistics_api_watch.c38
1 files changed, 12 insertions, 26 deletions
diff --git a/src/statistics/test_statistics_api_watch.c b/src/statistics/test_statistics_api_watch.c
index f3524aa7c..1e7f27b3e 100644
--- a/src/statistics/test_statistics_api_watch.c
+++ b/src/statistics/test_statistics_api_watch.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2009, 2011 Christian Grothoff (and other contributing authors) 3 (C) 2009, 2011, 2012 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -20,6 +20,7 @@
20/** 20/**
21 * @file statistics/test_statistics_api_watch.c 21 * @file statistics/test_statistics_api_watch.c
22 * @brief testcase for statistics_api.c watch functions 22 * @brief testcase for statistics_api.c watch functions
23 * @author Christian Grothoff
23 */ 24 */
24#include "platform.h" 25#include "platform.h"
25#include "gnunet_common.h" 26#include "gnunet_common.h"
@@ -29,9 +30,6 @@
29#include "gnunet_scheduler_lib.h" 30#include "gnunet_scheduler_lib.h"
30#include "gnunet_statistics_service.h" 31#include "gnunet_statistics_service.h"
31 32
32#define VERBOSE GNUNET_NO
33
34#define START_SERVICE GNUNET_YES
35 33
36static int ok; 34static int ok;
37 35
@@ -112,8 +110,8 @@ run (void *cls, char *const *args, const char *cfgfile,
112} 110}
113 111
114 112
115static int 113int
116check () 114main (int argc, char *argv_ign[])
117{ 115{
118 char *const argv[] = { "test-statistics-api", 116 char *const argv[] = { "test-statistics-api",
119 "-c", 117 "-c",
@@ -123,22 +121,19 @@ check ()
123 struct GNUNET_GETOPT_CommandLineOption options[] = { 121 struct GNUNET_GETOPT_CommandLineOption options[] = {
124 GNUNET_GETOPT_OPTION_END 122 GNUNET_GETOPT_OPTION_END
125 }; 123 };
126#if START_SERVICE
127 struct GNUNET_OS_Process *proc; 124 struct GNUNET_OS_Process *proc;
128 125 char *binary;
126
127 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-statistics");
129 proc = 128 proc =
130 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-service-statistics", 129 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL,
131 "gnunet-service-statistics", 130 binary,
132#if VERBOSE 131 "gnunet-service-statistics",
133 "-L", "DEBUG", 132 "-c", "test_statistics_api_data.conf", NULL);
134#endif
135 "-c", "test_statistics_api_data.conf", NULL);
136#endif
137 GNUNET_assert (NULL != proc); 133 GNUNET_assert (NULL != proc);
138 ok = 3; 134 ok = 3;
139 GNUNET_PROGRAM_run (3, argv, "test-statistics-api", "nohelp", options, &run, 135 GNUNET_PROGRAM_run (3, argv, "test-statistics-api", "nohelp", options, &run,
140 NULL); 136 NULL);
141#if START_SERVICE
142 if (0 != GNUNET_OS_process_kill (proc, SIGTERM)) 137 if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
143 { 138 {
144 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); 139 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
@@ -147,18 +142,9 @@ check ()
147 GNUNET_OS_process_wait (proc); 142 GNUNET_OS_process_wait (proc);
148 GNUNET_OS_process_destroy (proc); 143 GNUNET_OS_process_destroy (proc);
149 proc = NULL; 144 proc = NULL;
150#endif 145 GNUNET_free (binary);
151 return ok; 146 return ok;
152} 147}
153 148
154int
155main (int argc, char *argv[])
156{
157 int ret;
158
159 ret = check ();
160
161 return ret;
162}
163 149
164/* end of test_statistics_api_watch.c */ 150/* end of test_statistics_api_watch.c */