summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarol Lewandowski <k.lewandowsk@samsung.com>2019-02-21 15:36:45 (GMT)
committerKarol Lewandowski <k.lewandowsk@samsung.com>2019-02-21 15:45:25 (GMT)
commitb4ac921ba4195de646fd08abdf6572a9f14e7cab (patch)
treef351c45f7fcc8c430631105acbcaafa949eaf9cb
parent1f8f39b96c0f388392ab4e7a393c46e0e387384c (diff)
downloadcrash-worker-sandbox/klewandowski/system-tests-logdump.zip
crash-worker-sandbox/klewandowski/system-tests-logdump.tar.gz
crash-worker-sandbox/klewandowski/system-tests-logdump.tar.bz2
system tests: add basic log_dump testssandbox/klewandowski/system-tests-logdump
Change-Id: Ibcbf680ba2b4c105d66c9f0c93acf6aaababe375
-rw-r--r--packaging/crash-worker_system-tests.spec1
-rw-r--r--tests/system/CMakeLists.txt1
-rw-r--r--tests/system/log_dump_short/log_dump_short.sh.template37
-rw-r--r--tests/system/utils/minicore-utils.sh16
4 files changed, 55 insertions, 0 deletions
diff --git a/packaging/crash-worker_system-tests.spec b/packaging/crash-worker_system-tests.spec
index efbee08..c8395bb 100644
--- a/packaging/crash-worker_system-tests.spec
+++ b/packaging/crash-worker_system-tests.spec
@@ -58,6 +58,7 @@ cd tests/system
%{_libdir}/crash-worker_system-tests/time_test/cp.sh
%{_libdir}/crash-worker_system-tests/wait_for_opt_usr/wait_for_opt_usr.sh
%{_libdir}/crash-worker_system-tests/info_file/info_file.sh
+%{_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_type_info/report_type_info.sh
diff --git a/tests/system/CMakeLists.txt b/tests/system/CMakeLists.txt
index 384a729..e6b4b1b 100644
--- a/tests/system/CMakeLists.txt
+++ b/tests/system/CMakeLists.txt
@@ -28,6 +28,7 @@ configure_test("so_info_file")
configure_test("report_type_info")
configure_test("without_core")
configure_test("crash_root_path")
+configure_test("log_dump_short")
configure_file("run.sh.template" "run.sh" @ONLY)
INSTALL(FILES run.sh DESTINATION ${CRASH_SYSTEM_TESTS_PATH})
diff --git a/tests/system/log_dump_short/log_dump_short.sh.template b/tests/system/log_dump_short/log_dump_short.sh.template
new file mode 100644
index 0000000..0a69a4f
--- /dev/null
+++ b/tests/system/log_dump_short/log_dump_short.sh.template
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+# Custom report path test
+
+if [ -z "${CRASH_WORKER_SYSTEM_TESTS}" ]; then
+ CRASH_WORKER_SYSTEM_TESTS="@CRASH_SYSTEM_TESTS_PATH@"
+fi
+
+. ${CRASH_WORKER_SYSTEM_TESTS}/utils/minicore-utils.sh
+
+function check_file_exists {
+ if [ ! -f ${NEW_PATH}/dump/kenny*/kenny*.${1} ]; then
+ exit_with_code "FAIL: no ${1} file in report" 1
+ fi
+}
+
+clean_logdump
+
+log_dump --short
+logfile="${LOGDUMP_RESULT_PATH}"/* # there shall be only one file
+
+if [ ! -f "$logfile" ]; then
+ exit_with_code "FAIL: 'log_dump --short' report not created" 1
+fi
+
+num=`unzip -l "$logfile" | wc -l`
+if [ $num -ne 2 ]; then
+ exit_with_code "FAIL: 'log_dump --short' report contains $num files - 2 expected" 1
+fi
+
+if ! `unzip -l "$logfile" | grep -E 'log/dump_systemstate*log'`; then
+ exit_with_code "FAIL: 'log_dump --short' report does not contain dump_systemstate*log" 1
+fi
+
+clean_logdump
+
+exit_with_code "SUCCESS" 0
diff --git a/tests/system/utils/minicore-utils.sh b/tests/system/utils/minicore-utils.sh
index 40b6006..b0eb584 100644
--- a/tests/system/utils/minicore-utils.sh
+++ b/tests/system/utils/minicore-utils.sh
@@ -58,6 +58,22 @@ function clean_crash_dump {
rm -rf ${CRASH_DUMP_PATH}/*
}
+function clean_logdump {
+
+ export LOGDUMP_RESULT_PATH=`tzplatform_var TZ_SYS_CRASH_ROOT/debug`
+
+ killall log_dump
+ sleep 1
+
+ if [ ${LOGDUMP_RESULT_PATH} = "/debug" ]; then
+ exit_with_code "Couldn't get TZ_SYS_CRASH_ROOT" 1
+ fi
+
+ if [ ! -d ${LOGDUMP_RESULT_PATH} ]; then
+ exit_with_code "${LOGDUMP_RESULT_PATH} does not exist" 1
+ fi
+
+ rm -rf ${LOGDUMP_RESULT_PATH}/*
}
function wait_for_file {