summaryrefslogtreecommitdiffstats
path: root/t
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
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')
-rw-r--r--t/test_umberlog.c31
-rw-r--r--t/test_umberlog_preload.c7
2 files changed, 37 insertions, 1 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);
diff --git a/t/test_umberlog_preload.c b/t/test_umberlog_preload.c
index 09d3210..d4db896 100644
--- a/t/test_umberlog_preload.c
+++ b/t/test_umberlog_preload.c
@@ -202,6 +202,7 @@ START_TEST (test_openlog_defaults)
if (getgid () != 0)
verify_value_differs (jo, "gid", "0");
verify_value_differs (jo, "host", "");
+
json_object_put (jo);
closelog ();
@@ -219,10 +220,12 @@ main (void)
s = suite_create ("Umberlog (LD_PRELOAD) functional testsuite");
ft = tcase_create ("Basic tests");
+#if DEFAULT_DISCOVER_FLAGS == LOG_UL_ALL
tcase_add_test (ft, test_openlog_defaults);
tcase_add_test (ft, test_simple);
- tcase_add_test (ft, test_additional_fields);
tcase_add_test (ft, test_discover_priority);
+#endif
+ tcase_add_test (ft, test_additional_fields);
#ifdef HAVE_PARSE_PRINTF_FORMAT
tcase_add_test (ft, test_positional_params);
#endif
@@ -230,7 +233,9 @@ main (void)
bt = tcase_create ("Bug tests");
tcase_add_test (bt, test_json_escape);
+#if DEFAULT_DISCOVER_FLAGS == LOG_UL_ALL
tcase_add_test (bt, test_facprio);
+#endif
suite_add_tcase (s, bt);
sr = srunner_create (s);