diff options
author | Sami Kerola | 2015-03-15 13:00:57 +0100 |
---|---|---|
committer | Sami Kerola | 2015-03-17 00:22:50 +0100 |
commit | 660d2e44e5d75d98cfeb8971c7229f2c4b1d03d9 (patch) | |
tree | c7a47ae395d55063ced18671189fdc501c03ab66 /tests/ts/logger | |
parent | tests: disarm tailf test (diff) | |
download | kernel-qcow2-util-linux-660d2e44e5d75d98cfeb8971c7229f2c4b1d03d9.tar.gz kernel-qcow2-util-linux-660d2e44e5d75d98cfeb8971c7229f2c4b1d03d9.tar.xz kernel-qcow2-util-linux-660d2e44e5d75d98cfeb8971c7229f2c4b1d03d9.zip |
tests: add logger(1) message format tests
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'tests/ts/logger')
-rwxr-xr-x | tests/ts/logger/formats | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/ts/logger/formats b/tests/ts/logger/formats new file mode 100755 index 000000000..4d11c1d9b --- /dev/null +++ b/tests/ts/logger/formats @@ -0,0 +1,58 @@ +#!/bin/bash + +# +# Copyright (C) 2015 Sami Kerola <kerolasa@iki.fi> +# +# This file is part of util-linux. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# + +TS_TOPDIR="${0%/*}/../.." +TS_DESC="formats" + +. $TS_TOPDIR/functions.sh + +ts_init "$*" + +ts_check_test_command "$TS_HELPER_LOGGER" + +export TZ="GMT" +export LOGGER_TEST_TIMEOFDAY="1234567890.123456" +export LOGGER_TEST_HOSTNAME="test-hostname" +export LOGGER_TEST_GETPID="98765" + +ts_init_subtest "rfc3164" +$TS_HELPER_LOGGER -s --no-act -t "rfc3164" --rfc3164 "message" > "$TS_OUTPUT" 2>&1 +ts_finalize_subtest + +ts_init_subtest "rfc5424_simple" +$TS_HELPER_LOGGER -s --no-act -t "rfc5424" --rfc5424 "message" > "$TS_OUTPUT" 2>&1 +ts_finalize_subtest +ts_init_subtest "rfc5424_notime" +$TS_HELPER_LOGGER -s --no-act -t "rfc5424" --rfc5424=notime "message" > "$TS_OUTPUT" 2>&1 +ts_finalize_subtest +ts_init_subtest "rfc5424_nohost" +$TS_HELPER_LOGGER -s --no-act -t "rfc5424" --rfc5424=nohost "message" > "$TS_OUTPUT" 2>&1 +ts_finalize_subtest +ts_init_subtest "rfc5424_msgid" +$TS_HELPER_LOGGER -s --no-act -t "rfc5424" --rfc5424 --msgid "MSGID" "message" > "$TS_OUTPUT" 2>&1 +ts_finalize_subtest + +ts_init_subtest "priorities" +for facility in auth authpriv cron daemon ftp lpr mail news syslog user uucp local{0..7}; do + for level in emerg alert crit err warning notice info debug; do + $TS_HELPER_LOGGER -s --no-act -t "prio" -p "$facility.$level" "$facility.$level" >> "$TS_OUTPUT" 2>&1 + done +done +ts_finalize_subtest + +ts_finalize |