diff options
author | Ruediger Meier | 2015-04-09 17:00:26 +0200 |
---|---|---|
committer | Ruediger Meier | 2015-04-09 17:56:50 +0200 |
commit | 582aabe2586cf3674874c1a62ce89c6f85ed32f6 (patch) | |
tree | 07ddfb36a4cc118bd19201025f6864ed5f74d16e /tests/ts/logger | |
parent | logger: --stderr and --no-act turn "auto-errors" on (diff) | |
download | kernel-qcow2-util-linux-582aabe2586cf3674874c1a62ce89c6f85ed32f6.tar.gz kernel-qcow2-util-linux-582aabe2586cf3674874c1a62ce89c6f85ed32f6.tar.xz kernel-qcow2-util-linux-582aabe2586cf3674874c1a62ce89c6f85ed32f6.zip |
tests: simplify common logger options
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'tests/ts/logger')
-rwxr-xr-x | tests/ts/logger/errors | 32 | ||||
-rwxr-xr-x | tests/ts/logger/formats | 26 |
2 files changed, 28 insertions, 30 deletions
diff --git a/tests/ts/logger/errors b/tests/ts/logger/errors index c50b3e56a..debce7eab 100755 --- a/tests/ts/logger/errors +++ b/tests/ts/logger/errors @@ -30,45 +30,41 @@ export LOGGER_TEST_TIMEOFDAY="1234567890.123456" export LOGGER_TEST_HOSTNAME="test-hostname" export LOGGER_TEST_GETPID="98765" +function logger_fun { + $TS_HELPER_LOGGER -s --no-act "$@" >> "$TS_OUTPUT" 2>&1 + echo "ret: $?" >> "$TS_OUTPUT" +} + ts_init_subtest "kern_priority" -$TS_HELPER_LOGGER --no-act -s -t "prio" -p kern.emerg "message" > "$TS_OUTPUT" 2>&1 -echo "ret: $?" >> "$TS_OUTPUT" +logger_fun -t "prio" -p kern.emerg "message" ts_finalize_subtest ts_init_subtest "kern_priority_numeric" -$TS_HELPER_LOGGER --no-act -s -t "prio" -p 0 "message" > "$TS_OUTPUT" 2>&1 -echo "ret: $?" >> "$TS_OUTPUT" +logger_fun -t "prio" -p 0 "message" ts_finalize_subtest ts_init_subtest "invalid_prio" -$TS_HELPER_LOGGER --no-act -s -t "prio" -p 8 "message" > "$TS_OUTPUT" 2>&1 -echo "ret: $?" >> "$TS_OUTPUT" +logger_fun -t "prio" -p 8 "message" ts_finalize_subtest # should truncate ts_init_subtest "rfc5424_exceed_size" -$TS_HELPER_LOGGER --no-act -s -t "rfc5424_exceed_size" --rfc5424 --size 3 "abcd" > "$TS_OUTPUT" 2>&1 -echo "ret: $?" >> "$TS_OUTPUT" +logger_fun -t "rfc5424_exceed_size" --rfc5424 --size 3 "abcd" ts_finalize_subtest ts_init_subtest "id_with_space" -$TS_HELPER_LOGGER --no-act -s -t "id_with_space" --id="A B" "message" > "$TS_OUTPUT" 2>&1 -echo "ret: $?" >> "$TS_OUTPUT" -$TS_HELPER_LOGGER --no-act -s -t "rfc5424_id_with_space" --rfc5424 --id="A B" "message" >> "$TS_OUTPUT" 2>&1 -echo "ret: $?" >> "$TS_OUTPUT" +logger_fun -t "id_with_space" --id="A B" "message" +logger_fun -t "rfc5424_id_with_space" --rfc5424 --id="A B" "message" ts_finalize_subtest # should not fail ts_init_subtest "tag_with_space" -$TS_HELPER_LOGGER --no-act -s -t "A B" "tag_with_space" > "$TS_OUTPUT" 2>&1 -echo "ret: $?" >> "$TS_OUTPUT" -$TS_HELPER_LOGGER --no-act -s -t "A B" --rfc5424 "tag_with_space_rfc5424" >> "$TS_OUTPUT" 2>&1 -echo "ret: $?" >> "$TS_OUTPUT" +logger_fun -t "A B" "tag_with_space" +logger_fun -t "A B" --rfc5424 "tag_with_space_rfc5424" ts_finalize_subtest ts_init_subtest "rfc5424_msgid_with_space" -$TS_HELPER_LOGGER --no-act -s -t "rfc5424_msgid_with_space" --rfc5424 --msgid="A B" "message" > "$TS_OUTPUT" 2>&1 -echo "ret: $?" >> "$TS_OUTPUT" +logger_fun -t "rfc5424_msgid_with_space" --rfc5424 --msgid="A B" "message" ts_finalize_subtest ts_finalize diff --git a/tests/ts/logger/formats b/tests/ts/logger/formats index a647b8159..d0e9d5c47 100755 --- a/tests/ts/logger/formats +++ b/tests/ts/logger/formats @@ -30,33 +30,35 @@ export LOGGER_TEST_TIMEOFDAY="1234567890.123456" export LOGGER_TEST_HOSTNAME="test-hostname" export LOGGER_TEST_GETPID="98765" +function logger_fun { + $TS_HELPER_LOGGER -s --no-act "$@" >> "$TS_OUTPUT" 2>&1 + echo "ret: $?" >> "$TS_OUTPUT" +} + ts_init_subtest "rfc3164" -$TS_HELPER_LOGGER -s --no-act -t "rfc3164" --rfc3164 "message" > "$TS_OUTPUT" 2>&1 -echo "ret: $?" >> "$TS_OUTPUT" +logger_fun -t "rfc3164" --rfc3164 "message" ts_finalize_subtest ts_init_subtest "rfc5424_simple" -$TS_HELPER_LOGGER -s --no-act -t "rfc5424" --rfc5424 "message" > "$TS_OUTPUT" 2>&1 -echo "ret: $?" >> "$TS_OUTPUT" +logger_fun -t "rfc5424" --rfc5424 "message" ts_finalize_subtest + ts_init_subtest "rfc5424_notime" -$TS_HELPER_LOGGER -s --no-act -t "rfc5424" --rfc5424=notime "message" > "$TS_OUTPUT" 2>&1 -echo "ret: $?" >> "$TS_OUTPUT" +logger_fun -t "rfc5424" --rfc5424=notime "message" ts_finalize_subtest + ts_init_subtest "rfc5424_nohost" -$TS_HELPER_LOGGER -s --no-act -t "rfc5424" --rfc5424=nohost "message" > "$TS_OUTPUT" 2>&1 -echo "ret: $?" >> "$TS_OUTPUT" +logger_fun -t "rfc5424" --rfc5424=nohost "message" ts_finalize_subtest + ts_init_subtest "rfc5424_msgid" -$TS_HELPER_LOGGER -s --no-act -t "rfc5424" --rfc5424 --msgid "MSGID" "message" > "$TS_OUTPUT" 2>&1 -echo "ret: $?" >> "$TS_OUTPUT" +logger_fun -t "rfc5424" --rfc5424 --msgid "MSGID" "message" 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 - echo "ret: $?" >> "$TS_OUTPUT" + logger_fun -t "prio" -p "$facility.$level" "$facility.$level" done done ts_finalize_subtest |