From: Ruediger Meier <ruediger.meier@xxxxxxxxxxx> Signed-off-by: Ruediger Meier <ruediger.meier@xxxxxxxxxxx> --- tests/ts/logger/errors | 12 +++++++++++- tests/ts/logger/formats | 12 +++++++++++- tests/ts/logger/options | 13 ++++++++++++- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/tests/ts/logger/errors b/tests/ts/logger/errors index debce7e..b6cf8a3 100755 --- a/tests/ts/logger/errors +++ b/tests/ts/logger/errors @@ -24,14 +24,22 @@ TS_DESC="errors" ts_init "$*" ts_check_test_command "$TS_HELPER_LOGGER" +ts_check_prog "socat" export TZ="GMT" 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" +rm -f "$DEVLOG" "$SOCKIN" +socat -u UNIX-LISTEN:$DEVLOG,fork OPEN:$SOCKIN,creat,append & +SOCAT_PID=$! +sleep 1 + function logger_fun { - $TS_HELPER_LOGGER -s --no-act "$@" >> "$TS_OUTPUT" 2>&1 + $TS_HELPER_LOGGER -u $DEVLOG -s --no-act "$@" >> "$TS_OUTPUT" 2>&1 echo "ret: $?" >> "$TS_OUTPUT" } @@ -67,4 +75,6 @@ ts_init_subtest "rfc5424_msgid_with_space" logger_fun -t "rfc5424_msgid_with_space" --rfc5424 --msgid="A B" "message" ts_finalize_subtest +kill $SOCAT_PID + ts_finalize diff --git a/tests/ts/logger/formats b/tests/ts/logger/formats index d0e9d5c..5fc6d0b 100755 --- a/tests/ts/logger/formats +++ b/tests/ts/logger/formats @@ -24,14 +24,22 @@ TS_DESC="formats" ts_init "$*" ts_check_test_command "$TS_HELPER_LOGGER" +ts_check_prog "socat" export TZ="GMT" 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" +rm -f "$DEVLOG" "$SOCKIN" +socat -u UNIX-LISTEN:$DEVLOG,fork OPEN:$SOCKIN,creat,append & +SOCAT_PID=$! +sleep 1 + function logger_fun { - $TS_HELPER_LOGGER -s --no-act "$@" >> "$TS_OUTPUT" 2>&1 + $TS_HELPER_LOGGER -u $DEVLOG -s --no-act "$@" >> "$TS_OUTPUT" 2>&1 echo "ret: $?" >> "$TS_OUTPUT" } @@ -63,4 +71,6 @@ for facility in auth authpriv cron daemon ftp lpr mail news syslog user uucp loc done ts_finalize_subtest +kill $SOCAT_PID + ts_finalize diff --git a/tests/ts/logger/options b/tests/ts/logger/options index 6bd3236..4eb2b32 100755 --- a/tests/ts/logger/options +++ b/tests/ts/logger/options @@ -24,6 +24,7 @@ TS_DESC="options" ts_init "$*" ts_check_test_command "$TS_HELPER_LOGGER" +ts_check_prog "socat" # Create --file option input files. echo {a..c}{1..5} > $TS_OUTDIR/input_simple @@ -50,14 +51,24 @@ 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" +rm -f "$DEVLOG" "$SOCKIN" +socat -u UNIX-LISTEN:$DEVLOG,fork OPEN:$SOCKIN,creat,append & +SOCAT_PID=$! +sleep 1 + 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 + $TS_HELPER_LOGGER -u $DEVLOG --stderr --no-act -t "test_tag" $options \ + > "$TS_OUTPUT" 2>&1 echo "ret: $?" >> "$TS_OUTPUT" ts_finalize_subtest done +kill $SOCAT_PID + ts_finalize -- 1.8.4.5 -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html