%{_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_dump_crash_root_path/log_dump_crash_root_path.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
dbus-handler.c
${CMAKE_SOURCE_DIR}/src/shared/util.c
${CMAKE_SOURCE_DIR}/src/shared/spawn.c
+ ${CMAKE_SOURCE_DIR}/src/shared/config.c
)
INCLUDE(FindPkgConfig)
dlog
capi-system-info
libtzplatform-config
+ iniparser
gio-2.0
)
#include <system_info.h>
#include <tzplatform_config.h>
-#include "log_dump.h"
+#include "defs.h"
#include "dbus-handler.h"
+#include "log_dump.h"
+#include "shared/config.h"
#include "shared/spawn.h"
#include "shared/util.h"
{ 0, 0, 0, 0 }
};
+/* crash worker configuration - for admin-selectable CrashRootPath */
+config_t config;
/* tzplaform vars */
char *dir_scripts;
/* dynamic vars */
static char *crash_root_get(void)
{
- return strdup(tzplatform_getenv(TZ_SYS_CRASH_ROOT));
+ return config.crash_root_path;
}
static bool init_vars(const char *crash_root)
int c, ret;
int option;
+ if (!config_init(&config, CRASH_MANAGER_CONFIG_PATH))
+ return false;
+
/* need to do this first, because even usage() uses the vars */
if (!init_vars(crash_root_get())) {
printf("Unable to initialize - please check program logs");
else
ret = log_dump(option);
+ config_free(&config);
+
return ret < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
}
configure_test("crash_root_path")
configure_test("log_dump_short")
configure_test("log_dump_normal")
+configure_test("log_dump_crash_root_path")
get_property(TESTS_LIST GLOBAL PROPERTY TMP_TESTS_LIST)
--- /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
+
+tmpdir=$(mktemp -d /tmp/logdump-crash-root-path-test.XXXXXX)
+
+CRASH_MANAGER_CONF=/etc/crash-manager.conf
+mount -o rw,remount /
+backup_file ${CRASH_MANAGER_CONF}
+sed -ie 's,^CrashRootPath=.*,,g' ${CRASH_MANAGER_CONF}
+echo "CrashRootPath=$tmpdir" >> ${CRASH_MANAGER_CONF}
+
+log_dump --short
+logfile="${tmpdir}"/debug/* # 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
+
+restore_file ${CRASH_MANAGER_CONF}
+
+exit_with_code "SUCCESS" 0