summaryrefslogtreecommitdiffstats
path: root/t/test_umberlog.c
diff options
context:
space:
mode:
authorGergely Nagy <algernon@balabit.hu>2012-08-10 16:35:40 +0200
committerGergely Nagy <algernon@balabit.hu>2012-08-10 16:53:06 +0200
commit1c707ea147d40ff2119b430512fe4e45c564ce32 (patch)
treef834b2cca835a4f8aa634117a0c15380fc2a70a6 /t/test_umberlog.c
parent2c5439de564f25e4a839586f2f764d2ad8c99968 (diff)
downloadlibumberlog-1c707ea147d40ff2119b430512fe4e45c564ce32.tar.gz
libumberlog-1c707ea147d40ff2119b430512fe4e45c564ce32.tar.xz
libumberlog-1c707ea147d40ff2119b430512fe4e45c564ce32.zip
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 <algernon@balabit.hu>
Diffstat (limited to 't/test_umberlog.c')
-rw-r--r--t/test_umberlog.c31
1 files changed, 31 insertions, 0 deletions
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 <check.h>
+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);