]> git.ipfire.org Git - thirdparty/util-linux.git/commit
logger: add -DTEST_LOGGER
authorKarel Zak <kzak@redhat.com>
Mon, 16 Mar 2015 12:26:52 +0000 (13:26 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 29 Apr 2015 10:14:43 +0000 (12:14 +0200)
commitbf853f680f568492f6d0509006c2be31b8e4bac8
treeb8068a5f715632ebf78fea4ab7237f3e1e243b30
parentfa751a133741d416304c6199138d30236da7b973
logger: add -DTEST_LOGGER

"make test_logger" now compiles logger(1) test program
to overwrite system datetime stuff, hostname and PID, for example:

   export TZ=GMT
   export LOGGER_TEST_TIMEOFDAY=1234567890.123456
   export LOGGER_TEST_HOSTNAME=foo
   export LOGGER_TEST_GETPID=123

   ./test_logger --rfc5424 --no-act --stderr -i --tag MyTag mesg
   <13>1 2009-02-13T23:31:30.123456+00:00 foo MyTag 123 - [timeQuality tzKnown="1" isSynced="0"] mesg

if the LOGGER_TEST_* variables are not specified then default to
standard logger(1) behavior.

Note that it would be possible to use for example "unshare --utc" to
make hostname stable and portable, but LOGGER_TEST_* variables allow
to keep the tests less complex.

Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/Makemodule.am
misc-utils/logger.c
tests/commands.sh