mirror of
https://github.com/samba-team/samba.git
synced 2025-02-03 13:47:25 +03:00
ctdb-tests: Add test cleanup hooks
To do any cleanup before exiting the test, register hooks with test_cleanup(). Multiple hooks can be registered. All the hooks will be called before exiting from the test. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
This commit is contained in:
parent
2290e7a01e
commit
aa9ca809be
@ -46,7 +46,7 @@ ctdb_set_output ()
|
||||
_rc="$ONNODE_TESTS_VAR_DIR/ctdb.rc"
|
||||
echo "${1:-0}" >"$_rc"
|
||||
|
||||
trap "rm -f $_out $_rc" 0
|
||||
test_cleanup "rm -f $_out $_rc"
|
||||
}
|
||||
|
||||
extra_footer ()
|
||||
|
@ -209,6 +209,15 @@ script_test ()
|
||||
result_check || exit $?
|
||||
}
|
||||
|
||||
test_cleanup_hooks=""
|
||||
|
||||
test_cleanup ()
|
||||
{
|
||||
test_cleanup_hooks="${test_cleanup_hooks}${test_cleanup_hooks:+ ; }$*"
|
||||
}
|
||||
|
||||
trap 'eval $test_cleanup_hooks' 0
|
||||
|
||||
local="${TEST_SUBDIR}/scripts/local.sh"
|
||||
if [ -r "$local" ] ; then
|
||||
. "$local"
|
||||
|
Loading…
x
Reference in New Issue
Block a user