-
Notifications
You must be signed in to change notification settings - Fork 256
/
testrunner
executable file
·55 lines (44 loc) · 1.21 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
#!/bin/sh
#
# Run a simple backup
# then restore 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}"/bareos.log
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"
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 an error message" "$1"; then
exit_error "\"$1\" does not contain the expected text"
fi
}
start_test
${BAREOS_UNITTESTS_BINARY_DIR}/messages > "$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 "$stderr_file"
check_output_file "$extra_append_file"
end_test