Add basic persistent logging tests 89/243289/2 accepted/tizen/unified/20200908.060805 submit/tizen/20200907.062212
authorMateusz Majewski <m.majewski2@samsung.com>
Fri, 4 Sep 2020 08:31:06 +0000 (10:31 +0200)
committerMateusz Majewski <m.majewski2@samsung.com>
Fri, 4 Sep 2020 11:09:16 +0000 (13:09 +0200)
For pipe backend only for now.

Change-Id: I59ea088c9ba39c10cd9706ac5e432513e291bad1

configs/dlog-pipe.conf.test
tests/dlog_test.in

index 711e14b..06e1568 100644 (file)
@@ -84,6 +84,8 @@ radio_size=1048576
 kmsg_size=1048576
 syslog_size=1048576
 
+dlog_logger_conf_main=dlogutil -b main -r 512 -n 10 -f /var/lib/dlog-tests/main -v threadtime *:I
+
 util_sorting_time_window=5000
 util_sorting_buffer_size=32000
 dynamic_config_path=/tmp/dlog-filters/
index 1e32ea2..0b00a60 100644 (file)
@@ -842,6 +842,23 @@ LOG_DETAILS="testing if libdlogutil clears the buffer correctly"
 test_libdlogutil clear $LIBDLOGUTIL_CORRECT_PID $type && ok || fail
 
 if [ "$quick" -ne 1 ]; then
+       if [ "$type" = "pipe" ]; then
+               dlogsend -b main -t DLOG_LOGGER_TEST0 -c 100 "hi"
+               sleep 1
+               LOG_DETAILS="testing if logger daemon persistent logging works"
+               [ "$(grep -c DLOG_LOGGER_TEST0 $TESTDIR/main)" -eq 100 ] && ok || fail
+
+               dlogsend -b main -t DLOG_LOGGER_TEST1 -c 500000 "hi"
+               sleep 1
+               RESULT=$(du -c $TESTDIR/main* | tail -n 1 | cut -f 1)
+               LOG_DETAILS="testing if logger daemon log rotating works (1/2)"
+               [ "$RESULT" -gt 4096 ] && ok || fail # Min 4 MB
+               LOG_DETAILS="testing if logger daemon log rotating works (2/2)"
+               [ "$RESULT" -lt 6144 ] && ok || fail # Max 6 MB
+
+               dlogutil -cb main
+       fi
+
        LOG_DETAILS="testing if the library works with multithreaded app"
        dlogutil -f $TESTDIR/dlog_mt_test &
        MT_TEST=$!