From 1c707ea147d40ff2119b430512fe4e45c564ce32 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Fri, 10 Aug 2012 16:35:40 +0200 Subject: Support disabling discovery for the LD_PRELOAD variant When compiled with --disable-discovery, the LD_PRELOAD variant will have automatic field discovery disabled. This does not affect the linkable library, which always has them enabled by default. Signed-off-by: Gergely Nagy --- t/test_umberlog.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 't/test_umberlog.c') diff --git a/t/test_umberlog.c b/t/test_umberlog.c index 07b2d17..291bf43 100644 --- a/t/test_umberlog.c +++ b/t/test_umberlog.c @@ -15,6 +15,36 @@ #include +START_TEST (test_defaults) +{ + char *msg; + struct json_object *jo; + + char host[_POSIX_HOST_NAME_MAX + 1]; + + ul_openlog ("umberlog/test_defaults", 0, 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_defaults!"); + verify_value (jo, "facility", "local0"); + verify_value (jo, "priority", "debug"); + verify_value (jo, "program", "umberlog/test_defaults"); + 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); + + ul_closelog (); +} +END_TEST START_TEST (test_overrides) { @@ -229,6 +259,7 @@ main (void) s = suite_create ("Umberlog (linkable) functional testsuite"); ft = tcase_create ("Basic tests"); + tcase_add_test (ft, test_defaults); tcase_add_test (ft, test_overrides); tcase_add_test (ft, test_ul_openlog); tcase_add_test (ft, test_ul_openlog_flag_ignore); -- cgit