diff options
-rw-r--r-- | src/include/gnunet_common.h | 7 | ||||
-rw-r--r-- | src/util/common_logging.c | 6 | ||||
-rw-r--r-- | src/util/test_disk.c | 6 | ||||
-rw-r--r-- | src/util/test_getopt.c | 2 | ||||
-rw-r--r-- | src/util/test_plugin.c | 4 | ||||
-rw-r--r-- | src/util/test_time.c | 12 |
6 files changed, 22 insertions, 15 deletions
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index aacf6328a..614fd3824 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h | |||
@@ -171,10 +171,11 @@ GNUNET_log_from (enum GNUNET_ErrorType kind, | |||
171 | /** | 171 | /** |
172 | * Ignore the next n calls to the log function. | 172 | * Ignore the next n calls to the log function. |
173 | * | 173 | * |
174 | * @param n number of log calls to ignore, use 0 to | 174 | * @param n number of log calls to ignore |
175 | * assert that the log skip counter is currently zero. | 175 | * @param check_reset GNUNET_YES to assert that the log skip counter is currently zero |
176 | */ | 176 | */ |
177 | void GNUNET_log_skip (unsigned int n); | 177 | void |
178 | GNUNET_log_skip (unsigned int n, int check_reset); | ||
178 | 179 | ||
179 | 180 | ||
180 | /** | 181 | /** |
diff --git a/src/util/common_logging.c b/src/util/common_logging.c index 0ed40b839..263aa7bac 100644 --- a/src/util/common_logging.c +++ b/src/util/common_logging.c | |||
@@ -273,12 +273,16 @@ flush_bulk (const char *datestr) | |||
273 | * Ignore the next n calls to the log function. | 273 | * Ignore the next n calls to the log function. |
274 | * | 274 | * |
275 | * @param n number of log calls to ignore | 275 | * @param n number of log calls to ignore |
276 | * @param check_reset GNUNET_YES to assert that the log skip counter is currently zero | ||
276 | */ | 277 | */ |
277 | void | 278 | void |
278 | GNUNET_log_skip (unsigned int n) | 279 | GNUNET_log_skip (unsigned int n, int check_reset) |
279 | { | 280 | { |
280 | if (n == 0) | 281 | if (n == 0) |
281 | skip_log = 0; | 282 | skip_log = 0; |
283 | if (check_reset) | ||
284 | GNUNET_assert (ok); | ||
285 | } | ||
282 | else | 286 | else |
283 | skip_log += n; | 287 | skip_log += n; |
284 | } | 288 | } |
diff --git a/src/util/test_disk.c b/src/util/test_disk.c index f2bdb19d7..f978287ae 100644 --- a/src/util/test_disk.c +++ b/src/util/test_disk.c | |||
@@ -102,9 +102,9 @@ testOpenClose () | |||
102 | GNUNET_break (0 == UNLINK (".testfile")); | 102 | GNUNET_break (0 == UNLINK (".testfile")); |
103 | 103 | ||
104 | /* test that avail goes down as we fill the disk... */ | 104 | /* test that avail goes down as we fill the disk... */ |
105 | GNUNET_log_skip (1); | 105 | GNUNET_log_skip (1, GNUNET_NO); |
106 | avail = GNUNET_DISK_get_blocks_available (".testfile"); | 106 | avail = GNUNET_DISK_get_blocks_available (".testfile"); |
107 | GNUNET_log_skip (0); | 107 | GNUNET_log_skip (0, GNUNET_NO); |
108 | fh = GNUNET_DISK_file_open (".testfile", GNUNET_DISK_OPEN_READWRITE | 108 | fh = GNUNET_DISK_file_open (".testfile", GNUNET_DISK_OPEN_READWRITE |
109 | | GNUNET_DISK_OPEN_CREATE, GNUNET_DISK_PERM_USER_WRITE | 109 | | GNUNET_DISK_OPEN_CREATE, GNUNET_DISK_PERM_USER_WRITE |
110 | | GNUNET_DISK_PERM_USER_READ); | 110 | | GNUNET_DISK_PERM_USER_READ); |
@@ -223,7 +223,7 @@ testCanonicalize () | |||
223 | static int | 223 | static int |
224 | testChangeOwner () | 224 | testChangeOwner () |
225 | { | 225 | { |
226 | GNUNET_log_skip (1); | 226 | GNUNET_log_skip (1, GNUNET_NO); |
227 | if (GNUNET_OK == GNUNET_DISK_file_change_owner ("/dev/null", "unknownuser")) | 227 | if (GNUNET_OK == GNUNET_DISK_file_change_owner ("/dev/null", "unknownuser")) |
228 | return 1; | 228 | return 1; |
229 | return 0; | 229 | return 0; |
diff --git a/src/util/test_getopt.c b/src/util/test_getopt.c index 7168dd8c1..e254ac31f 100644 --- a/src/util/test_getopt.c +++ b/src/util/test_getopt.c | |||
@@ -196,7 +196,9 @@ main (int argc, char *argv[]) | |||
196 | 196 | ||
197 | GNUNET_log_setup ("test_getopt", "WARNING", NULL); | 197 | GNUNET_log_setup ("test_getopt", "WARNING", NULL); |
198 | /* suppress output from -h, -v options */ | 198 | /* suppress output from -h, -v options */ |
199 | #ifndef MINGW | ||
199 | GNUNET_break (0 == CLOSE (1)); | 200 | GNUNET_break (0 == CLOSE (1)); |
201 | #endif | ||
200 | if (0 != testMinimal ()) | 202 | if (0 != testMinimal ()) |
201 | errCnt++; | 203 | errCnt++; |
202 | if (0 != testVerbose ()) | 204 | if (0 != testVerbose ()) |
diff --git a/src/util/test_plugin.c b/src/util/test_plugin.c index 22bf78b92..e574908a7 100644 --- a/src/util/test_plugin.c +++ b/src/util/test_plugin.c | |||
@@ -31,9 +31,9 @@ check () | |||
31 | { | 31 | { |
32 | void *ret; | 32 | void *ret; |
33 | 33 | ||
34 | GNUNET_log_skip (1); | 34 | GNUNET_log_skip (1, GNUNET_NO); |
35 | ret = GNUNET_PLUGIN_load ("libgnunet_plugin_missing", NULL); | 35 | ret = GNUNET_PLUGIN_load ("libgnunet_plugin_missing", NULL); |
36 | GNUNET_log_skip (0); | 36 | GNUNET_log_skip (0, GNUNET_NO); |
37 | if (ret != NULL) | 37 | if (ret != NULL) |
38 | return 1; | 38 | return 1; |
39 | ret = GNUNET_PLUGIN_load ("libgnunet_plugin_test", "in"); | 39 | ret = GNUNET_PLUGIN_load ("libgnunet_plugin_test", "in"); |
diff --git a/src/util/test_time.c b/src/util/test_time.c index 9505952c2..2454efd32 100644 --- a/src/util/test_time.c +++ b/src/util/test_time.c | |||
@@ -46,10 +46,10 @@ check () | |||
46 | 46 | ||
47 | /* test overflow checking in multiply */ | 47 | /* test overflow checking in multiply */ |
48 | rel = GNUNET_TIME_UNIT_SECONDS; | 48 | rel = GNUNET_TIME_UNIT_SECONDS; |
49 | GNUNET_log_skip (1); | 49 | GNUNET_log_skip (1, GNUNET_NO); |
50 | for (i = 0; i < 55; i++) | 50 | for (i = 0; i < 55; i++) |
51 | rel = GNUNET_TIME_relative_multiply (rel, 2); | 51 | rel = GNUNET_TIME_relative_multiply (rel, 2); |
52 | GNUNET_log_skip (0); | 52 | GNUNET_log_skip (0, GNUNET_NO); |
53 | GNUNET_assert (rel.value == GNUNET_TIME_UNIT_FOREVER_REL.value); | 53 | GNUNET_assert (rel.value == GNUNET_TIME_UNIT_FOREVER_REL.value); |
54 | 54 | ||
55 | /* test infinity-check for relative to absolute */ | 55 | /* test infinity-check for relative to absolute */ |
@@ -58,15 +58,15 @@ check () | |||
58 | 58 | ||
59 | /* check overflow for r2a */ | 59 | /* check overflow for r2a */ |
60 | rel.value = ((uint64_t) - 1LL) - 1024; | 60 | rel.value = ((uint64_t) - 1LL) - 1024; |
61 | GNUNET_log_skip (1); | 61 | GNUNET_log_skip (1, GNUNET_NO); |
62 | last = GNUNET_TIME_relative_to_absolute (rel); | 62 | last = GNUNET_TIME_relative_to_absolute (rel); |
63 | GNUNET_log_skip (0); | 63 | GNUNET_log_skip (0, GNUNET_NO); |
64 | GNUNET_assert (last.value == GNUNET_TIME_UNIT_FOREVER_ABS.value); | 64 | GNUNET_assert (last.value == GNUNET_TIME_UNIT_FOREVER_ABS.value); |
65 | 65 | ||
66 | /* check overflow for relative add */ | 66 | /* check overflow for relative add */ |
67 | GNUNET_log_skip (1); | 67 | GNUNET_log_skip (1, GNUNET_NO); |
68 | rel = GNUNET_TIME_relative_add (rel, rel); | 68 | rel = GNUNET_TIME_relative_add (rel, rel); |
69 | GNUNET_log_skip (0); | 69 | GNUNET_log_skip (0, GNUNET_NO); |
70 | GNUNET_assert (rel.value == GNUNET_TIME_UNIT_FOREVER_REL.value); | 70 | GNUNET_assert (rel.value == GNUNET_TIME_UNIT_FOREVER_REL.value); |
71 | 71 | ||
72 | /* check relation check in get_duration */ | 72 | /* check relation check in get_duration */ |