From 04855b7ed2b919bdb4d685ade3434c3884cfe9f0 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 10 Jan 2023 21:29:20 +0000 Subject: [PATCH] Break out on-failure Signed-off-by: Ian Jackson --- adt/acommon | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/adt/acommon b/adt/acommon index 1baf9e1..6568235 100644 --- a/adt/acommon +++ b/adt/acommon @@ -8,6 +8,15 @@ set -x . "${0%/*}"/../test/tcommon +on_failure=: + +trap ' + rc=$? + : =================== ^^ TEST FAILURE ^^ ==================== + $on_failure + exit $rc +' 0 + test-prep () { determine-tname adt @@ -183,13 +192,7 @@ in- () { setup-pair () { test-prep - trap ' - rc=$? - : =================== ^^ TEST FAILURE ^^ ==================== - host-cleanup client - host-cleanup server - exit $rc - ' 0 + on_failure=host-cleanup $test/netns-setup $tname setup-host client setup-host server -- 2.30.2