1 # Hey Emacs, this is a -*- shell-script -*- !!! :-)
3 .
"${TEST_SCRIPTS_DIR}/common.sh"
5 # Common variables and functions for CTDB unit tests.
7 # Set the required result for a test.
8 # - Argument 1 is exit code.
9 # - Argument 2, if present is the required test output but "--"
10 # indicates empty output.
11 # If argument 2 is not present or null then read required test output
17 if [ "$2" = "--" ] ; then
24 required_output
=$
(cat)
33 required_result
0 "$@"
48 if "$TEST_VERBOSE" ||
! $_passed ; then
49 if [ -n "$_extra_header" ] ; then
52 ##################################################
58 --------------------------------------------------
59 Output (Exit status: ${_rc}):
60 --------------------------------------------------
62 echo "$_out" |
cat $TEST_CAT_RESULTS_OPTS
67 --------------------------------------------------
68 Required output (Exit status: ${required_rc}):
69 --------------------------------------------------
71 echo "$required_output" |
cat $TEST_CAT_RESULTS_OPTS
73 if $TEST_DIFF_RESULTS ; then
75 echo "$required_output" >"$_outr"
78 echo "$_fout" >"$_outf"
81 --------------------------------------------------
83 --------------------------------------------------
85 diff -u "$_outr" "$_outf" |
cat -A
96 if "$TEST_VERBOSE" ||
! $_passed ; then
97 if [ -n "$_extra_footer" ] ; then
99 --------------------------------------------------
101 --------------------------------------------------
122 if [ -n "$OUT_FILTER" ] ; then
123 _fout
=$
(echo "$_out" |
eval sed -r $OUT_FILTER)
128 if [ "$_fout" = "$required_output" -a $_rc = $required_rc ] ; then
134 result_print
"$_passed" "$_out" "$_rc" "$_extra_header"
135 result_footer
"$_passed"
138 local="${TEST_SUBDIR}/scripts/local.sh"
139 if [ -r "$local" ] ; then