-
Notifications
You must be signed in to change notification settings - Fork 256
/
testrunner
executable file
·64 lines (52 loc) · 1.48 KB
/
testrunner
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/sh
#
# This test runs the messages unittest
# to examine all message directions
#
# The director direction is not tested
# here because all other tests use it
#
TestName="$(basename "$(pwd)")"
export TestName
#shellcheck source=../environment.in
. ./environment
#shellcheck source=../scripts/functions
. "${rscripts}"/functions
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}"/append
mail_file="${BAREOS_LOG_DIR}"/mail
operator_file="${BAREOS_LOG_DIR}"/operator
rm -f "$console_messages_file"
rm -f "$syslog_file"
rm -f "$dblog_file"
rm -f "$stdout_file"
rm -f "$stderr_file"
rm -f "$extra_append_file"
rm -f "$mail_file"
rm -f "$operator_file"
function exit_error() {
[ "$1" == "" ] || echo "$1"
estat=1
end_test
exit 1
}
function check_output_file {
[ -f "$1" ] || exit_error "$1 does not exist"
if ! grep --quiet "!!!This is a test error message!!!" "$1"; then
exit_error "\"$1\" does not contain the expected text"
fi
}
start_test
${BAREOS_UNITTESTS_BINARY_DIR}/messages_resource > "$stdout_file" 2> "$stderr_file" || exit_error
check_output_file "$console_messages_file"
check_output_file "$syslog_file"
check_output_file "$dblog_file"
check_output_file "$stdout_file"
check_output_file "$extra_append_file"
check_output_file "$mail_file"
check_output_file "$operator_file"
end_test