tests: extract daemon early quit test to a separate file
[platform/core/system/dlog.git] / tests / dlog_test_header.in
index 730ce3a..d070994 100644 (file)
@@ -54,6 +54,17 @@ TESTDIR=/var/lib/dlog-tests
 
 ######## Utility functions
 
+cleanup() {
+       [ "$UTIL_PID" -ne -1 ] && kill "$UTIL_PID" > /dev/null 2>&1
+       [ "$MT_TEST"  -ne -1 ] && kill "$MT_TEST"  > /dev/null 2>&1
+       [ "$LOGGER"   -ne -1 ] && kill "$LOGGER"   > /dev/null 2>&1
+       # Shellcheck doesn't like this because the rm call is bad if $TESTDIR is empty.
+       # However, such cases would be caught by the conditional.
+       # shellcheck disable=SC2115
+       [ -d "$TESTDIR" ] && rm -rf "$TESTDIR"/*
+       [ -d "$RUNTIME_FILTERS_DIR" ] && rm -rf "$RUNTIME_FILTERS_DIR"
+}
+
 extract_timestamp() {
        ts=0
        case "$1" in
@@ -87,3 +98,21 @@ extract_timestamp() {
        echo "$ts"
 }
 
+######
+if [ "$1" = "pipe" ]; then
+       type="pipe"
+elif [ "$1" = "logger" ]; then
+       type="logger"
+elif [ "$1" = "zero-copy" ]; then
+       type="zero-copy"
+elif [ "$1" = "pipe_quick" ]; then
+       type="pipe"
+       quick=1
+elif [ "$1" = "logger_quick" ]; then
+       type="logger"
+       quick=1
+else
+       echo "$USAGE_MESSAGE"
+       exit 1
+fi
+