Whamcloud - gitweb
LU-13147 tests: Cleanup sanity-lnet on test failure 58/37258/4
authorChris Horn <hornc@cray.com>
Thu, 16 Jan 2020 19:31:47 +0000 (13:31 -0600)
committerOleg Drokin <green@whamcloud.com>
Tue, 28 Jan 2020 06:02:39 +0000 (06:02 +0000)
Trap EXIT so we can cleanup on test failure.

Test-Parameters: trivial testlist=sanity-lnet
Signed-off-by: Chris Horn <hornc@cray.com>
Change-Id: I702b214046a68af2b87536dab01879c356bff2a8
Reviewed-on: https://review.whamcloud.com/37258
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/sanity-lnet.sh

index bd8de8f..a1a3b08 100755 (executable)
@@ -48,6 +48,7 @@ if module_loaded lnet ; then
 fi
 
 cleanup_testsuite() {
+       trap "" EXIT
        rm -f $TMP/sanity-dlc*
        cleanup_netns
        cleanup_lnet
@@ -223,6 +224,8 @@ validate_gateway_nids() {
 cleanupall -f
 setup_netns || error "setup_netns failed with $?"
 
+stack_trap 'cleanup_testsuite' EXIT
+
 test_0() {
        load_module ../lnet/lnet/lnet || error "Failed to load module rc = $?"
        do_lnetctl lnet configure || error "lnet configure failed rc = $?"