system tests: add basic crash report sanity test 60/200560/2
authorKarol Lewandowski <k.lewandowsk@samsung.com>
Tue, 26 Feb 2019 13:18:38 +0000 (14:18 +0100)
committerKarol Lewandowski <k.lewandowsk@samsung.com>
Wed, 27 Feb 2019 11:24:24 +0000 (12:24 +0100)
Change-Id: I2fbe5f35a7a1cb7d93a3bf895ffd4cec1f6d0c6f

packaging/crash-worker_system-tests.spec
tests/system/CMakeLists.txt
tests/system/report_basic/report_basic.sh.template [new file with mode: 0644]
tests/system/utils/minicore-utils.sh

index 79ef265..2ffd162 100644 (file)
@@ -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
index cd1bbdd..9e1b977 100644 (file)
@@ -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 (file)
index 0000000..ff3ee1a
--- /dev/null
@@ -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
index a00e277..7100150 100644 (file)
@@ -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} ];