aboutsummaryrefslogtreecommitdiff
path: root/src/statistics/test_statistics_api_watch.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_watch.c
parent6fd3e715cae09fa6e657c96f1c6f9711ee51f42f (diff)
downloadgnunet-5746309cb4be2073d550ad7a6885e918631dbc38.tar.gz
gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.zip
indentation
Diffstat (limited to 'src/statistics/test_statistics_api_watch.c')
-rw-r--r--src/statistics/test_statistics_api_watch.c39
1 files changed, 18 insertions, 21 deletions
diff --git a/src/statistics/test_statistics_api_watch.c b/src/statistics/test_statistics_api_watch.c
index 72cb27ecf..cea495836 100644
--- a/src/statistics/test_statistics_api_watch.c
+++ b/src/statistics/test_statistics_api_watch.c
@@ -63,9 +63,8 @@ normal_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
63 63
64 64
65static int 65static int
66watch_1 (void *cls, 66watch_1 (void *cls, const char *subsystem, const char *name, uint64_t value,
67 const char *subsystem, 67 int is_persistent)
68 const char *name, uint64_t value, int is_persistent)
69{ 68{
70 GNUNET_assert (value == 42); 69 GNUNET_assert (value == 42);
71 GNUNET_assert (0 == strcmp (name, "test-1")); 70 GNUNET_assert (0 == strcmp (name, "test-1"));
@@ -80,9 +79,8 @@ watch_1 (void *cls,
80 79
81 80
82static int 81static int
83watch_2 (void *cls, 82watch_2 (void *cls, const char *subsystem, const char *name, uint64_t value,
84 const char *subsystem, 83 int is_persistent)
85 const char *name, uint64_t value, int is_persistent)
86{ 84{
87 GNUNET_assert (value == 43); 85 GNUNET_assert (value == 43);
88 GNUNET_assert (0 == strcmp (name, "test-2")); 86 GNUNET_assert (0 == strcmp (name, "test-2"));
@@ -97,24 +95,22 @@ watch_2 (void *cls,
97 95
98 96
99static void 97static void
100run (void *cls, 98run (void *cls, char *const *args, const char *cfgfile,
101 char *const *args, 99 const struct GNUNET_CONFIGURATION_Handle *cfg)
102 const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
103{ 100{
104 h = GNUNET_STATISTICS_create ("dummy", cfg); 101 h = GNUNET_STATISTICS_create ("dummy", cfg);
105 GNUNET_assert (GNUNET_OK == 102 GNUNET_assert (GNUNET_OK ==
106 GNUNET_STATISTICS_watch (h, 103 GNUNET_STATISTICS_watch (h, "test-statistics-api-watch",
107 "test-statistics-api-watch",
108 "test-1", &watch_1, NULL)); 104 "test-1", &watch_1, NULL));
109 GNUNET_assert (GNUNET_OK == 105 GNUNET_assert (GNUNET_OK ==
110 GNUNET_STATISTICS_watch (h, 106 GNUNET_STATISTICS_watch (h, "test-statistics-api-watch",
111 "test-statistics-api-watch",
112 "test-2", &watch_2, NULL)); 107 "test-2", &watch_2, NULL));
113 h2 = GNUNET_STATISTICS_create ("test-statistics-api-watch", cfg); 108 h2 = GNUNET_STATISTICS_create ("test-statistics-api-watch", cfg);
114 GNUNET_STATISTICS_set (h2, "test-1", 42, GNUNET_NO); 109 GNUNET_STATISTICS_set (h2, "test-1", 42, GNUNET_NO);
115 GNUNET_STATISTICS_set (h2, "test-2", 43, GNUNET_NO); 110 GNUNET_STATISTICS_set (h2, "test-2", 43, GNUNET_NO);
116 shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, 111 shutdown_task =
117 &force_shutdown, NULL); 112 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, &force_shutdown,
113 NULL);
118} 114}
119 115
120 116
@@ -132,17 +128,18 @@ check ()
132#if START_SERVICE 128#if START_SERVICE
133 struct GNUNET_OS_Process *proc; 129 struct GNUNET_OS_Process *proc;
134 130
135 proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-statistics", 131 proc =
136 "gnunet-service-statistics", 132 GNUNET_OS_start_process (NULL, NULL, "gnunet-service-statistics",
133 "gnunet-service-statistics",
137#if VERBOSE 134#if VERBOSE
138 "-L", "DEBUG", 135 "-L", "DEBUG",
139#endif 136#endif
140 "-c", "test_statistics_api_data.conf", NULL); 137 "-c", "test_statistics_api_data.conf", NULL);
141#endif 138#endif
142 GNUNET_assert (NULL != proc); 139 GNUNET_assert (NULL != proc);
143 ok = 3; 140 ok = 3;
144 GNUNET_PROGRAM_run (3, argv, "test-statistics-api", "nohelp", 141 GNUNET_PROGRAM_run (3, argv, "test-statistics-api", "nohelp", options, &run,
145 options, &run, NULL); 142 NULL);
146#if START_SERVICE 143#if START_SERVICE
147 if (0 != GNUNET_OS_process_kill (proc, SIGTERM)) 144 if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
148 { 145 {