tests: extract backend autodetection test to a separate file 49/288449/14
authorMarek Szulc <m.szulc3@samsung.com>
Thu, 16 Feb 2023 13:29:26 +0000 (14:29 +0100)
committerMichal Bloch <m.bloch@samsung.com>
Fri, 12 Jan 2024 22:08:36 +0000 (23:08 +0100)
Change-Id: I8a27f0dbf7a2196513a1910a70f23b34d1b2ae7b

Makefile.am
configure.ac
packaging/dlog.spec
tests/dlog_test.in
tests/dlog_test_backend_autodetection.in [new file with mode: 0644]

index d4c54b7..cd35b1d 100644 (file)
@@ -970,7 +970,7 @@ modulesloadddir = /usr/lib/modules/modules-load.d
 modulesloadd_DATA = \
        configs/tizen-modules-dlog-zero-copy.conf
 
-bin_SCRIPTS = dlog_test dlog_test_header dlog_test_daemon_early_quit dlog_test_tid_filtering_secure_logging dlog_cpu
+bin_SCRIPTS = dlog_test dlog_test_header dlog_test_daemon_early_quit dlog_test_tid_filtering_secure_logging dlog_test_backend_autodetection dlog_cpu
 
 
 
index ee07914..4a34b49 100644 (file)
@@ -90,6 +90,7 @@ AC_CONFIG_FILES([Makefile dlog.pc dlogutil.pc dlog-redirect-stdout.pc]
                 [dlog_test_header:tests/dlog_test_header.in]
                 [dlog_test_daemon_early_quit:tests/dlog_test_daemon_early_quit.in]
                 [dlog_test_tid_filtering_secure_logging:tests/dlog_test_tid_filtering_secure_logging.in]
+                [dlog_test_backend_autodetection:tests/dlog_test_backend_autodetection.in]
                 [dlog_cpu:tests/dlog_cpu.in]
                 [README.testsuite:tests/README.testsuite.in]
                 [units/dlog_logger.service]
index 1a124da..15d881e 100644 (file)
@@ -316,6 +316,7 @@ chsmack -e 'System' %{_libexecdir}/dlog-log-critical
 %{_bindir}/dlog_test
 %{_bindir}/dlog_test_header
 %{_bindir}/dlog_test_daemon_early_quit
+%{_bindir}/dlog_test_backend_autodetection
 %{_bindir}/dlog_test_tid_filtering_secure_logging
 %{_bindir}/dlog_cpu
 /usr/share/doc/dlog/README.testsuite
index a06302f..eabca49 100644 (file)
@@ -1117,28 +1117,13 @@ DLOG_CONFIG_PATH=$DLOG_PREV_PATH
 
 if [ "$quick" -ne 1 ]; then
        if [ "$type" != "zero-copy" ]; then # Backend autodection and logger daemon stuff don't really work on zero-copy
-               PREAUTODETECT_CONFIG_PATH=$DLOG_CONFIG_PATH
-               DLOG_CONFIG_PATH="@datadir@/dlog-$type.conf.autodetect"
                kill $LOGGER > /dev/null
                sleep 1
-               if [ "$type" = "logger" ]; then
-                       dlogutil -cb main
-               fi
-               dlog_logger -t 0 &
-               LOGGER=$!
-               sleep 1
-
-               LOG_DETAILS="testing if backend autodetection works properly (1/2)"
-               dlogsend -b main -t DLOG_AUTODETECT "xd" && ok || fail
-               sleep 1
 
-               DLOG_CONFIG_PATH=$PREAUTODETECT_CONFIG_PATH
-               LOG_DETAILS="testing if backend autodetection works properly (2/2)"
-               [ "$(dlogutil -db main -v raw)" = "xd" ] && ok || fail
+               dlog_test_backend_autodetection $type
 
-               kill $LOGGER > /dev/null
-               sleep 1
                rm "$TESTDIR"/test*
+
                dlog_logger -t 0 &
                LOGGER=$!
                sleep 1
@@ -1208,6 +1193,10 @@ if [ "$quick" -ne 1 ]; then
                sleep 1
        fi
 
+       dlog_logger -t 0 &
+       LOGGER=$!
+       sleep 1
+
        LOG_DETAILS="testing if the library works with multithreaded app"
        dlogutil -f $TESTDIR/dlog_mt_test &
        MT_TEST=$!
diff --git a/tests/dlog_test_backend_autodetection.in b/tests/dlog_test_backend_autodetection.in
new file mode 100644 (file)
index 0000000..f8baf0d
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+source dlog_test_header
+
+trap cleanup 0
+
+if [ "$1" = "zero-copy" ]; then
+       echo "zero-copy not supported for this test"
+       exit 1
+fi
+
+PREAUTODETECT_CONFIG_PATH=$DLOG_CONFIG_PATH
+export DLOG_CONFIG_PATH="@datadir@/dlog-$type.conf.autodetect"
+TESTDIR=/var/lib/dlog-tests
+
+if [ "$type" = "logger" ]; then
+       dlogutil -cb main
+fi
+dlog_logger -t 0 &
+LOGGER=$!
+sleep 1
+
+LOG_DETAILS="testing if backend autodetection works properly (1/2)"
+dlogsend -b main -t DLOG_AUTODETECT "xd" && ok || fail
+sleep 1
+
+export DLOG_CONFIG_PATH=$PREAUTODETECT_CONFIG_PATH
+LOG_DETAILS="testing if backend autodetection works properly (2/2)"
+[ "$(dlogutil -db main -v raw)" = "xd" ] && ok || fail
+
+kill $LOGGER > /dev/null
+sleep 1
\ No newline at end of file