Whamcloud - gitweb
LU-9474 tests: add the stack_trap() utility function 71/30371/2
authorQuentin Bouget <quentin.bouget@cea.fr>
Tue, 17 Oct 2017 19:14:41 +0000 (19:14 +0000)
committerJohn L. Hammond <john.hammond@intel.com>
Tue, 19 Dec 2017 20:10:55 +0000 (20:10 +0000)
commiteb9c7a25c8d62e549d1c41df0bf047bc2b1d63b4
tree9bbcd3e9cef0aaab1a101084e526868adca3f25d
parent009c986bb5e7fea309ebce1427437d7bbceedc6f
LU-9474 tests: add the stack_trap() utility function

This patch implements the stack_trap() function and uses it in
test_24d of sanity-hsm (where the need for it first arose).

The stack_trap() function is meant to be used to register multiple
cleanup actions on a single sigspec (most likely EXIT). Over time,
any call to bash's trap builtin in tests should be replaced by a call
to stack_trap().

Note that cleanup functions do not need to start with "trap - EXIT".
Each test is run in a subshell of its own (in run_one_logged()) and
therefore traps do not leak from one test to another. This is true
with or without this patch.

This is a port to b2_10 of
Lustre change: https://review.whamcloud.com/#/c/29653/
Lustre commit: 1dfda720c080e39890e5a659a30c8988ca498a7c

Test-Parameters: trivial testlist=sanity-hsm,sanity-hsm
Change-Id: I47f92a963f094d3d7055592a748e81ce357bff75
Signed-off-by: Quentin Bouget <quentin.bouget@cea.fr>
Reviewed-on: https://review.whamcloud.com/29653
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Dominique Martinet <dominique.martinet@cea.fr>
Reviewed-by: James Nunez <james.a.nunez@intel.com>
(cherry picked from commit 1dfda720c080e39890e5a659a30c8988ca498a7c)
Reviewed-on: https://review.whamcloud.com/30371
Reviewed-by: Saurabh Tandan <saurabh.tandan@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
lustre/tests/sanity-hsm.sh
lustre/tests/test-framework.sh