]> 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>
Mon, 16 Mar 2015 13:01:53 +0000 (14:01 +0100)
commitef5fb2800153fc05d19df202e4ee182fb72f1d86
tree69dc193182d6db4bfa663772261bdcc765ebddcb
parentfd343a05726658514fc9679cc226ea8aa89549d6
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