diff options
author | Amitay Isaacs <amitay@gmail.com> | 2015-07-06 15:14:53 +1000 |
---|---|---|
committer | Martin Schwenke <martins@samba.org> | 2015-07-09 06:23:21 +0200 |
commit | aa9ca809bebb17136e05817bc4c89c208424f52f (patch) | |
tree | be6cd606f3a90ebbbc385d290d1eaa7bc3205e5c /ctdb/tests/scripts | |
parent | 2290e7a01e606f3fe695301ffee846de9a28dd7f (diff) | |
download | samba-aa9ca809bebb17136e05817bc4c89c208424f52f.tar.gz |
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>
Diffstat (limited to 'ctdb/tests/scripts')
-rw-r--r-- | ctdb/tests/scripts/unit.sh | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ctdb/tests/scripts/unit.sh b/ctdb/tests/scripts/unit.sh index e9a04e1433f..f52ef2c7efe 100644 --- a/ctdb/tests/scripts/unit.sh +++ b/ctdb/tests/scripts/unit.sh @@ -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" |