diff options
author | Gabor X Toth <*@tg-x.net> | 2013-09-16 13:23:12 +0000 |
---|---|---|
committer | Gabor X Toth <*@tg-x.net> | 2013-09-16 13:23:12 +0000 |
commit | 2a95ef75f9df9267eda0a2a6625082288bc9715b (patch) | |
tree | 15d8a291eb35c95ec80e1fa5f4bcef147beef40d /src | |
parent | 92d8421cb317d5f588ccf66f9b07aa1bdf438685 (diff) | |
download | gnunet-2a95ef75f9df9267eda0a2a6625082288bc9715b.tar.gz gnunet-2a95ef75f9df9267eda0a2a6625082288bc9715b.zip |
psycstore: use GNUNET_assert()
Diffstat (limited to 'src')
-rw-r--r-- | src/namestore/test_namestore_api_store.c | 6 | ||||
-rw-r--r-- | src/psycstore/test_plugin_psycstore.c | 192 | ||||
-rw-r--r-- | src/psycstore/test_psycstore.c | 41 |
3 files changed, 116 insertions, 123 deletions
diff --git a/src/namestore/test_namestore_api_store.c b/src/namestore/test_namestore_api_store.c index 00a3a1a1c..b5d051aa5 100644 --- a/src/namestore/test_namestore_api_store.c +++ b/src/namestore/test_namestore_api_store.c | |||
@@ -94,8 +94,8 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
94 | 94 | ||
95 | static void | 95 | static void |
96 | rd_decrypt_cb (void *cls, | 96 | rd_decrypt_cb (void *cls, |
97 | unsigned int rd_count, | 97 | unsigned int rd_count, |
98 | const struct GNUNET_NAMESTORE_RecordData *rd) | 98 | const struct GNUNET_NAMESTORE_RecordData *rd) |
99 | { | 99 | { |
100 | char rd_cmp_data[TEST_RECORD_DATALEN]; | 100 | char rd_cmp_data[TEST_RECORD_DATALEN]; |
101 | 101 | ||
@@ -116,7 +116,7 @@ rd_decrypt_cb (void *cls, | |||
116 | 116 | ||
117 | static void | 117 | static void |
118 | name_lookup_proc (void *cls, | 118 | name_lookup_proc (void *cls, |
119 | const struct GNUNET_NAMESTORE_Block *block) | 119 | const struct GNUNET_NAMESTORE_Block *block) |
120 | { | 120 | { |
121 | const char *name = cls; | 121 | const char *name = cls; |
122 | nsqe = NULL; | 122 | nsqe = NULL; |
diff --git a/src/psycstore/test_plugin_psycstore.c b/src/psycstore/test_plugin_psycstore.c index a59b18939..77a4186bf 100644 --- a/src/psycstore/test_plugin_psycstore.c +++ b/src/psycstore/test_plugin_psycstore.c | |||
@@ -43,15 +43,6 @@ | |||
43 | #define LOG(kind,...) \ | 43 | #define LOG(kind,...) \ |
44 | GNUNET_log_from (kind, "test-plugin-psycstore", __VA_ARGS__) | 44 | GNUNET_log_from (kind, "test-plugin-psycstore", __VA_ARGS__) |
45 | 45 | ||
46 | #define ASSERT(x) \ | ||
47 | do { \ | ||
48 | if (! (x)) \ | ||
49 | { \ | ||
50 | LOG (GNUNET_ERROR_TYPE_ERROR, "Error at %s:%d\n", __FILE__, __LINE__); \ | ||
51 | goto FAILURE; \ | ||
52 | } \ | ||
53 | } while (0) | ||
54 | |||
55 | static int ok; | 46 | static int ok; |
56 | 47 | ||
57 | /** | 48 | /** |
@@ -186,28 +177,29 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
186 | channel_key = GNUNET_CRYPTO_ecc_key_create (); | 177 | channel_key = GNUNET_CRYPTO_ecc_key_create (); |
187 | slave_key = GNUNET_CRYPTO_ecc_key_create (); | 178 | slave_key = GNUNET_CRYPTO_ecc_key_create (); |
188 | 179 | ||
189 | GNUNET_CRYPTO_ecc_key_get_public_for_signature (channel_key, &channel_pub_key); | 180 | GNUNET_CRYPTO_ecc_key_get_public_for_signature (channel_key, |
181 | &channel_pub_key); | ||
190 | GNUNET_CRYPTO_ecc_key_get_public_for_signature (slave_key, &slave_pub_key); | 182 | GNUNET_CRYPTO_ecc_key_get_public_for_signature (slave_key, &slave_pub_key); |
191 | 183 | ||
192 | ASSERT (GNUNET_OK == db->membership_store (db->cls, &channel_pub_key, | 184 | GNUNET_assert (GNUNET_OK == db->membership_store (db->cls, &channel_pub_key, |
193 | &slave_pub_key, GNUNET_YES, | 185 | &slave_pub_key, GNUNET_YES, |
194 | 4, 2, 1)); | 186 | 4, 2, 1)); |
195 | 187 | ||
196 | ASSERT (GNUNET_YES == db->membership_test (db->cls, &channel_pub_key, | 188 | GNUNET_assert (GNUNET_YES == db->membership_test (db->cls, &channel_pub_key, |
197 | &slave_pub_key, 4)); | 189 | &slave_pub_key, 4)); |
198 | 190 | ||
199 | ASSERT (GNUNET_YES == db->membership_test (db->cls, &channel_pub_key, | 191 | GNUNET_assert (GNUNET_YES == db->membership_test (db->cls, &channel_pub_key, |
200 | &slave_pub_key, 2)); | 192 | &slave_pub_key, 2)); |
201 | 193 | ||
202 | ASSERT (GNUNET_NO == db->membership_test (db->cls, &channel_pub_key, | 194 | GNUNET_assert (GNUNET_NO == db->membership_test (db->cls, &channel_pub_key, |
203 | &slave_pub_key, 1)); | 195 | &slave_pub_key, 1)); |
204 | 196 | ||
205 | 197 | ||
206 | /* Store & get messages */ | 198 | /* Store & get messages */ |
207 | 199 | ||
208 | struct GNUNET_MULTICAST_MessageHeader *msg | 200 | struct GNUNET_MULTICAST_MessageHeader *msg |
209 | = GNUNET_malloc (sizeof (*msg) + sizeof (channel_pub_key)); | 201 | = GNUNET_malloc (sizeof (*msg) + sizeof (channel_pub_key)); |
210 | ASSERT (msg != NULL); | 202 | GNUNET_assert (msg != NULL); |
211 | 203 | ||
212 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_MULTICAST_MESSAGE); | 204 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_MULTICAST_MESSAGE); |
213 | msg->header.size = htons (sizeof (*msg) + sizeof (channel_pub_key)); | 205 | msg->header.size = htons (sizeof (*msg) + sizeof (channel_pub_key)); |
@@ -233,33 +225,35 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
233 | fcls.msg[0] = msg; | 225 | fcls.msg[0] = msg; |
234 | fcls.flags[0] = GNUNET_PSYCSTORE_MESSAGE_STATE; | 226 | fcls.flags[0] = GNUNET_PSYCSTORE_MESSAGE_STATE; |
235 | 227 | ||
236 | ASSERT (GNUNET_OK == db->fragment_store (db->cls, &channel_pub_key, msg, | 228 | GNUNET_assert (GNUNET_OK == db->fragment_store (db->cls, &channel_pub_key, msg, |
237 | fcls.flags[0])); | 229 | fcls.flags[0])); |
238 | 230 | ||
239 | ASSERT (GNUNET_OK == db->fragment_get (db->cls, &channel_pub_key, | 231 | GNUNET_assert (GNUNET_OK == db->fragment_get (db->cls, &channel_pub_key, |
240 | GNUNET_ntohll (msg->fragment_id), | 232 | GNUNET_ntohll (msg->fragment_id), |
241 | fragment_cb, &fcls)); | 233 | fragment_cb, &fcls)); |
242 | ASSERT (fcls.n == 1); | 234 | GNUNET_assert (fcls.n == 1); |
243 | 235 | ||
244 | fcls.n = 0; | 236 | fcls.n = 0; |
245 | 237 | ||
246 | ASSERT (GNUNET_OK == db->message_get_fragment (db->cls, &channel_pub_key, | 238 | GNUNET_assert ( |
247 | GNUNET_ntohll (msg->message_id), | 239 | GNUNET_OK == db->message_get_fragment (db->cls, &channel_pub_key, |
248 | GNUNET_ntohll (msg->fragment_offset), | 240 | GNUNET_ntohll (msg->message_id), |
249 | fragment_cb, &fcls)); | 241 | GNUNET_ntohll (msg->fragment_offset), |
250 | ASSERT (fcls.n == 1); | 242 | fragment_cb, &fcls)); |
243 | GNUNET_assert (fcls.n == 1); | ||
251 | 244 | ||
252 | ASSERT (GNUNET_OK == db->message_add_flags ( | 245 | GNUNET_assert ( |
253 | db->cls, &channel_pub_key, GNUNET_ntohll (msg->message_id), | 246 | GNUNET_OK == db->message_add_flags (db->cls, &channel_pub_key, |
254 | GNUNET_PSYCSTORE_MESSAGE_STATE_APPLIED)); | 247 | GNUNET_ntohll (msg->message_id), |
248 | GNUNET_PSYCSTORE_MESSAGE_STATE_APPLIED)); | ||
255 | 249 | ||
256 | fcls.n = 0; | 250 | fcls.n = 0; |
257 | fcls.flags[0] |= GNUNET_PSYCSTORE_MESSAGE_STATE_APPLIED; | 251 | fcls.flags[0] |= GNUNET_PSYCSTORE_MESSAGE_STATE_APPLIED; |
258 | 252 | ||
259 | ASSERT (GNUNET_OK == db->fragment_get (db->cls, &channel_pub_key, | 253 | GNUNET_assert (GNUNET_OK == db->fragment_get (db->cls, &channel_pub_key, |
260 | GNUNET_ntohll (msg->fragment_id), | 254 | GNUNET_ntohll (msg->fragment_id), |
261 | fragment_cb, &fcls)); | 255 | fragment_cb, &fcls)); |
262 | ASSERT (fcls.n == 1); | 256 | GNUNET_assert (fcls.n == 1); |
263 | 257 | ||
264 | struct GNUNET_MULTICAST_MessageHeader *msg1 | 258 | struct GNUNET_MULTICAST_MessageHeader *msg1 |
265 | = GNUNET_malloc (sizeof (*msg1) + sizeof (channel_pub_key)); | 259 | = GNUNET_malloc (sizeof (*msg1) + sizeof (channel_pub_key)); |
@@ -273,75 +267,77 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
273 | fcls.msg[1] = msg1; | 267 | fcls.msg[1] = msg1; |
274 | fcls.flags[1] = GNUNET_PSYCSTORE_MESSAGE_STATE_HASH; | 268 | fcls.flags[1] = GNUNET_PSYCSTORE_MESSAGE_STATE_HASH; |
275 | 269 | ||
276 | ASSERT (GNUNET_OK == db->fragment_store (db->cls, &channel_pub_key, msg1, | 270 | GNUNET_assert (GNUNET_OK == db->fragment_store (db->cls, &channel_pub_key, msg1, |
277 | fcls.flags[1])); | 271 | fcls.flags[1])); |
278 | 272 | ||
279 | uint64_t retfrags = 0; | 273 | uint64_t retfrags = 0; |
280 | ASSERT (GNUNET_OK == db->message_get (db->cls, &channel_pub_key, | 274 | GNUNET_assert (GNUNET_OK == db->message_get (db->cls, &channel_pub_key, |
281 | GNUNET_ntohll (msg->message_id), | 275 | GNUNET_ntohll (msg->message_id), |
282 | &retfrags, fragment_cb, &fcls)); | 276 | &retfrags, fragment_cb, &fcls)); |
283 | ASSERT (fcls.n == 2 && retfrags == 2); | 277 | GNUNET_assert (fcls.n == 2 && retfrags == 2); |
284 | 278 | ||
285 | /* Master counters */ | 279 | /* Master counters */ |
286 | 280 | ||
287 | uint64_t fragment_id = 0, message_id = 0, group_generation = 0; | 281 | uint64_t fragment_id = 0, message_id = 0, group_generation = 0; |
288 | ASSERT (GNUNET_OK == db->counters_get_master (db->cls, &channel_pub_key, | 282 | GNUNET_assert ( |
289 | &fragment_id, &message_id, | 283 | GNUNET_OK == db->counters_get_master (db->cls, &channel_pub_key, |
290 | &group_generation) | 284 | &fragment_id, &message_id, |
291 | && fragment_id == GNUNET_ntohll (msg1->fragment_id) | 285 | &group_generation) |
292 | && message_id == GNUNET_ntohll (msg1->message_id) | 286 | && fragment_id == GNUNET_ntohll (msg1->fragment_id) |
293 | && group_generation == GNUNET_ntohll (msg1->group_generation)); | 287 | && message_id == GNUNET_ntohll (msg1->message_id) |
294 | 288 | && group_generation == GNUNET_ntohll (msg1->group_generation)); | |
295 | 289 | ||
296 | /* Modify state */ | 290 | /* Modify state */ |
297 | 291 | ||
298 | message_id = GNUNET_ntohll (fcls.msg[0]->message_id) + 1; | 292 | message_id = GNUNET_ntohll (fcls.msg[0]->message_id) + 1; |
299 | ASSERT (GNUNET_OK == db->state_modify_begin (db->cls, &channel_pub_key, | 293 | GNUNET_assert (GNUNET_OK == db->state_modify_begin (db->cls, &channel_pub_key, |
300 | message_id, 1)); | 294 | message_id, 1)); |
301 | 295 | ||
302 | ASSERT (GNUNET_OK == db->state_modify_set (db->cls, &channel_pub_key, "_foo", | 296 | GNUNET_assert (GNUNET_OK == db->state_modify_set (db->cls, &channel_pub_key, |
303 | C2ARG("one two three"))); | 297 | "_foo", |
298 | C2ARG("one two three"))); | ||
304 | 299 | ||
305 | ASSERT (GNUNET_OK == db->state_modify_set (db->cls, &channel_pub_key, | 300 | GNUNET_assert (GNUNET_OK == db->state_modify_set (db->cls, &channel_pub_key, |
306 | "_foo_bar", slave_key, | 301 | "_foo_bar", slave_key, |
307 | sizeof (*slave_key))); | 302 | sizeof (*slave_key))); |
308 | 303 | ||
309 | ASSERT (GNUNET_OK == db->state_modify_end (db->cls, &channel_pub_key, | 304 | GNUNET_assert (GNUNET_OK == db->state_modify_end (db->cls, &channel_pub_key, |
310 | message_id)); | 305 | message_id)); |
311 | 306 | ||
312 | struct StateClosure scls = { 0 }; | 307 | struct StateClosure scls = { 0 }; |
313 | scls.n = 0; | 308 | scls.n = 0; |
314 | scls.value[0] = "one two three"; | 309 | scls.value[0] = "one two three"; |
315 | scls.value_size[0] = strlen ("one two three"); | 310 | scls.value_size[0] = strlen ("one two three"); |
316 | 311 | ||
317 | ASSERT (GNUNET_OK == db->state_get (db->cls, &channel_pub_key, "_foo", | 312 | GNUNET_assert (GNUNET_OK == db->state_get (db->cls, &channel_pub_key, "_foo", |
318 | state_cb, &scls)); | 313 | state_cb, &scls)); |
319 | ASSERT (scls.n == 1); | 314 | GNUNET_assert (scls.n == 1); |
320 | 315 | ||
321 | scls.n = 0; | 316 | scls.n = 0; |
322 | scls.value[1] = slave_key; | 317 | scls.value[1] = slave_key; |
323 | scls.value_size[1] = sizeof (*slave_key); | 318 | scls.value_size[1] = sizeof (*slave_key); |
324 | 319 | ||
325 | ASSERT (GNUNET_OK == db->state_get_prefix (db->cls, &channel_pub_key, "_foo", | 320 | GNUNET_assert (GNUNET_OK == db->state_get_prefix (db->cls, &channel_pub_key, |
326 | state_cb, &scls)); | 321 | "_foo", state_cb, &scls)); |
327 | ASSERT (scls.n == 2); | 322 | GNUNET_assert (scls.n == 2); |
328 | 323 | ||
329 | scls.n = 0; | 324 | scls.n = 0; |
330 | ASSERT (GNUNET_NO == db->state_get_signed (db->cls, &channel_pub_key, | 325 | GNUNET_assert (GNUNET_NO == db->state_get_signed (db->cls, &channel_pub_key, |
331 | state_cb, &scls)); | 326 | state_cb, &scls)); |
332 | ASSERT (scls.n == 0); | 327 | GNUNET_assert (scls.n == 0); |
333 | 328 | ||
334 | ASSERT (GNUNET_OK == db->state_update_signed (db->cls, &channel_pub_key)); | 329 | GNUNET_assert (GNUNET_OK == db->state_update_signed (db->cls, |
330 | &channel_pub_key)); | ||
335 | 331 | ||
336 | scls.n = 0; | 332 | scls.n = 0; |
337 | ASSERT (GNUNET_YES == db->state_get_signed (db->cls, &channel_pub_key, | 333 | GNUNET_assert (GNUNET_YES == db->state_get_signed (db->cls, &channel_pub_key, |
338 | state_cb, &scls)); | 334 | state_cb, &scls)); |
339 | ASSERT (scls.n == 2); | 335 | GNUNET_assert (scls.n == 2); |
340 | 336 | ||
341 | /* Slave counters */ | 337 | /* Slave counters */ |
342 | 338 | ||
343 | uint64_t max_state_msg_id = 0; | 339 | uint64_t max_state_msg_id = 0; |
344 | ASSERT (GNUNET_OK == db->counters_get_slave (db->cls, &channel_pub_key, | 340 | GNUNET_assert (GNUNET_OK == db->counters_get_slave (db->cls, &channel_pub_key, |
345 | &max_state_msg_id) | 341 | &max_state_msg_id) |
346 | && max_state_msg_id == message_id); | 342 | && max_state_msg_id == message_id); |
347 | 343 | ||
@@ -353,53 +349,53 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
353 | scls.value[1] = "three two one"; | 349 | scls.value[1] = "three two one"; |
354 | scls.value_size[1] = strlen ("three two one"); | 350 | scls.value_size[1] = strlen ("three two one"); |
355 | 351 | ||
356 | ASSERT (GNUNET_OK == db->state_sync_begin (db->cls, &channel_pub_key)); | 352 | GNUNET_assert (GNUNET_OK == db->state_sync_begin (db->cls, &channel_pub_key)); |
357 | 353 | ||
358 | ASSERT (GNUNET_OK == db->state_sync_set (db->cls, &channel_pub_key, | 354 | GNUNET_assert (GNUNET_OK == db->state_sync_set (db->cls, &channel_pub_key, |
359 | "_sync_bar", | 355 | "_sync_bar", scls.value[0], |
360 | scls.value[0], scls.value_size[0])); | 356 | scls.value_size[0])); |
361 | 357 | ||
362 | ASSERT (GNUNET_OK == db->state_sync_set (db->cls, &channel_pub_key, | 358 | GNUNET_assert (GNUNET_OK == db->state_sync_set (db->cls, &channel_pub_key, |
363 | "_sync_foo", | 359 | "_sync_foo", scls.value[1], |
364 | scls.value[1], scls.value_size[1])); | 360 | scls.value_size[1])); |
365 | 361 | ||
366 | ASSERT (GNUNET_OK == db->state_sync_end (db->cls, &channel_pub_key, INT64_MAX - 5)); | 362 | GNUNET_assert (GNUNET_OK == db->state_sync_end (db->cls, &channel_pub_key, |
363 | INT64_MAX - 5)); | ||
367 | 364 | ||
368 | ASSERT (GNUNET_NO == db->state_get_prefix (db->cls, &channel_pub_key, "_foo", | 365 | GNUNET_assert (GNUNET_NO == db->state_get_prefix (db->cls, &channel_pub_key, |
369 | state_cb, &scls)); | 366 | "_foo", state_cb, &scls)); |
370 | ASSERT (scls.n == 0); | 367 | GNUNET_assert (scls.n == 0); |
371 | 368 | ||
372 | ASSERT (GNUNET_OK == db->state_get_prefix (db->cls, &channel_pub_key, "_sync", | 369 | GNUNET_assert (GNUNET_OK == db->state_get_prefix (db->cls, &channel_pub_key, |
373 | state_cb, &scls)); | 370 | "_sync", state_cb, &scls)); |
374 | ASSERT (scls.n == 2); | 371 | GNUNET_assert (scls.n == 2); |
375 | 372 | ||
376 | scls.n = 0; | 373 | scls.n = 0; |
377 | ASSERT (GNUNET_OK == db->state_get_signed (db->cls, &channel_pub_key, | 374 | GNUNET_assert (GNUNET_OK == db->state_get_signed (db->cls, &channel_pub_key, |
378 | state_cb, &scls)); | 375 | state_cb, &scls)); |
379 | ASSERT (scls.n == 2); | 376 | GNUNET_assert (scls.n == 2); |
380 | 377 | ||
381 | /* Modify state after sync */ | 378 | /* Modify state after sync */ |
382 | 379 | ||
383 | message_id = GNUNET_ntohll (fcls.msg[0]->message_id) + 6; | 380 | message_id = GNUNET_ntohll (fcls.msg[0]->message_id) + 6; |
384 | ASSERT (GNUNET_OK == db->state_modify_begin (db->cls, &channel_pub_key, | 381 | GNUNET_assert (GNUNET_OK == db->state_modify_begin (db->cls, &channel_pub_key, |
385 | message_id, 3)); | 382 | message_id, 3)); |
386 | 383 | ||
387 | ASSERT (GNUNET_OK == db->state_modify_set (db->cls, &channel_pub_key, "_sync_foo", | 384 | GNUNET_assert (GNUNET_OK == db->state_modify_set (db->cls, &channel_pub_key, |
388 | C2ARG("five six seven"))); | 385 | "_sync_foo", |
386 | C2ARG("five six seven"))); | ||
389 | 387 | ||
390 | ASSERT (GNUNET_OK == db->state_modify_end (db->cls, &channel_pub_key, | 388 | GNUNET_assert (GNUNET_OK == db->state_modify_end (db->cls, &channel_pub_key, |
391 | message_id)); | 389 | message_id)); |
392 | 390 | ||
393 | /* Reset state */ | 391 | /* Reset state */ |
394 | 392 | ||
395 | scls.n = 0; | 393 | scls.n = 0; |
396 | ASSERT (GNUNET_OK == db->state_reset (db->cls, &channel_pub_key)); | 394 | GNUNET_assert (GNUNET_OK == db->state_reset (db->cls, &channel_pub_key)); |
397 | ASSERT (scls.n == 0); | 395 | GNUNET_assert (scls.n == 0); |
398 | 396 | ||
399 | ok = 0; | 397 | ok = 0; |
400 | 398 | ||
401 | FAILURE: | ||
402 | |||
403 | if (NULL != channel_key) | 399 | if (NULL != channel_key) |
404 | { | 400 | { |
405 | GNUNET_free (channel_key); | 401 | GNUNET_free (channel_key); |
diff --git a/src/psycstore/test_psycstore.c b/src/psycstore/test_psycstore.c index 5f927a6d5..15eb2de30 100644 --- a/src/psycstore/test_psycstore.c +++ b/src/psycstore/test_psycstore.c | |||
@@ -31,9 +31,6 @@ | |||
31 | #include "gnunet_psycstore_service.h" | 31 | #include "gnunet_psycstore_service.h" |
32 | #include "gnunet_testing_lib.h" | 32 | #include "gnunet_testing_lib.h" |
33 | 33 | ||
34 | #define ASSERT(x) do { if (! (x)) { printf ("Error at %s:%d\n", __FILE__, __LINE__); cleanup (); return; } } while (0) | ||
35 | #define ASSERRT(x) do { if (! (x)) { printf ("Error at %s:%d\n", __FILE__, __LINE__); cleanup (); return GNUNET_SYSERR; } } while (0) | ||
36 | |||
37 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) | 34 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) |
38 | 35 | ||
39 | #define DEBUG_SERVICE 0 | 36 | #define DEBUG_SERVICE 0 |
@@ -161,7 +158,7 @@ state_reset_result (void *cls, int64_t result, const char *err_msg) | |||
161 | { | 158 | { |
162 | op = NULL; | 159 | op = NULL; |
163 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "state_reset_result:\t%d\n", result); | 160 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "state_reset_result:\t%d\n", result); |
164 | ASSERT (GNUNET_OK == result); | 161 | GNUNET_assert (GNUNET_OK == result); |
165 | 162 | ||
166 | op = GNUNET_PSYCSTORE_state_reset (h, &channel_pub_key, | 163 | op = GNUNET_PSYCSTORE_state_reset (h, &channel_pub_key, |
167 | &state_reset_result, cls); | 164 | &state_reset_result, cls); |
@@ -191,7 +188,7 @@ state_result (void *cls, const char *name, const void *value, size_t value_size) | |||
191 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 188 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
192 | " variable %s differs\nReceived: %.*s\nExpected: %.*s\n", | 189 | " variable %s differs\nReceived: %.*s\nExpected: %.*s\n", |
193 | name, value_size, value, val_size, val); | 190 | name, value_size, value, val_size, val); |
194 | ASSERRT (0); | 191 | GNUNET_assert (0); |
195 | return GNUNET_SYSERR; | 192 | return GNUNET_SYSERR; |
196 | } | 193 | } |
197 | } | 194 | } |
@@ -203,7 +200,7 @@ state_get_prefix_result (void *cls, int64_t result, const char *err_msg) | |||
203 | struct StateClosure *scls = cls; | 200 | struct StateClosure *scls = cls; |
204 | op = NULL; | 201 | op = NULL; |
205 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "state_get_prefix_result:\t%d\n", result); | 202 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "state_get_prefix_result:\t%d\n", result); |
206 | ASSERT (GNUNET_OK == result && 2 == scls->n); | 203 | GNUNET_assert (GNUNET_OK == result && 2 == scls->n); |
207 | 204 | ||
208 | op = GNUNET_PSYCSTORE_state_reset (h, &channel_pub_key, | 205 | op = GNUNET_PSYCSTORE_state_reset (h, &channel_pub_key, |
209 | &state_reset_result, cls); | 206 | &state_reset_result, cls); |
@@ -215,7 +212,7 @@ state_get_result (void *cls, int64_t result, const char *err_msg) | |||
215 | { | 212 | { |
216 | op = NULL; | 213 | op = NULL; |
217 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "state_get_result:\t%d\n", result); | 214 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "state_get_result:\t%d\n", result); |
218 | ASSERT (GNUNET_OK == result); | 215 | GNUNET_assert (GNUNET_OK == result); |
219 | 216 | ||
220 | scls.n = 0; | 217 | scls.n = 0; |
221 | 218 | ||
@@ -244,7 +241,7 @@ counters_slave_result (void *cls, uint64_t max_state_msg_id) | |||
244 | result = 1; | 241 | result = 1; |
245 | 242 | ||
246 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "counters_get_slave:\t%d\n", result); | 243 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "counters_get_slave:\t%d\n", result); |
247 | ASSERT (result == 1); | 244 | GNUNET_assert (result == 1); |
248 | 245 | ||
249 | scls.n = 0; | 246 | scls.n = 0; |
250 | scls.name[0] = "_bar"; | 247 | scls.name[0] = "_bar"; |
@@ -261,7 +258,7 @@ state_modify_result (void *cls, int64_t result, const char *err_msg) | |||
261 | { | 258 | { |
262 | op = NULL; | 259 | op = NULL; |
263 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "state_modify_result:\t%d\n", result); | 260 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "state_modify_result:\t%d\n", result); |
264 | ASSERT (GNUNET_OK == result); | 261 | GNUNET_assert (GNUNET_OK == result); |
265 | 262 | ||
266 | op = GNUNET_PSYCSTORE_counters_get_slave (h, &channel_pub_key, | 263 | op = GNUNET_PSYCSTORE_counters_get_slave (h, &channel_pub_key, |
267 | &counters_slave_result, cls); | 264 | &counters_slave_result, cls); |
@@ -274,7 +271,7 @@ state_sync_result (void *cls, int64_t result, const char *err_msg) | |||
274 | struct FragmentClosure *fcls = cls; | 271 | struct FragmentClosure *fcls = cls; |
275 | op = NULL; | 272 | op = NULL; |
276 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "state_sync_result:\t%d\n", result); | 273 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "state_sync_result:\t%d\n", result); |
277 | ASSERT (GNUNET_OK == result); | 274 | GNUNET_assert (GNUNET_OK == result); |
278 | 275 | ||
279 | modifiers[0] = (struct GNUNET_ENV_Modifier) { | 276 | modifiers[0] = (struct GNUNET_ENV_Modifier) { |
280 | .oper = '=', | 277 | .oper = '=', |
@@ -309,7 +306,7 @@ counters_master_result (void *cls, uint64_t fragment_id, uint64_t message_id, | |||
309 | result = 1; | 306 | result = 1; |
310 | 307 | ||
311 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "counters_get_master:\t%d\n", result); | 308 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "counters_get_master:\t%d\n", result); |
312 | ASSERT (result == 1); | 309 | GNUNET_assert (result == 1); |
313 | 310 | ||
314 | modifiers[0] = (struct GNUNET_ENV_Modifier) { | 311 | modifiers[0] = (struct GNUNET_ENV_Modifier) { |
315 | .oper = '=', | 312 | .oper = '=', |
@@ -350,7 +347,7 @@ fragment_result (void *cls, | |||
350 | { | 347 | { |
351 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, " fragment %llu differs\n", | 348 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, " fragment %llu differs\n", |
352 | GNUNET_ntohll (msg->fragment_id)); | 349 | GNUNET_ntohll (msg->fragment_id)); |
353 | ASSERRT (0); | 350 | GNUNET_assert (0); |
354 | return GNUNET_SYSERR; | 351 | return GNUNET_SYSERR; |
355 | } | 352 | } |
356 | } | 353 | } |
@@ -362,7 +359,7 @@ message_get_result (void *cls, int64_t result, const char *err_msg) | |||
362 | struct FragmentClosure *fcls = cls; | 359 | struct FragmentClosure *fcls = cls; |
363 | op = NULL; | 360 | op = NULL; |
364 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "message_get:\t%d\n", result); | 361 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "message_get:\t%d\n", result); |
365 | ASSERT (result > 0 && fcls->n && fcls->n_expected); | 362 | GNUNET_assert (result > 0 && fcls->n && fcls->n_expected); |
366 | 363 | ||
367 | op = GNUNET_PSYCSTORE_counters_get_master (h, &channel_pub_key, | 364 | op = GNUNET_PSYCSTORE_counters_get_master (h, &channel_pub_key, |
368 | &counters_master_result, fcls); | 365 | &counters_master_result, fcls); |
@@ -375,7 +372,7 @@ message_get_fragment_result (void *cls, int64_t result, const char *err_msg) | |||
375 | struct FragmentClosure *fcls = cls; | 372 | struct FragmentClosure *fcls = cls; |
376 | op = NULL; | 373 | op = NULL; |
377 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "message_get_fragment:\t%d\n", result); | 374 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "message_get_fragment:\t%d\n", result); |
378 | ASSERT (result > 0 && fcls->n && fcls->n_expected); | 375 | GNUNET_assert (result > 0 && fcls->n && fcls->n_expected); |
379 | 376 | ||
380 | fcls->n = 0; | 377 | fcls->n = 0; |
381 | fcls->n_expected = 3; | 378 | fcls->n_expected = 3; |
@@ -392,7 +389,7 @@ fragment_get_result (void *cls, int64_t result, const char *err_msg) | |||
392 | struct FragmentClosure *fcls = cls; | 389 | struct FragmentClosure *fcls = cls; |
393 | op = NULL; | 390 | op = NULL; |
394 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "fragment_get:\t%d\n", result); | 391 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "fragment_get:\t%d\n", result); |
395 | ASSERT (result > 0 && fcls->n && fcls->n_expected); | 392 | GNUNET_assert (result > 0 && fcls->n && fcls->n_expected); |
396 | 393 | ||
397 | fcls->n = 1; | 394 | fcls->n = 1; |
398 | fcls->n_expected = 2; | 395 | fcls->n_expected = 2; |
@@ -411,7 +408,7 @@ fragment_store_result (void *cls, int64_t result, const char *err_msg) | |||
411 | { | 408 | { |
412 | op = NULL; | 409 | op = NULL; |
413 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "fragment_store:\t%d\n", result); | 410 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "fragment_store:\t%d\n", result); |
414 | ASSERT (GNUNET_OK == result); | 411 | GNUNET_assert (GNUNET_OK == result); |
415 | 412 | ||
416 | if ((intptr_t) cls == GNUNET_YES) | 413 | if ((intptr_t) cls == GNUNET_YES) |
417 | { | 414 | { |
@@ -430,12 +427,12 @@ membership_test_result (void *cls, int64_t result, const char *err_msg) | |||
430 | { | 427 | { |
431 | op = NULL; | 428 | op = NULL; |
432 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "membership_test:\t%d\n", result); | 429 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "membership_test:\t%d\n", result); |
433 | ASSERT (GNUNET_OK == result); | 430 | GNUNET_assert (GNUNET_OK == result); |
434 | 431 | ||
435 | struct GNUNET_MULTICAST_MessageHeader *msg; | 432 | struct GNUNET_MULTICAST_MessageHeader *msg; |
436 | fcls.flags[0] = GNUNET_PSYCSTORE_MESSAGE_STATE; | 433 | fcls.flags[0] = GNUNET_PSYCSTORE_MESSAGE_STATE; |
437 | fcls.msg[0] = msg = GNUNET_malloc (sizeof (*msg) + sizeof (channel_pub_key)); | 434 | fcls.msg[0] = msg = GNUNET_malloc (sizeof (*msg) + sizeof (channel_pub_key)); |
438 | ASSERT (msg != NULL); | 435 | GNUNET_assert (msg != NULL); |
439 | 436 | ||
440 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_MULTICAST_MESSAGE); | 437 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_MULTICAST_MESSAGE); |
441 | msg->header.size = htons (sizeof (*msg) + sizeof (channel_pub_key)); | 438 | msg->header.size = htons (sizeof (*msg) + sizeof (channel_pub_key)); |
@@ -454,8 +451,8 @@ membership_test_result (void *cls, int64_t result, const char *err_msg) | |||
454 | - sizeof (msg->hop_counter) | 451 | - sizeof (msg->hop_counter) |
455 | - sizeof (msg->signature)); | 452 | - sizeof (msg->signature)); |
456 | msg->purpose.purpose = htonl (234); | 453 | msg->purpose.purpose = htonl (234); |
457 | ASSERT (GNUNET_OK == GNUNET_CRYPTO_ecc_sign (slave_key, &msg->purpose, | 454 | GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_ecc_sign (slave_key, &msg->purpose, |
458 | &msg->signature)); | 455 | &msg->signature)); |
459 | 456 | ||
460 | op = GNUNET_PSYCSTORE_fragment_store (h, &channel_pub_key, msg, fcls.flags[0], | 457 | op = GNUNET_PSYCSTORE_fragment_store (h, &channel_pub_key, msg, fcls.flags[0], |
461 | &fragment_store_result, GNUNET_NO); | 458 | &fragment_store_result, GNUNET_NO); |
@@ -484,7 +481,7 @@ membership_store_result (void *cls, int64_t result, const char *err_msg) | |||
484 | { | 481 | { |
485 | op = NULL; | 482 | op = NULL; |
486 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "membership_store:\t%d\n", result); | 483 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "membership_store:\t%d\n", result); |
487 | ASSERT (GNUNET_OK == result); | 484 | GNUNET_assert (GNUNET_OK == result); |
488 | 485 | ||
489 | op = GNUNET_PSYCSTORE_membership_test (h, &channel_pub_key, &slave_pub_key, | 486 | op = GNUNET_PSYCSTORE_membership_test (h, &channel_pub_key, &slave_pub_key, |
490 | 4, 1, | 487 | 4, 1, |
@@ -511,7 +508,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
511 | end_badly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, | 508 | end_badly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
512 | &end_badly, NULL); | 509 | &end_badly, NULL); |
513 | h = GNUNET_PSYCSTORE_connect (cfg); | 510 | h = GNUNET_PSYCSTORE_connect (cfg); |
514 | ASSERT (NULL != h); | 511 | GNUNET_assert (NULL != h); |
515 | 512 | ||
516 | channel_key = GNUNET_CRYPTO_ecc_key_create (); | 513 | channel_key = GNUNET_CRYPTO_ecc_key_create (); |
517 | slave_key = GNUNET_CRYPTO_ecc_key_create (); | 514 | slave_key = GNUNET_CRYPTO_ecc_key_create (); |