Whamcloud - gitweb
LU-9474 tests: add the stack_trap() utility function 53/29653/4
authorQuentin Bouget <quentin.bouget@cea.fr>
Tue, 17 Oct 2017 19:14:41 +0000 (19:14 +0000)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 22 Nov 2017 03:55:50 +0000 (03:55 +0000)
commit1dfda720c080e39890e5a659a30c8988ca498a7c
tree4338e647e5921d3e0e1b7f9edc30a4ec44ee95f2
parent6ee90b7586d58b0df27a511472e38792baba4745
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.

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>
lustre/tests/sanity-hsm.sh
lustre/tests/test-framework.sh