aboutsummaryrefslogtreecommitdiff
path: root/src/statistics/test_statistics_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-08-15 21:54:06 +0000
committerChristian Grothoff <christian@grothoff.org>2011-08-15 21:54:06 +0000
commit5746309cb4be2073d550ad7a6885e918631dbc38 (patch)
tree89455bc4aadf977816b38df13f990372cd81d71a /src/statistics/test_statistics_api.c
parent6fd3e715cae09fa6e657c96f1c6f9711ee51f42f (diff)
downloadgnunet-5746309cb4be2073d550ad7a6885e918631dbc38.tar.gz
gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.zip
indentation
Diffstat (limited to 'src/statistics/test_statistics_api.c')
-rw-r--r--src/statistics/test_statistics_api.c60
1 files changed, 27 insertions, 33 deletions
diff --git a/src/statistics/test_statistics_api.c b/src/statistics/test_statistics_api.c
index de05d6c69..39a71a79e 100644
--- a/src/statistics/test_statistics_api.c
+++ b/src/statistics/test_statistics_api.c
@@ -34,12 +34,10 @@
34#define START_SERVICE GNUNET_YES 34#define START_SERVICE GNUNET_YES
35 35
36static int 36static int
37check_1 (void *cls, 37check_1 (void *cls, const char *subsystem, const char *name, uint64_t value,
38 const char *subsystem, 38 int is_persistent)
39 const char *name, uint64_t value, int is_persistent)
40{ 39{
41 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 40 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received value %llu for `%s:%s\n",
42 "Received value %llu for `%s:%s\n",
43 (unsigned long long) value, subsystem, name); 41 (unsigned long long) value, subsystem, name);
44 GNUNET_assert (0 == strcmp (name, "test-1")); 42 GNUNET_assert (0 == strcmp (name, "test-1"));
45 GNUNET_assert (0 == strcmp (subsystem, "test-statistics-api")); 43 GNUNET_assert (0 == strcmp (subsystem, "test-statistics-api"));
@@ -49,12 +47,10 @@ check_1 (void *cls,
49} 47}
50 48
51static int 49static int
52check_2 (void *cls, 50check_2 (void *cls, const char *subsystem, const char *name, uint64_t value,
53 const char *subsystem, 51 int is_persistent)
54 const char *name, uint64_t value, int is_persistent)
55{ 52{
56 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 53 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received value %llu for `%s:%s\n",
57 "Received value %llu for `%s:%s\n",
58 (unsigned long long) value, subsystem, name); 54 (unsigned long long) value, subsystem, name);
59 GNUNET_assert (0 == strcmp (name, "test-2")); 55 GNUNET_assert (0 == strcmp (name, "test-2"));
60 GNUNET_assert (0 == strcmp (subsystem, "test-statistics-api")); 56 GNUNET_assert (0 == strcmp (subsystem, "test-statistics-api"));
@@ -64,12 +60,10 @@ check_2 (void *cls,
64} 60}
65 61
66static int 62static int
67check_3 (void *cls, 63check_3 (void *cls, const char *subsystem, const char *name, uint64_t value,
68 const char *subsystem, 64 int is_persistent)
69 const char *name, uint64_t value, int is_persistent)
70{ 65{
71 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 66 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received value %llu for `%s:%s\n",
72 "Received value %llu for `%s:%s\n",
73 (unsigned long long) value, subsystem, name); 67 (unsigned long long) value, subsystem, name);
74 GNUNET_assert (0 == strcmp (name, "test-3")); 68 GNUNET_assert (0 == strcmp (name, "test-3"));
75 GNUNET_assert (0 == strcmp (subsystem, "test-statistics-api")); 69 GNUNET_assert (0 == strcmp (subsystem, "test-statistics-api"));
@@ -102,9 +96,8 @@ next (void *cls, int success)
102} 96}
103 97
104static void 98static void
105run (void *cls, 99run (void *cls, char *const *args, const char *cfgfile,
106 char *const *args, 100 const struct GNUNET_CONFIGURATION_Handle *cfg)
107 const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
108{ 101{
109 h = GNUNET_STATISTICS_create ("test-statistics-api", cfg); 102 h = GNUNET_STATISTICS_create ("test-statistics-api", cfg);
110 GNUNET_STATISTICS_set (h, "test-1", 1, GNUNET_NO); 103 GNUNET_STATISTICS_set (h, "test-1", 1, GNUNET_NO);
@@ -119,9 +112,8 @@ run (void *cls,
119} 112}
120 113
121static void 114static void
122run_more (void *cls, 115run_more (void *cls, char *const *args, const char *cfgfile,
123 char *const *args, 116 const struct GNUNET_CONFIGURATION_Handle *cfg)
124 const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
125{ 117{
126 h = GNUNET_STATISTICS_create ("test-statistics-api", cfg); 118 h = GNUNET_STATISTICS_create ("test-statistics-api", cfg);
127 GNUNET_break (NULL != 119 GNUNET_break (NULL !=
@@ -151,16 +143,17 @@ check ()
151#if START_SERVICE 143#if START_SERVICE
152 struct GNUNET_OS_Process *proc; 144 struct GNUNET_OS_Process *proc;
153 145
154 proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-statistics", 146 proc =
155 "gnunet-service-statistics", 147 GNUNET_OS_start_process (NULL, NULL, "gnunet-service-statistics",
148 "gnunet-service-statistics",
156#if DEBUG_STATISTICS 149#if DEBUG_STATISTICS
157 "-L", "DEBUG", 150 "-L", "DEBUG",
158#endif 151#endif
159 "-c", "test_statistics_api_data.conf", NULL); 152 "-c", "test_statistics_api_data.conf", NULL);
160#endif 153#endif
161 GNUNET_assert (NULL != proc); 154 GNUNET_assert (NULL != proc);
162 GNUNET_PROGRAM_run (5, argv, "test-statistics-api", "nohelp", 155 GNUNET_PROGRAM_run (5, argv, "test-statistics-api", "nohelp", options, &run,
163 options, &run, &ok); 156 &ok);
164#if START_SERVICE 157#if START_SERVICE
165 if (0 != GNUNET_OS_process_kill (proc, SIGTERM)) 158 if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
166 { 159 {
@@ -176,15 +169,16 @@ check ()
176 ok = 1; 169 ok = 1;
177#if START_SERVICE 170#if START_SERVICE
178 /* restart to check persistence! */ 171 /* restart to check persistence! */
179 proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-statistics", 172 proc =
180 "gnunet-service-statistics", 173 GNUNET_OS_start_process (NULL, NULL, "gnunet-service-statistics",
174 "gnunet-service-statistics",
181#if DEBUG_STATISTICS 175#if DEBUG_STATISTICS
182 "-L", "DEBUG", 176 "-L", "DEBUG",
183#endif 177#endif
184 "-c", "test_statistics_api_data.conf", NULL); 178 "-c", "test_statistics_api_data.conf", NULL);
185#endif 179#endif
186 GNUNET_PROGRAM_run (5, argv, "test-statistics-api", "nohelp", 180 GNUNET_PROGRAM_run (5, argv, "test-statistics-api", "nohelp", options,
187 options, &run_more, &ok); 181 &run_more, &ok);
188#if START_SERVICE 182#if START_SERVICE
189 if (0 != GNUNET_OS_process_kill (proc, SIGTERM)) 183 if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
190 { 184 {