aboutsummaryrefslogtreecommitdiff
path: root/src/statistics/test_statistics_api_loop.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/statistics/test_statistics_api_loop.c')
-rw-r--r--src/statistics/test_statistics_api_loop.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/src/statistics/test_statistics_api_loop.c b/src/statistics/test_statistics_api_loop.c
index d969e65ce..87190a99a 100644
--- a/src/statistics/test_statistics_api_loop.c
+++ b/src/statistics/test_statistics_api_loop.c
@@ -61,24 +61,24 @@ next (void *cls, int success)
61static void 61static void
62run (void *cls, 62run (void *cls,
63 char *const *args, 63 char *const *args,
64 const char *cfgfile, 64 const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
65 const struct GNUNET_CONFIGURATION_Handle *cfg)
66{ 65{
67 int i; 66 int i;
68 char name[128]; 67 char name[128];
69 68
70 h = GNUNET_STATISTICS_create ("test-statistics-api-loop", cfg); 69 h = GNUNET_STATISTICS_create ("test-statistics-api-loop", cfg);
71 for (i=0;i<ROUNDS;i++) 70 for (i = 0; i < ROUNDS; i++)
72 { 71 {
73 GNUNET_snprintf (name, sizeof (name), "test-%d", i % 256); 72 GNUNET_snprintf (name, sizeof (name), "test-%d", i % 256);
74 GNUNET_STATISTICS_set (h, name, i, GNUNET_NO); 73 GNUNET_STATISTICS_set (h, name, i, GNUNET_NO);
75 GNUNET_snprintf (name, sizeof (name), "test-%d", i % 128); 74 GNUNET_snprintf (name, sizeof (name), "test-%d", i % 128);
76 GNUNET_STATISTICS_update (h, name, 1, GNUNET_NO); 75 GNUNET_STATISTICS_update (h, name, 1, GNUNET_NO);
77 } 76 }
78 i = 0; 77 i = 0;
79 GNUNET_break (NULL != 78 GNUNET_break (NULL !=
80 GNUNET_STATISTICS_get (h, NULL, "test-0", 79 GNUNET_STATISTICS_get (h, NULL, "test-0",
81 GNUNET_TIME_UNIT_MINUTES, &next, &check_1, cls)); 80 GNUNET_TIME_UNIT_MINUTES, &next,
81 &check_1, cls));
82} 82}
83 83
84 84
@@ -86,6 +86,7 @@ static int
86check () 86check ()
87{ 87{
88 int ok = 1; 88 int ok = 1;
89
89 char *const argv[] = { "test-statistics-api", 90 char *const argv[] = { "test-statistics-api",
90 "-c", 91 "-c",
91 "test_statistics_api_data.conf", 92 "test_statistics_api_data.conf",
@@ -96,22 +97,23 @@ check ()
96 }; 97 };
97#if START_SERVICE 98#if START_SERVICE
98 struct GNUNET_OS_Process *proc; 99 struct GNUNET_OS_Process *proc;
100
99 proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-statistics", 101 proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-statistics",
100 "gnunet-service-statistics", 102 "gnunet-service-statistics",
101#if DEBUG_STATISTICS 103#if DEBUG_STATISTICS
102 "-L", "DEBUG", 104 "-L", "DEBUG",
103#endif 105#endif
104 "-c", "test_statistics_api_data.conf", NULL); 106 "-c", "test_statistics_api_data.conf", NULL);
105#endif 107#endif
106 GNUNET_assert (NULL != proc); 108 GNUNET_assert (NULL != proc);
107 GNUNET_PROGRAM_run (3, argv, "test-statistics-api", "nohelp", 109 GNUNET_PROGRAM_run (3, argv, "test-statistics-api", "nohelp",
108 options, &run, &ok); 110 options, &run, &ok);
109#if START_SERVICE 111#if START_SERVICE
110 if (0 != GNUNET_OS_process_kill (proc, SIGTERM)) 112 if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
111 { 113 {
112 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); 114 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
113 ok = 1; 115 ok = 1;
114 } 116 }
115 GNUNET_OS_process_wait (proc); 117 GNUNET_OS_process_wait (proc);
116 GNUNET_OS_process_close (proc); 118 GNUNET_OS_process_close (proc);
117 proc = NULL; 119 proc = NULL;