Requires: coreutils
Requires: tlm
Requires: /bin/bash
+Requires: /usr/bin/unzip
Requires: crash-worker
Requires: %{_sbindir}/minicoredumper
%{_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_normal/log_dump_normal.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
configure_test("report_type_info")
configure_test("without_core")
configure_test("crash_root_path")
+configure_test("log_dump_short")
+configure_test("log_dump_normal")
configure_file("run.sh.template" "run.sh" @ONLY)
INSTALL(FILES run.sh DESTINATION ${CRASH_SYSTEM_TESTS_PATH})
--- /dev/null
+#!/bin/bash
+
+# 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
+
+clean_logdump
+dummy="$CRASH_DUMP_DIR/logdump-short-test"
+touch "$dummy"
+
+log_dump --normal
+logfile="${LOGDUMP_RESULT_PATH}"/* # there shall be only one file
+
+check_file_exists "$logfile"
+check_zip_contains "$logfile" 'log/dump_systemstate.*log$'
+check_zip_contains "$logfile" 'log/system_log/$'
+check_zip_contains "$logfile" 'log/system_log/dlog/kernel$'
+check_zip_contains "$logfile" 'log/module_log/$'
+check_zip_contains "$logfile" 'dump/$'
+
+check_file_not_exists "$dummy"
+
+clean_logdump
+
+exit_with_code "SUCCESS" 0
--- /dev/null
+#!/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
+
+clean_logdump
+
+dummy="$CRASH_DUMP_DIR/logdump-short-test"
+touch "$dummy"
+
+log_dump --short
+logfile="${LOGDUMP_RESULT_PATH}"/* # there shall be only one file
+
+check_file_exists "$logfile"
+
+num=`unzip -qql "$logfile" | wc -l`
+if [ $num -ne 2 ]; then
+ exit_with_code "FAIL: 'log_dump --short' report contains $num files - 2 expected" 1
+fi
+
+check_zip_contains "$logfile" 'log/dump_systemstate.*log$'
+check_zip_contains "$logfile" 'log/$'
+
+check_file_not_exists "$dummy"
+
+clean_logdump
+
+exit_with_code "SUCCESS" 0
TESTS=("check_minicore_mem" "cmp_backtraces" "info_file" "log_file"
"report_type_info" "critical_process" "time_test" "wait_for_opt_usr"
- "so_info_file" "without_core" "crash_root_path")
+ "so_info_file" "without_core" "crash_root_path" "log_dump_short"
+ "log_dump_normal")
if [ -z "${CRASH_SYSTEM_TESTS_PATH}" ]; then
CRASH_SYSTEM_TESTS_PATH="@CRASH_SYSTEM_TESTS_PATH@"
exit_with_code "FAIL: not found ${1} in ${RESULT}" 1
}
+function check_file_exists {
+ if [ ! -f ${1} ]; then
+ exit_with_code "FAIL: file not exists $1" 1
+ fi
+}
+
+function check_file_not_exists {
+ if [ -f ${1} ]; then
+ exit_with_code "FAIL: file exists $1" 1
+ fi
+}
+
+function check_zip_contains {
+ zipfile=${1}
+ pattern="$2"
+ if ! unzip -qql "$logfile" | grep -E "$pattern"; then
+ exit_with_code "FAIL: zip file ${zipfile} does not contain ${pattern}" 1
+ fi
+}
+
function tzplatform_var {
VAL=`tzplatform-get ${1}`
if [ $? == 0 ]; then
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 [ "x${LOGDUMP_RESULT_PATH}" = 'x/debug' ]; then
+ exit_with_code "Couldn't get TZ_SYS_CRASH_ROOT" 1
+ fi
+
+ if [ -d ${LOGDUMP_RESULT_PATH} ]; then
+ rm -rf ${LOGDUMP_RESULT_PATH}/*
+ fi
+}
+
function wait_for_file {
TIMEOUT=240
while [ ! -f ${1} ];