diff options
author | Gergely Nagy <algernon@balabit.hu> | 2012-08-11 01:06:55 +0200 |
---|---|---|
committer | Gergely Nagy <algernon@balabit.hu> | 2012-08-11 01:06:55 +0200 |
commit | fbeba09ae5050ef0adf2791b9d1a29993e9f6658 (patch) | |
tree | 31c56e0599a72184b3835a5f0f5cf48e640db026 /t | |
parent | 1c707ea147d40ff2119b430512fe4e45c564ce32 (diff) | |
download | libumberlog-fbeba09ae5050ef0adf2791b9d1a29993e9f6658.tar.gz libumberlog-fbeba09ae5050ef0adf2791b9d1a29993e9f6658.tar.xz libumberlog-fbeba09ae5050ef0adf2791b9d1a29993e9f6658.zip |
LOG_UL_NODISCOVER => LOG_UL_NOIMPLICIT
Based on a suggestion by Miloslav Trmač <mitr@redhat.com>, rename
LOG_UL_NODISCOVER to LOG_UL_NOIMPLICIT, and clarify the documentation
slightly.
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
Diffstat (limited to 't')
-rw-r--r-- | t/test_perf.c | 8 | ||||
-rw-r--r-- | t/test_umberlog.c | 38 | ||||
-rw-r--r-- | t/test_umberlog_preload.c | 35 |
3 files changed, 44 insertions, 37 deletions
diff --git a/t/test_perf.c b/t/test_perf.c index 0494110..f1eb628 100644 --- a/t/test_perf.c +++ b/t/test_perf.c @@ -44,8 +44,8 @@ test_perf_simple (int flags, unsigned long cnt) dt = ts_diff (st, et); - if (flags & LOG_UL_NODISCOVER) - fls = "no-discover"; + if (flags & LOG_UL_NOIMPLICIT) + fls = "no-implicit"; else if (flags & LOG_UL_NOTIME) fls = "no-time"; else @@ -62,8 +62,8 @@ main (void) test_perf_simple (0, 100000); test_perf_simple (0, 1000000); - test_perf_simple (LOG_UL_NODISCOVER, 100000); - test_perf_simple (LOG_UL_NODISCOVER, 1000000); + test_perf_simple (LOG_UL_NOIMPLICIT, 100000); + test_perf_simple (LOG_UL_NOIMPLICIT, 1000000); test_perf_simple (LOG_UL_NOTIME, 100000); test_perf_simple (LOG_UL_NOTIME, 1000000); diff --git a/t/test_umberlog.c b/t/test_umberlog.c index 291bf43..9be5d08 100644 --- a/t/test_umberlog.c +++ b/t/test_umberlog.c @@ -115,7 +115,7 @@ START_TEST (test_ul_openlog_flag_ignore) char *msg; struct json_object *jo; - ul_openlog ("umberlog/test_ul_openlog_flag_ignore", LOG_UL_NODISCOVER, + ul_openlog ("umberlog/test_ul_openlog_flag_ignore", LOG_UL_NOIMPLICIT, LOG_LOCAL0); msg = ul_format (LOG_DEBUG, "hello, I'm %s!", __FUNCTION__, NULL); @@ -133,42 +133,19 @@ START_TEST (test_ul_openlog_flag_ignore) } END_TEST -START_TEST (test_ul_set_log_flags) +START_TEST (test_no_implicit) { char *msg; struct json_object *jo; - ul_openlog ("umberlog/test_ul_set_log_flags", 0, LOG_LOCAL0); - ul_set_log_flags (LOG_UL_NODISCOVER); + ul_openlog ("umberlog/test_no_implicit", 0, LOG_LOCAL0); + ul_set_log_flags (LOG_UL_NOIMPLICIT); msg = ul_format (LOG_DEBUG, "hello, I'm %s!", __FUNCTION__, NULL); jo = parse_msg (msg); free (msg); - verify_value_missing (jo, "pid"); - verify_value_missing (jo, "uid"); - verify_value_missing (jo, "gid"); - verify_value_missing (jo, "host"); - - json_object_put (jo); - - ul_closelog (); -} -END_TEST - -START_TEST (test_no_discover) -{ - char *msg; - struct json_object *jo; - - ul_openlog ("umberlog/test_no_discover", 0, LOG_LOCAL0); - ul_set_log_flags (LOG_UL_NODISCOVER); - - msg = ul_format (LOG_DEBUG, "hello, I'm %s!", __FUNCTION__, NULL); - jo = parse_msg (msg); - free (msg); - - verify_value (jo, "msg", "hello, I'm test_no_discover!"); + verify_value (jo, "msg", "hello, I'm test_no_implicit!"); verify_value_missing (jo, "facility"); verify_value_missing (jo, "priority"); verify_value_missing (jo, "program"); @@ -218,7 +195,7 @@ START_TEST (test_closelog) struct json_object *jo; ul_openlog ("umberlog/test_closelog", 0, LOG_LOCAL0); - ul_set_log_flags (LOG_UL_NODISCOVER); + ul_set_log_flags (LOG_UL_NOIMPLICIT); ul_closelog (); msg = ul_format (LOG_DEBUG, "%s", __FUNCTION__, NULL); @@ -263,9 +240,8 @@ main (void) tcase_add_test (ft, test_overrides); tcase_add_test (ft, test_ul_openlog); tcase_add_test (ft, test_ul_openlog_flag_ignore); - tcase_add_test (ft, test_ul_set_log_flags); tcase_add_test (ft, test_closelog); - tcase_add_test (ft, test_no_discover); + tcase_add_test (ft, test_no_implicit); suite_add_tcase (s, ft); sr = srunner_create (s); diff --git a/t/test_umberlog_preload.c b/t/test_umberlog_preload.c index d4db896..66f8aad 100644 --- a/t/test_umberlog_preload.c +++ b/t/test_umberlog_preload.c @@ -104,7 +104,7 @@ START_TEST (test_json_escape) char *msg; struct json_object *jo; - openlog ("umberlog/test_json_escape", LOG_UL_NODISCOVER, LOG_LOCAL0); + openlog ("umberlog/test_json_escape", 0, LOG_LOCAL0); msg = ul_format (LOG_DEBUG, "%s", __FUNCTION__, "quotes", "Hi, \"quoted value\" speaking!", @@ -153,7 +153,7 @@ START_TEST (test_positional_params) char *msg; struct json_object *jo; - openlog ("umberlog/test_positional_params", LOG_UL_NOTIME, LOG_LOCAL0); + openlog ("umberlog/test_positional_params", 0, LOG_LOCAL0); #define COMPLEX_FORMAT \ "%3$*5$.*2$hhd , %1$Lf , %4$.3s , %4$s", 1.0L, 5, (char)100, "prefix", -8 @@ -209,6 +209,36 @@ START_TEST (test_openlog_defaults) } END_TEST +START_TEST (test_openlog_flags) +{ + char *msg; + struct json_object *jo; + char host[_POSIX_HOST_NAME_MAX + 1]; + + openlog ("umberlog/test_openlog_flags", LOG_UL_NOIMPLICIT, LOG_LOCAL0); + + msg = ul_format (LOG_DEBUG, "hello, I'm %s!", __FUNCTION__, NULL); + jo = parse_msg (msg); + free (msg); + + gethostname (host, _POSIX_HOST_NAME_MAX); + + verify_value (jo, "msg", "hello, I'm test_openlog_flags!"); + verify_value (jo, "facility", "local0"); + verify_value (jo, "priority", "debug"); + verify_value (jo, "program", "umberlog/test_openlog_flags"); + verify_value_exists (jo, "pid"); + verify_value_exists (jo, "uid"); + verify_value_exists (jo, "gid"); + verify_value_exists (jo, "timestamp"); + verify_value (jo, "host", host); + + json_object_put (jo); + + closelog (); +} +END_TEST + int main (void) { @@ -222,6 +252,7 @@ main (void) ft = tcase_create ("Basic tests"); #if DEFAULT_DISCOVER_FLAGS == LOG_UL_ALL tcase_add_test (ft, test_openlog_defaults); + tcase_add_test (ft, test_openlog_flags); tcase_add_test (ft, test_simple); tcase_add_test (ft, test_discover_priority); #endif |