From: Karol Lewandowski Date: Tue, 26 Feb 2019 13:18:38 +0000 (+0100) Subject: system tests: add basic crash report sanity test X-Git-Tag: submit/tizen/20190301.131043~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a4134d7b169fe706259cc93291f98a0595607457;p=platform%2Fcore%2Fsystem%2Fcrash-worker.git system tests: add basic crash report sanity test Change-Id: I2fbe5f35a7a1cb7d93a3bf895ffd4cec1f6d0c6f --- diff --git a/packaging/crash-worker_system-tests.spec b/packaging/crash-worker_system-tests.spec index 79ef265..2ffd162 100644 --- a/packaging/crash-worker_system-tests.spec +++ b/packaging/crash-worker_system-tests.spec @@ -64,6 +64,7 @@ cd tests/system %{_libdir}/crash-worker_system-tests/log_dump_short/log_dump_short.sh %{_libdir}/crash-worker_system-tests/log_file/log_file.sh %{_libdir}/crash-worker_system-tests/so_info_file/so_info_file.sh +%{_libdir}/crash-worker_system-tests/report_basic/report_basic.sh %{_libdir}/crash-worker_system-tests/report_type_info/report_type_info.sh %{_libdir}/crash-worker_system-tests/without_core/without_core.sh %{_libdir}/crash-worker_system-tests/crash_root_path/crash_root_path.sh diff --git a/tests/system/CMakeLists.txt b/tests/system/CMakeLists.txt index cd1bbdd..9e1b977 100644 --- a/tests/system/CMakeLists.txt +++ b/tests/system/CMakeLists.txt @@ -29,6 +29,7 @@ configure_test("wait_for_opt_usr") configure_test("info_file") configure_test("log_file") configure_test("so_info_file") +configure_test("report_basic") configure_test("report_type_info") configure_test("without_core") configure_test("crash_root_path") diff --git a/tests/system/report_basic/report_basic.sh.template b/tests/system/report_basic/report_basic.sh.template new file mode 100644 index 0000000..ff3ee1a --- /dev/null +++ b/tests/system/report_basic/report_basic.sh.template @@ -0,0 +1,40 @@ +#!/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 + +CRASH_MANAGER_CONF=/etc/crash-manager.conf + +clean_crash_dump +clean_temp + +sleep 777 & +sleep 2 +kill -6 $! + +wait_for_app crash-manager + +pushd ${CRASH_DUMP_PATH} +name=$(echo *) +name=${name%.zip} + +test -f ${name}.zip || exit_with_code "FAIL: crash report not found" 1 +unzip ${name}.zip || exit_with_code "FAIL: unable to extract archive" 1 + +# assumes default configuration - with coredump +test -s ${name}/${name}.coredump.tar || test -f ${name}/${name}.coredump || exit_with_code "FAIL: coredump corrupt or not found" 1 + +test -s ${name}/${name}.log || exit_with_code "FAIL: log corrupt or not found" 1 +test -s ${name}/${name}.so_info || exit_with_code "FAIL: info corrupt or not found" 1 +test -s ${name}/${name}.info || exit_with_code "FAIL: info corrupt or not found" 1 + +for i in ${CRASH_TEMP_PATH}/*; do + test -a "${i}" && exit_with_code "FAIL: temp directory not cleaned up" 1 +done + +exit_with_code "SUCCESS" 0 diff --git a/tests/system/utils/minicore-utils.sh b/tests/system/utils/minicore-utils.sh index a00e277..7100150 100644 --- a/tests/system/utils/minicore-utils.sh +++ b/tests/system/utils/minicore-utils.sh @@ -94,6 +94,19 @@ function clean_logdump { fi } +function clean_temp { + + export CRASH_TEMP_PATH=`tzplatform_var TZ_SYS_CRASH_ROOT`/temp + + if [ "x${CRASH_TEMP_PATH}" = 'x/temp' ]; then + exit_with_code "Couldn't get TZ_SYS_CRASH_ROOT" 1 + fi + + if [ -d ${CRASH_TEMP_PATH} ]; then + rm -rf ${CRASH_TEMP_PATH}/* + fi +} + function wait_for_file { TIMEOUT=240 while [ ! -f ${1} ];