Skip to content

Commit

Permalink
systemtests: rename filenames used for messages output files
Browse files Browse the repository at this point in the history
- rename filenames
- add a environment variable for the logfile path
  • Loading branch information
franku committed Feb 10, 2020
1 parent ffbf368 commit 43e48cb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
13 changes: 8 additions & 5 deletions core/src/tests/messages.cc
Expand Up @@ -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_);

Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion systemtests/environment.in
Expand Up @@ -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@

Expand Down Expand Up @@ -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}
Expand Down
12 changes: 6 additions & 6 deletions systemtests/tests/messages-test/testrunner
Expand Up @@ -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"
Expand Down

0 comments on commit 43e48cb

Please sign in to comment.