From 43e48cbebd9084c5599e6f9f312465cbc212458c Mon Sep 17 00:00:00 2001 From: Frank Ueberschar Date: Fri, 7 Feb 2020 10:38:40 +0100 Subject: [PATCH] systemtests: rename filenames used for messages output files - rename filenames - add a environment variable for the logfile path --- core/src/tests/messages.cc | 13 ++++++++----- systemtests/environment.in | 2 +- systemtests/tests/messages-test/testrunner | 12 ++++++------ 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/core/src/tests/messages.cc b/core/src/tests/messages.cc index 7ecda19e284..718d974bfa4 100644 --- a/core/src/tests/messages.cc +++ b/core/src/tests/messages.cc @@ -97,19 +97,22 @@ TEST(messages, send_message_to_all_configured_destinations) { std::string config_dir = getenv_std_string("BAREOS_CONFIG_DIR"); std::string working_dir = getenv_std_string("BAREOS_WORKING_DIR"); + std::string log_dir = getenv_std_string("BAREOS_LOG_DIR"); std::string backend_dir = getenv_std_string("backenddir"); - std::string regress_debug = getenv_std_string("REGRESS_DEBUG"); - ASSERT_FALSE(working_dir.empty()); ASSERT_FALSE(config_dir.empty()); + ASSERT_FALSE(working_dir.empty()); + ASSERT_FALSE(log_dir.empty()); ASSERT_FALSE(backend_dir.empty()); + std::string regress_debug = getenv_std_string("REGRESS_DEBUG"); + if (!regress_debug.empty()) { if (regress_debug == "1") { debug_level = 200; } } SetWorkingDirectory(working_dir.c_str()); - InitConsoleMsg(working_dir.c_str()); + InitConsoleMsg(log_dir.c_str()); RegisterSyslogCallback(SyslogCallback_); SetDbLogInsertCallback(DbLogInsertCallback_); @@ -130,8 +133,8 @@ TEST(messages, send_message_to_all_configured_destinations) LogFiles cleanup_files; - syslog_file = LogFiles::Open(working_dir, "syslog.txt"); - db_log_file = LogFiles::Open(working_dir, "dblog.txt"); + syslog_file = LogFiles::Open(log_dir, "syslog"); + db_log_file = LogFiles::Open(log_dir, "dblog"); ASSERT_NE(syslog_file, nullptr); ASSERT_NE(db_log_file, nullptr); diff --git a/systemtests/environment.in b/systemtests/environment.in index 83695a43a39..29a04b87a8c 100644 --- a/systemtests/environment.in +++ b/systemtests/environment.in @@ -12,7 +12,6 @@ current_test_directory=${PROJECT_BINARY_DIR}/tests/@TEST_NAME@ conf=${current_test_directory}/etc/bareos export confdir=${conf} configs=${conf} -BAREOS_CONFIG_DIR=${conf} export config_directory_dir_additional_test_config=@config_directory_dir_additional_test_config@ @@ -44,6 +43,7 @@ export fd_password=@fd_password@ # exported variables used by start/stop and other bareos scripts # to override the defaults export BAREOS_CONFIG_DIR=${conf} +export BAREOS_LOG_DIR=${logdir} export BAREOS_SCRIPTS_DIR=${scripts} export BAREOS_SBIN_DIR=${sbin} export BAREOS_WORKING_DIR=${working} diff --git a/systemtests/tests/messages-test/testrunner b/systemtests/tests/messages-test/testrunner index a3cc6e21cb5..273d94fddda 100755 --- a/systemtests/tests/messages-test/testrunner +++ b/systemtests/tests/messages-test/testrunner @@ -12,12 +12,12 @@ export TestName #shellcheck source=../scripts/functions . "${rscripts}"/functions -console_messages_file="${working}"/.conmsg -syslog_file="${working}"/syslog.txt -dblog_file="${working}"/dblog.txt -stdout_file="${working}"/stdout.txt -stderr_file="${working}"/stderr.txt -extra_append_file="${logdir}"/bareos.log +console_messages_file="${BAREOS_LOG_DIR}"/.conmsg +syslog_file="${BAREOS_LOG_DIR}"/syslog +dblog_file="${BAREOS_LOG_DIR}"/dblog +stdout_file="${BAREOS_LOG_DIR}"/stdout +stderr_file="${BAREOS_LOG_DIR}"/stderr +extra_append_file="${BAREOS_LOG_DIR}"/bareos.log rm -f "$console_messages_file" rm -f "$syslog_file"