From: Karol Lewandowski Date: Wed, 17 Jul 2019 11:29:15 +0000 (+0200) Subject: tests: Add crash-manager dbus notify system test X-Git-Tag: accepted/tizen/unified/20190725.112358~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2dd4fd9e0022e4ec0b06c8248c8bf4c7a60a7ba3;p=platform%2Fcore%2Fsystem%2Fcrash-worker.git tests: Add crash-manager dbus notify system test Change-Id: I3e3c4669df4dd36edecd02c2fb245f455b76b4c5 --- diff --git a/packaging/crash-worker_system-tests.spec b/packaging/crash-worker_system-tests.spec index b082f56..2caa93e 100644 --- a/packaging/crash-worker_system-tests.spec +++ b/packaging/crash-worker_system-tests.spec @@ -59,6 +59,7 @@ cd tests/system %{_libdir}/crash-worker_system-tests/cmp_backtraces/cp.sh %{_libdir}/crash-worker_system-tests/crash_root_path/crash_root_path.sh %{_libdir}/crash-worker_system-tests/critical_process/critical_process.sh +%{_libdir}/crash-worker_system-tests/dbus_notify/dbus_notify.sh %{_libdir}/crash-worker_system-tests/dump_systemstate_extras/dump_systemstate_extras.sh %{_libdir}/crash-worker_system-tests/extra_script/extra_script.sh %{_libdir}/crash-worker_system-tests/info_file/info_file.sh diff --git a/tests/system/CMakeLists.txt b/tests/system/CMakeLists.txt index da31257..7db25e2 100644 --- a/tests/system/CMakeLists.txt +++ b/tests/system/CMakeLists.txt @@ -38,6 +38,7 @@ configure_test("log_dump_crash_root_path") configure_test("dump_systemstate_extras") configure_test("livedumper") configure_test("extra_script") +configure_test("dbus_notify") get_property(TESTS_LIST GLOBAL PROPERTY TMP_TESTS_LIST) diff --git a/tests/system/dbus_notify/dbus_notify.sh.template b/tests/system/dbus_notify/dbus_notify.sh.template new file mode 100644 index 0000000..c7e7349 --- /dev/null +++ b/tests/system/dbus_notify/dbus_notify.sh.template @@ -0,0 +1,75 @@ +#!/bin/bash + +# Check the report type change in the config file + +if [ -z "${CRASH_WORKER_SYSTEM_TESTS}" ]; then + CRASH_WORKER_SYSTEM_TESTS="@CRASH_SYSTEM_TESTS_PATH@" +fi + +. ${CRASH_WORKER_SYSTEM_TESTS}/utils/minicore-utils.sh + +# We are looking for following signal - example for `sleep` command: +# +# signal time=1420079847.594970 sender=:1.82 -> destination=(null destination) serial=2 path=/Org/Tizen/System/Crash/Crash; interface=org.tizen.system.crash.Crash; member=ProcessCrashed +# string "sleep" +# string "/usr/bin/sleep" +# string "sleep" +# string "sleep" +# string "/opt/usr/share/crash/dump//sleep_2782_20150101113723.zip" +# int32 2782 +# int32 2782 +# array [ +# dict entry( +# string "arm.pc" +# variant uint32 3069275660 +# ) +# dict entry( +# string "arm.lr" +# variant uint32 3070220008 +# ) +# ] + +( ${CRASH_WORKER_SYSTEM_TESTS}/utils/kenny & + pid=$! + sleep 2 + kill -6 $pid ) & + +TMPFILE=$(mktemp /tmp/dbus_notify.XXXXXX) +dbus-monitor --system type=signal,path=/Org/Tizen/System/Crash/Crash,interface=org.tizen.system.crash.Crash,member=ProcessCrashed > $TMPFILE & +monpid=$! + +cleanup() +{ + kill $monpid + rm -f $TMPFILE +} + +trap cleanup 0 + +sleep 3 + +PATTERN='path=/Org/Tizen/System/Crash/Crash; interface=org\.tizen\.system\.crash\.Crash; member=ProcessCrashed' +for i in $(seq 1 10); do + score=0 + if egrep "$PATTERN" $TMPFILE; then + if egrep "string \"kenny" $TMPFILE; then + score=$(($score + 1)) + fi + + if egrep "string \"/opt/usr/share/crash/dump.*kenny" $TMPFILE; then + score=$(($score + 1)) + fi + + if egrep "string \"${CRASH_WORKER_SYSTEM_TESTS}/utils/kenny" $TMPFILE; then + score=$(($score + 1)) + fi + + if [ $score -eq 3 ]; then + exit_with_code "SUCCESS" ${SUCCESS_CODE} + fi + fi + + sleep 1 +done + +exit_with_code "FAIL: dbus signal does not match" ${FAIL_CODE}