Whamcloud - gitweb
LU-12760 tests: stack_trap defaults to sigspec=EXIT 86/36186/2
authorAndreas Dilger <adilger@whamcloud.com>
Sat, 14 Sep 2019 07:46:44 +0000 (01:46 -0600)
committerOleg Drokin <green@whamcloud.com>
Wed, 9 Oct 2019 22:35:44 +0000 (22:35 +0000)
If the "sigspec" argument is not specified for stack_trap(), default
to "EXIT" as the signal, since this is what we use for all callers
of stack_trap() today anyway.

Test-Parameters: trivial
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I2c8d986cdf8743e1d956cd7941a47bd4cd772592
Reviewed-on: https://review.whamcloud.com/36186
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: James Nunez <jnunez@whamcloud.com>
Reviewed-by: Li Xi <lixi@ddn.com>
lustre/tests/test-framework.sh

index 17274af..31e7ec3 100755 (executable)
@@ -6063,7 +6063,7 @@ report_error() {
 # usage: stack_trap arg sigspec
 #
 # stack_trap() behaves like bash's built-in trap, except that it "stacks" the
 # usage: stack_trap arg sigspec
 #
 # stack_trap() behaves like bash's built-in trap, except that it "stacks" the
-# command ``arg`` on top of previously defined commands for ``sigspec`` instead
+# command "arg" on top of previously defined commands for "sigspec" instead
 # of overwriting them.
 # stacked traps are executed in reverse order of their registration
 #
 # of overwriting them.
 # stacked traps are executed in reverse order of their registration
 #
@@ -6071,7 +6071,7 @@ report_error() {
 stack_trap()
 {
        local arg="$1"
 stack_trap()
 {
        local arg="$1"
-       local sigspec="$2"
+       local sigspec="${2:-EXIT}"
 
        # Use "trap -p" to get the quoting right
        local old_trap="$(trap -p "$sigspec")"
 
        # Use "trap -p" to get the quoting right
        local old_trap="$(trap -p "$sigspec")"