fi
fi
-if [ "$type" = "pipe" ]; then
+if [ "$type" = "pipe" ] && [ "$quick" -ne 1 ]; then
# TODO: Also test the redirector in the logger backend when it's ready there.
# Note that the logger backend doesn't need reconfiguration nor daemon restart.
# It might need some strategically located "dlogutil -cb main"s though.
LOG_DETAILS="testing if basic stdout redirection works correctly (1/2)"
[ "$(dlog_redirect_stdout --outtag FOO -- /usr/bin/echo Hi)" = "" ] && ok || fail
+ sleep 1
LOG_DETAILS="testing if basic stdout redirection works correctly (2/2)"
[ "$(dlogutil -db main -v tag)" = "I/FOO : Hi" ] && ok || fail
dlogutil -cb main
# No need to check output in this case, as nothing is written to stdout anyway
dlog_redirect_stdout --errtag BAR -- /usr/bin/sh -c "echo Hi >&2"
+ sleep 1
LOG_DETAILS="testing if basic stderr redirection works correctly"
[ "$(dlogutil -db main -v tag)" = "E/BAR : Hi" ] && ok || fail
dlogutil -cb main
LOG_DETAILS="testing if redirector doesn't redirect anything by default (1/2)"
[ "$(dlog_redirect_stdout -- /usr/bin/echo Hi)" = "Hi" ] && ok || fail
+ sleep 1
LOG_DETAILS="testing if redirector doesn't redirect anything by default (2/2)"
[ "$(dlogutil -db main -v tag)" = "" ] && ok || fail
dlogutil -cb main
dlog_redirect_stdout --outbuffer radio --outtag AN_INTERESTING_TAG --outprio W -- /usr/bin/echo Hi
+ sleep 1
LOG_DETAILS="testing if redirector settings work correctly on stdout (1/2)"
[ "$(dlogutil -db main -v tag)" = "" ] && ok || fail
LOG_DETAILS="testing if redirector settings work correctly on stdout (2/2)"
dlogutil -cb radio
dlog_redirect_stdout --errbuffer radio --errtag ANOTHER_INTERESTING_TAG --errprio I -- /usr/bin/sh -c "echo Hi >&2"
+ sleep 1
LOG_DETAILS="testing if redirector settings work correctly on stderr (1/2)"
[ "$(dlogutil -db main -v tag)" = "" ] && ok || fail
LOG_DETAILS="testing if redirector settings work correctly on stderr (2/2)"
dlogutil -cb radio
echo "Testing" | dlog_redirect_stdout --outtag BAZ -- /usr/bin/cat
+ sleep 1
LOG_DETAILS="testing if redirector passes stdin correctly"
[ "$(dlogutil -db main -v tag)" = "I/BAZ : Testing" ] && ok || fail
dlogutil -cb main
line 4
line 5
EOF
+ sleep 1
LOG_DETAILS="testing if multiline logs are handled correctly"
[ "$(dlogutil -db main | wc -l)" -eq 5 ] && ok || fail
dlogutil -cb main
rm -f "$TESTDIR"/output
base64 -w 0 < /dev/urandom 2> /dev/null | head -c 250000 > "$TESTDIR"/input
dlog_redirect_stdout --outtag XYZZY -- /usr/bin/cat "$TESTDIR"/input
+ sleep 1
dlogutil -db main -v raw | tr -d '\n' > "$TESTDIR"/output
LOG_DETAILS="testing if long lines are handled correctly"
# Usually we would just diff or cmp the files. Unfortunately, as of writing, Tizen doesn't have such luxuries.
dlogctl -b main --disable-stdout
LOG_DETAILS="testing if redirection can be disabled (1/2)"
[ "$(dlog_redirect_stdout --outtag THETAG -- /usr/bin/echo test)" = "" ] && ok || fail
+ sleep 1
LOG_DETAILS="testing if redirection can be disabled (2/2)"
[ "$(dlogutil -db main -v raw)" = "" ] && ok || fail
dlogctl -b main --enable-stdout
LOG_DETAILS="testing if redirection can be reenabled (1/2)"
[ "$(dlog_redirect_stdout --outtag THETAG -- /usr/bin/echo test)" = "" ] && ok || fail
+ sleep 1
LOG_DETAILS="testing if redirection can be reenabled (2/2)"
[ "$(dlogutil -db main -v raw)" = "test" ] && ok || fail
dlogutil -cb main
dlogctl -b radio --disable-stdout
dlog_redirect_stdout --outtag THETAG -- /usr/bin/echo test
+ sleep 1
LOG_DETAILS="testing if dlogctl --disable-stdout respects buffer choice"
[ "$(dlogutil -db main -v raw)" = "test" ] && ok || fail