aboutsummaryrefslogtreecommitdiff
path: root/src/util/test_common_logging.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-10-11 09:43:04 +0000
committerChristian Grothoff <christian@grothoff.org>2011-10-11 09:43:04 +0000
commitd9d94d0e53d26af75ec8241383d166544ebd79f3 (patch)
tree9080b73624389403a198257fe0547bb4634e64d2 /src/util/test_common_logging.c
parent2d792ee2e9cc0c993b8907e2c8edb0c2b8465343 (diff)
downloadgnunet-d9d94d0e53d26af75ec8241383d166544ebd79f3.tar.gz
gnunet-d9d94d0e53d26af75ec8241383d166544ebd79f3.zip
converting to GNUNET_LOG_from*
Diffstat (limited to 'src/util/test_common_logging.c')
-rw-r--r--src/util/test_common_logging.c49
1 files changed, 26 insertions, 23 deletions
diff --git a/src/util/test_common_logging.c b/src/util/test_common_logging.c
index 39ef58267..6b4922c65 100644
--- a/src/util/test_common_logging.c
+++ b/src/util/test_common_logging.c
@@ -28,7 +28,7 @@
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
@@ -57,23 +57,26 @@ main (int argc, char *argv[])
57 /* the last 6 calls should be merged (repated bulk messages!) */ 57 /* the last 6 calls should be merged (repated bulk messages!) */
58 GNUNET_logger_remove (&my_log, &logs); 58 GNUNET_logger_remove (&my_log, &logs);
59 if (logs != 4) 59 if (logs != 4)
60 { 60 {
61 fprintf (stdout, "Expected 4 log calls, got %u\n", logs); 61 fprintf (stdout, "Expected 4 log calls, got %u\n", logs);
62 failureCount++; 62 failureCount++;
63 } 63 }
64 GNUNET_break (0 == 64 GNUNET_break (0 ==
65 strcmp (_("ERROR"), 65 strcmp (_("ERROR"),
66 GNUNET_error_type_to_string (GNUNET_ERROR_TYPE_ERROR))); 66 GNUNET_error_type_to_string
67 (GNUNET_ERROR_TYPE_ERROR)));
67 GNUNET_break (0 == 68 GNUNET_break (0 ==
68 strcmp (_("WARNING"), 69 strcmp (_("WARNING"),
69 GNUNET_error_type_to_string 70 GNUNET_error_type_to_string
70 (GNUNET_ERROR_TYPE_WARNING))); 71 (GNUNET_ERROR_TYPE_WARNING)));
71 GNUNET_break (0 == 72 GNUNET_break (0 ==
72 strcmp (_("INFO"), 73 strcmp (_("INFO"),
73 GNUNET_error_type_to_string (GNUNET_ERROR_TYPE_INFO))); 74 GNUNET_error_type_to_string
75 (GNUNET_ERROR_TYPE_INFO)));
74 GNUNET_break (0 == 76 GNUNET_break (0 ==
75 strcmp (_("DEBUG"), 77 strcmp (_("DEBUG"),
76 GNUNET_error_type_to_string (GNUNET_ERROR_TYPE_DEBUG))); 78 GNUNET_error_type_to_string
79 (GNUNET_ERROR_TYPE_DEBUG)));
77 GNUNET_log_setup ("test_common_logging", "WARNING", "/dev/null"); 80 GNUNET_log_setup ("test_common_logging", "WARNING", "/dev/null");
78 logs = 0; 81 logs = 0;
79 GNUNET_logger_add (&my_log, &logs); 82 GNUNET_logger_add (&my_log, &logs);
@@ -81,17 +84,17 @@ main (int argc, char *argv[])
81 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Drop me...\n"); 84 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Drop me...\n");
82 GNUNET_logger_remove (&my_log, &logs); 85 GNUNET_logger_remove (&my_log, &logs);
83 if (logs != 1) 86 if (logs != 1)
84 { 87 {
85 fprintf (stdout, "Expected 1 log call, got %u\n", logs); 88 fprintf (stdout, "Expected 1 log call, got %u\n", logs);
86 failureCount++; 89 failureCount++;
87 } 90 }
88 91
89 if (failureCount != 0) 92 if (failureCount != 0)
90 { 93 {
91 fprintf (stdout, "%u TESTS FAILED!\n", failureCount); 94 fprintf (stdout, "%u TESTS FAILED!\n", failureCount);
92 return -1; 95 return -1;
93 } 96 }
94 return 0; 97 return 0;
95} /* end of main */ 98} /* end of main */
96 99
97/* end of test_common_logging.c */ 100/* end of test_common_logging.c */