mirror of
https://github.com/samba-team/samba.git
synced 2025-01-15 23:24:37 +03:00
ctdb-tests: Extend eventscript unit test infrastructure for other scripts
There's so much infrastructure here that it would be a shame not to use it for testing things like statd-callout. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
parent
9317d82c19
commit
7e7c24ca7a
@ -993,19 +993,32 @@ define_test ()
|
||||
# Remaining format should be NN.service.event.NNN or NN.service.NNN:
|
||||
_num="${_f##*.}"
|
||||
_f="${_f%.*}"
|
||||
|
||||
case "$_f" in
|
||||
*.*.*)
|
||||
[0-9][0-9].*.*)
|
||||
script="${_f%.*}"
|
||||
event="${_f##*.}"
|
||||
script_dir="${CTDB_BASE}/events.d"
|
||||
;;
|
||||
*.*)
|
||||
[0-9][0-9].*)
|
||||
script="$_f"
|
||||
unset event
|
||||
script_dir="${CTDB_BASE}/events.d"
|
||||
;;
|
||||
*.*)
|
||||
script="${_f%.*}"
|
||||
event="${_f##*.}"
|
||||
script_dir="${CTDB_BASE}"
|
||||
;;
|
||||
*)
|
||||
die "Internal error - unknown testcase filename format"
|
||||
script="${_f%.*}"
|
||||
unset event
|
||||
script_dir="${CTDB_BASE}"
|
||||
esac
|
||||
|
||||
[ -x "${script_dir}/${script}" ] || \
|
||||
die "Internal error - unable to find script \"${script_dir}/${script}\""
|
||||
|
||||
printf "%-17s %-10s %-4s - %s\n\n" "$script" "$event" "$_num" "$desc"
|
||||
}
|
||||
|
||||
@ -1030,14 +1043,14 @@ simple_test ()
|
||||
|
||||
_extra_header=$(_extra_header)
|
||||
|
||||
echo "Running eventscript \"$script $event${1:+ }$*\""
|
||||
echo "Running script \"$script $event${1:+ }$*\""
|
||||
_shell=""
|
||||
if $TEST_COMMAND_TRACE ; then
|
||||
_shell="sh -x"
|
||||
else
|
||||
_shell="sh"
|
||||
fi
|
||||
_out=$($_shell "${CTDB_BASE}/events.d/$script" "$event" "$@" 2>&1)
|
||||
_out=$($_shell "${script_dir}/${script}" "$event" "$@" 2>&1)
|
||||
|
||||
result_check "$_extra_header"
|
||||
}
|
||||
@ -1123,7 +1136,7 @@ iterate_test ()
|
||||
else
|
||||
_shell="sh"
|
||||
fi
|
||||
_out=$($_shell "${CTDB_BASE}/events.d/$script" "$event" $args 2>&1)
|
||||
_out=$($_shell "${script_dir}/${script}" "$event" $args 2>&1)
|
||||
_rc=$?
|
||||
|
||||
_fout=$(echo "$_out" | result_filter)
|
||||
|
Loading…
x
Reference in New Issue
Block a user