# Hey Emacs, this is a -*- shell-script -*- !!! :-) . "${TEST_SCRIPTS_DIR}/common.sh" # Common variables and functions for CTDB unit tests. # Set the required result for a test. # - Argument 1 is exit code. # - Argument 2, if present is the required test output but "--" # indicates empty output. # If argument 2 is not present or null then read required test output # from stdin. required_result () { required_rc="${1:-0}" if [ -n "$2" ] ; then if [ "$2" = "--" ] ; then required_output="" else required_output="$2" fi else if ! tty -s ; then required_output=$(cat) else required_output="" fi fi } ok () { required_result 0 "$@" } ok_null () { ok -- } result_print () { _passed="$1" _out="$2" _rc="$3" _extra_header="$4" if "$TEST_VERBOSE" || ! $_passed ; then if [ -n "$_extra_header" ] ; then cat <"$_outr" _outf=$(mktemp) echo "$_fout" >"$_outf" cat <