summaryrefslogtreecommitdiffstats
path: root/tests/ts/logger/options
diff options
context:
space:
mode:
authorKarel Zak2015-04-14 11:52:06 +0200
committerKarel Zak2015-04-14 11:52:06 +0200
commitf8c0152970221261c52f6604e9e7963b478ebd95 (patch)
tree512705140f6eebee384c0e008645d0b8b3ab5092 /tests/ts/logger/options
parentunshare: allow persisting mount namespaces (diff)
parenttravis: install socat >= 1.7.2 (diff)
downloadkernel-qcow2-util-linux-f8c0152970221261c52f6604e9e7963b478ebd95.tar.gz
kernel-qcow2-util-linux-f8c0152970221261c52f6604e9e7963b478ebd95.tar.xz
kernel-qcow2-util-linux-f8c0152970221261c52f6604e9e7963b478ebd95.zip
Merge branch 'tests-logger' of https://github.com/rudimeier/util-linux
* 'tests-logger' of https://github.com/rudimeier/util-linux: travis: install socat >= 1.7.2 tests: add subtests for invalid logger devive tests: logger/errors does not use --no-act tests: logger, validate written socket data tests: logger with socat device tests: simplify common logger options logger: --stderr and --no-act turn "auto-errors" on
Diffstat (limited to 'tests/ts/logger/options')
-rwxr-xr-xtests/ts/logger/options21
1 files changed, 19 insertions, 2 deletions
diff --git a/tests/ts/logger/options b/tests/ts/logger/options
index 6bd323686..afcf5f859 100755
--- a/tests/ts/logger/options
+++ b/tests/ts/logger/options
@@ -50,14 +50,31 @@ export LOGGER_TEST_TIMEOFDAY="1234567890.123456"
export LOGGER_TEST_HOSTNAME="test-hostname"
export LOGGER_TEST_GETPID="98765"
+DEVLOG="${TS_OUTDIR}/${TS_TESTNAME}_devlog"
+SOCKIN="${TS_OUTDIR}/${TS_TESTNAME}_socketin"
+ts_init_socket_to_file $DEVLOG $SOCKIN
+SOCAT_PID="$!"
+
+function logger_fun {
+ $TS_HELPER_LOGGER -u $DEVLOG --stderr --no-act "$@" >> "$TS_OUTPUT" 2>&1
+ echo "ret: $?" >> "$TS_OUTPUT"
+}
+
for i in "${tests_array[@]}"; do
name="${i%%:*}"
options="${i##*:}"
ts_init_subtest "$name"
- $TS_HELPER_LOGGER --stderr --no-act -t "test_tag" $options > "$TS_OUTPUT" 2>&1
- echo "ret: $?" >> "$TS_OUTPUT"
+ logger_fun -t "test_tag" $options
ts_finalize_subtest
done
+ts_init_subtest "check_socket"
+ts_log "Check written socket data of all subtests."
+sleep 1
+kill $SOCAT_PID
+wait $SOCAT_PID &>/dev/null
+cat "$SOCKIN" >> "$TS_OUTPUT" 2>&1
+ts_finalize_subtest
+
ts_finalize