aboutsummaryrefslogtreecommitdiff
path: root/src/util/test_common_logging.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-10-05 15:09:28 +0200
committerChristian Grothoff <christian@grothoff.org>2019-10-05 15:09:28 +0200
commitc4e9ba925ffd758aaa3feee2ccfc0b76f26fe207 (patch)
treecac3ce030d77b4cbe7c7dc62ed58cfe6d24f73e1 /src/util/test_common_logging.c
parentfbb71d527c7d6babf269a8fefce1db291b9f7068 (diff)
downloadgnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.tar.gz
gnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.zip
global reindent, now with uncrustify hook enabled
Diffstat (limited to 'src/util/test_common_logging.c')
-rw-r--r--src/util/test_common_logging.c94
1 files changed, 47 insertions, 47 deletions
diff --git a/src/util/test_common_logging.c b/src/util/test_common_logging.c
index 8492d3c35..d905a3bf3 100644
--- a/src/util/test_common_logging.c
+++ b/src/util/test_common_logging.c
@@ -27,8 +27,8 @@
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28 28
29static void 29static void
30my_log(void *ctx, enum GNUNET_ErrorType kind, const char *component, 30my_log (void *ctx, enum GNUNET_ErrorType kind, const char *component,
31 const char *date, const char *msg) 31 const char *date, const char *msg)
32{ 32{
33 unsigned int *c = ctx; 33 unsigned int *c = ctx;
34 34
@@ -38,61 +38,61 @@ my_log(void *ctx, enum GNUNET_ErrorType kind, const char *component,
38 38
39 39
40int 40int
41main(int argc, char *argv[]) 41main (int argc, char *argv[])
42{ 42{
43 unsigned int failureCount = 0; 43 unsigned int failureCount = 0;
44 unsigned int logs = 0; 44 unsigned int logs = 0;
45 45
46 if (0 != putenv("GNUNET_FORCE_LOG=")) 46 if (0 != putenv ("GNUNET_FORCE_LOG="))
47 fprintf(stderr, "Failed to putenv: %s\n", strerror(errno)); 47 fprintf (stderr, "Failed to putenv: %s\n", strerror (errno));
48 GNUNET_log_setup("test-common-logging", "DEBUG", "/dev/null"); 48 GNUNET_log_setup ("test-common-logging", "DEBUG", "/dev/null");
49 GNUNET_logger_add(&my_log, &logs); 49 GNUNET_logger_add (&my_log, &logs);
50 GNUNET_logger_add(&my_log, &logs); 50 GNUNET_logger_add (&my_log, &logs);
51 GNUNET_log(GNUNET_ERROR_TYPE_BULK, "Testing...\n"); 51 GNUNET_log (GNUNET_ERROR_TYPE_BULK, "Testing...\n");
52 GNUNET_log(GNUNET_ERROR_TYPE_BULK, "Testing...\n"); 52 GNUNET_log (GNUNET_ERROR_TYPE_BULK, "Testing...\n");
53 GNUNET_log(GNUNET_ERROR_TYPE_BULK, "Testing...\n"); 53 GNUNET_log (GNUNET_ERROR_TYPE_BULK, "Testing...\n");
54 GNUNET_log(GNUNET_ERROR_TYPE_BULK, "Testing...\n"); 54 GNUNET_log (GNUNET_ERROR_TYPE_BULK, "Testing...\n");
55 GNUNET_log(GNUNET_ERROR_TYPE_BULK, "Testing...\n"); 55 GNUNET_log (GNUNET_ERROR_TYPE_BULK, "Testing...\n");
56 GNUNET_log(GNUNET_ERROR_TYPE_BULK, "Testing...\n"); 56 GNUNET_log (GNUNET_ERROR_TYPE_BULK, "Testing...\n");
57 GNUNET_logger_remove(&my_log, &logs); 57 GNUNET_logger_remove (&my_log, &logs);
58 GNUNET_log(GNUNET_ERROR_TYPE_BULK, "Flusher...\n"); 58 GNUNET_log (GNUNET_ERROR_TYPE_BULK, "Flusher...\n");
59 /* the last 6 calls should be merged (repated bulk messages!) */ 59 /* the last 6 calls should be merged (repated bulk messages!) */
60 GNUNET_logger_remove(&my_log, &logs); 60 GNUNET_logger_remove (&my_log, &logs);
61 if (logs != 4) 61 if (logs != 4)
62 { 62 {
63 fprintf(stdout, "Expected 4 log calls, got %u\n", logs); 63 fprintf (stdout, "Expected 4 log calls, got %u\n", logs);
64 failureCount++; 64 failureCount++;
65 } 65 }
66 GNUNET_break(0 == 66 GNUNET_break (0 ==
67 strcmp(_("ERROR"), 67 strcmp (_ ("ERROR"),
68 GNUNET_error_type_to_string(GNUNET_ERROR_TYPE_ERROR))); 68 GNUNET_error_type_to_string (GNUNET_ERROR_TYPE_ERROR)));
69 GNUNET_break(0 == 69 GNUNET_break (0 ==
70 strcmp(_("WARNING"), 70 strcmp (_ ("WARNING"),
71 GNUNET_error_type_to_string 71 GNUNET_error_type_to_string
72 (GNUNET_ERROR_TYPE_WARNING))); 72 (GNUNET_ERROR_TYPE_WARNING)));
73 GNUNET_break(0 == 73 GNUNET_break (0 ==
74 strcmp(_("INFO"), 74 strcmp (_ ("INFO"),
75 GNUNET_error_type_to_string(GNUNET_ERROR_TYPE_INFO))); 75 GNUNET_error_type_to_string (GNUNET_ERROR_TYPE_INFO)));
76 GNUNET_break(0 == 76 GNUNET_break (0 ==
77 strcmp(_("DEBUG"), 77 strcmp (_ ("DEBUG"),
78 GNUNET_error_type_to_string(GNUNET_ERROR_TYPE_DEBUG))); 78 GNUNET_error_type_to_string (GNUNET_ERROR_TYPE_DEBUG)));
79 GNUNET_log_setup("test_common_logging", "WARNING", "/dev/null"); 79 GNUNET_log_setup ("test_common_logging", "WARNING", "/dev/null");
80 logs = 0; 80 logs = 0;
81 GNUNET_logger_add(&my_log, &logs); 81 GNUNET_logger_add (&my_log, &logs);
82 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Checker...\n"); 82 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Checker...\n");
83 GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Drop me...\n"); 83 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Drop me...\n");
84 GNUNET_logger_remove(&my_log, &logs); 84 GNUNET_logger_remove (&my_log, &logs);
85 if (logs != 1) 85 if (logs != 1)
86 { 86 {
87 fprintf(stdout, "Expected 1 log call, got %u\n", logs); 87 fprintf (stdout, "Expected 1 log call, got %u\n", logs);
88 failureCount++; 88 failureCount++;
89 } 89 }
90 90
91 if (failureCount != 0) 91 if (failureCount != 0)
92 { 92 {
93 fprintf(stdout, "%u TESTS FAILED!\n", failureCount); 93 fprintf (stdout, "%u TESTS FAILED!\n", failureCount);
94 return -1; 94 return -1;
95 } 95 }
96 return 0; 96 return 0;
97} /* end of main */ 97} /* end of main */
98 98