diff options
author | Sami Kerola | 2015-03-15 13:54:50 +0100 |
---|---|---|
committer | Karel Zak | 2015-03-16 14:08:43 +0100 |
commit | 81ff52b32225a2a2aa3f926357aafab866aa0bc3 (patch) | |
tree | c452787bb08cfa57483f1a078b41af04d72af3c0 /tests/ts/logger | |
parent | logger: add -DTEST_LOGGER (diff) | |
download | kernel-qcow2-util-linux-81ff52b32225a2a2aa3f926357aafab866aa0bc3.tar.gz kernel-qcow2-util-linux-81ff52b32225a2a2aa3f926357aafab866aa0bc3.tar.xz kernel-qcow2-util-linux-81ff52b32225a2a2aa3f926357aafab866aa0bc3.zip |
tests: add logger(1) command line options tests
[kzak@redhat.com: - use LOGGER_TEST_* env]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'tests/ts/logger')
-rwxr-xr-x | tests/ts/logger/options | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/tests/ts/logger/options b/tests/ts/logger/options new file mode 100755 index 000000000..a040a2665 --- /dev/null +++ b/tests/ts/logger/options @@ -0,0 +1,62 @@ +#!/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="options" + +. $TS_TOPDIR/functions.sh + +ts_init "$*" + +ts_check_test_command "$TS_HELPER_LOGGER" + +# Create --file option input files. +echo {a..c}{1..5} > $TS_OUTDIR/input_simple +echo {a..c}{1..5} > $TS_OUTDIR/input_empty_line +echo "" >> $TS_OUTDIR/input_empty_line +echo {5..1}{c..1} >> $TS_OUTDIR/input_empty_line +echo "<66>" prio_prefix > $TS_OUTDIR/input_prio_prefix + +# bash 4 might not be available, use go-around hash +tests_array=( + "simple:--stderr test" + "log_pid:--stderr -i test" + "log_pid_long:--stderr --id test" + "log_pid_define:--stderr --id=12345 test" + "log_pid_no_arg:-is test" + "input_file_simple:--stderr -f $TS_OUTDIR/input_simple" + "input_file_empty_line:--stderr -f $TS_OUTDIR/input_empty_line" + "input_file_skip_empty:--stderr --file $TS_OUTDIR/input_empty_line -e" + "input_file_prio_prefix:--stderr --file $TS_OUTDIR/input_prio_prefix --skip-empty --prio-prefix" +) + +export TZ="GMT" +export LOGGER_TEST_TIMEOFDAY="1234567890.123456" +export LOGGER_TEST_HOSTNAME="test-hostname" +export LOGGER_TEST_GETPID="98765" + +for i in "${tests_array[@]}"; do + name="${i%%:*}" + options="${i##*:}" + + ts_init_subtest "$name" + $TS_HELPER_LOGGER -t "test_tag" $options > "$TS_OUTPUT" 2>&1 + ts_finalize_subtest +done + +ts_finalize |