tests: extract stdout redirection
[platform/core/system/dlog.git] / tests / dlog_test_backend_autodetection.in
1 #!/bin/sh
2
3 source dlog_test_header
4
5 trap cleanup 0
6
7 if [ "$1" = "zero-copy" ]; then
8         echo "zero-copy not supported for this test"
9         exit 1
10 fi
11
12 PREAUTODETECT_CONFIG_PATH=$DLOG_CONFIG_PATH
13 export DLOG_CONFIG_PATH="@datadir@/dlog-$type.conf.autodetect"
14 TESTDIR=/var/lib/dlog-tests
15
16 if [ "$type" = "logger" ]; then
17         dlogutil -cb main
18 fi
19 dlog_logger -t 0 &
20 LOGGER=$!
21 sleep 1
22
23 LOG_DETAILS="testing if backend autodetection works properly (1/2)"
24 dlogsend -b main -t DLOG_AUTODETECT "xd" && ok || fail
25 sleep 1
26
27 export DLOG_CONFIG_PATH=$PREAUTODETECT_CONFIG_PATH
28 LOG_DETAILS="testing if backend autodetection works properly (2/2)"
29 [ "$(dlogutil -db main -v raw)" = "xd" ] && ok || fail
30
31 kill $LOGGER > /dev/null
32 sleep 1