Add a simple QoS integration test 59/240659/1
authorMateusz Majewski <m.majewski2@samsung.com>
Mon, 10 Aug 2020 10:13:32 +0000 (12:13 +0200)
committerMateusz Majewski <m.majewski2@samsung.com>
Mon, 10 Aug 2020 10:13:32 +0000 (12:13 +0200)
Change-Id: I120660d31877b433ebd66fa6717ba3716e2d8a2a

Makefile.am
configs/qos-additions [new file with mode: 0644]
packaging/dlog.spec
tests/dlog_test.in

index 6d121c7..5c5a2f7 100644 (file)
@@ -639,7 +639,8 @@ data_DATA = \
        configs/dlog-logger.conf.test \
        configs/dlog-logger.conf.alias \
        configs/dlog-pipe.conf.cpu \
-       configs/dlog-logger.conf.cpu
+       configs/dlog-logger.conf.cpu \
+       configs/qos-additions
 
 unitdir = $(prefix)/lib/systemd/system
 nodist_unit_DATA = configs/dlog_logger.service \
diff --git a/configs/qos-additions b/configs/qos-additions
new file mode 100644 (file)
index 0000000..0ce8839
--- /dev/null
@@ -0,0 +1,6 @@
+qos_file_path=/tmp/dlog-filters/42-qos.conf
+qos_refresh_rate_s=5
+qos_max_throughput_logs=50
+qos_threshold_logs=40
+qos_threshold_reapply_logs=5
+qos_method=equal
index 9f6e452..c24dfbf 100644 (file)
@@ -346,6 +346,7 @@ chsmack -e 'System' %{_libexecdir}/dlog-log-critical
 %{_datadir}/dlog-logger.conf.alias
 %{_datadir}/dlog-pipe.conf.cpu
 %{_datadir}/dlog-logger.conf.cpu
+%{_datadir}/qos-additions
 %{_sysconfdir}/dlog.conf.d/99-dlog-logger.disable-platform-logging-for-testsuite.conf
 %dir %attr(755,log,log) /var/lib/dlog-tests
 %dir %attr(755,log,log) /usr/share/dlog-filters.conf.test
index fd99775..5f08c50 100644 (file)
@@ -741,6 +741,37 @@ if [ "$TEST_DYNAMIC_FILTERS" == "true" ]; then
        # In each 5 second period, 5 logs are sent, so there are 3 periods.
        # 2 logs from each period are allowed.
        [[ $(dlogutil --pid $DLOGSEND_PID -d | wc -l) -eq 6 ]] && ok || fail
+
+       if [ $type == "pipe" ]; then
+               PREQOS_CONFIG_PATH=$DLOG_CONFIG_PATH
+               DLOG_CONFIG_PATH="$TESTDIR/qos.conf"
+               cat $PREQOS_CONFIG_PATH "@datadir@/qos-additions" > $DLOG_CONFIG_PATH
+               kill $LOGGER > /dev/null
+               sleep 1
+               dlog_logger -b 99 -t 0 &
+               LOGGER=$!
+               sleep 1
+
+               dlogsend -b main -t DLOG_QOS_TEST1 -c 300 -d 1 -f 20 "Some log spam"
+               LOG_DETAILS="testing if QoS works (1/3)"
+               [[ $(dlogutil -d DLOG_QOS_TEST1 | wc -l) -le 180 ]] && ok || fail
+
+               dlogsend -b main -t DLOG_QOS_TEST2 -c 60 -d 1 -f 4 "A normal app that just wants to log" &
+               DLOGSEND_PID=$!
+               dlogsend -b main -t DLOG_QOS_TEST3 -c 240 -d 1 -f 16 "Some log spam"
+               wait $DLOGSEND_PID
+               LOG_DETAILS="testing if QoS works (2/3)"
+               [[ $(dlogutil -d DLOG_QOS_TEST2 DLOG_QOS_TEST3 | wc -l) -le 180 ]] && ok || fail
+               LOG_DETAILS="testing if QoS works (3/3)"
+               [[ $(dlogutil -d DLOG_QOS_TEST2 | wc -l) -gt 40 ]] && ok || fail
+
+               DLOG_CONFIG_PATH=$PREQOS_CONFIG_PATH
+               kill $LOGGER > /dev/null
+               sleep 1
+               dlog_logger -b 99 -t 0 &
+               LOGGER=$!
+               sleep 1
+       fi
 fi
 
 LOG_DETAILS="testing if libdlogutil clears the buffer correctly"