diff mbox series

[02/13] misc: move exit status into trap handler

Message ID 162317277320.653489.6399691950820962617.stgit@locust (mailing list archive)
State New, archived
Headers show
Series fstests: move test group lists into test files | expand

Commit Message

Darrick J. Wong June 8, 2021, 5:19 p.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

Move the "exit $status" clause of the _cleanup function into the
argument to the "trap" command so that we can standardize the
registration of the atexit cleanup code in the next few patches.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 tests/generic/068 |    3 +--
 tests/xfs/004     |    3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

Comments

Chandan Babu R June 10, 2021, 8:43 a.m. UTC | #1
On 08 Jun 2021 at 22:49, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> Move the "exit $status" clause of the _cleanup function into the
> argument to the "trap" command so that we can standardize the
> registration of the atexit cleanup code in the next few patches.
>

Grep on all the test files revealed that only generic/068 and xfs/004 invoked
"exit $status" inside the _cleanup() function. Hence the changes look good to
me.

Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>

> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>  tests/generic/068 |    3 +--
>  tests/xfs/004     |    3 +--
>  2 files changed, 2 insertions(+), 4 deletions(-)
>
>
> diff --git a/tests/generic/068 b/tests/generic/068
> index 932a8560..573fbd45 100755
> --- a/tests/generic/068
> +++ b/tests/generic/068
> @@ -22,10 +22,9 @@ _cleanup()
>      cd /
>  
>      trap 0 1 2 3 15
> -    exit $status
>  }
>  
> -trap "_cleanup" 0 1 2 3 15
> +trap "_cleanup; exit \$status" 0 1 2 3 15
>  
>  # get standard environment, filters and checks
>  . ./common/rc
> diff --git a/tests/xfs/004 b/tests/xfs/004
> index d3fb9c95..4d92a08e 100755
> --- a/tests/xfs/004
> +++ b/tests/xfs/004
> @@ -18,9 +18,8 @@ _cleanup()
>  {
>  	_scratch_unmount
>  	rm -f $tmp.*
> -	exit $status
>  }
> -trap "_cleanup" 0 1 2 3 15
> +trap "_cleanup; exit \$status" 0 1 2 3 15
>  
>  _populate_scratch()
>  {
Allison Henderson June 11, 2021, 9:55 p.m. UTC | #2
On 6/8/21 10:19 AM, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Move the "exit $status" clause of the _cleanup function into the
> argument to the "trap" command so that we can standardize the
> registration of the atexit cleanup code in the next few patches.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Ok, looks ok
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
> ---
>   tests/generic/068 |    3 +--
>   tests/xfs/004     |    3 +--
>   2 files changed, 2 insertions(+), 4 deletions(-)
> 
> 
> diff --git a/tests/generic/068 b/tests/generic/068
> index 932a8560..573fbd45 100755
> --- a/tests/generic/068
> +++ b/tests/generic/068
> @@ -22,10 +22,9 @@ _cleanup()
>       cd /
>   
>       trap 0 1 2 3 15
> -    exit $status
>   }
>   
> -trap "_cleanup" 0 1 2 3 15
> +trap "_cleanup; exit \$status" 0 1 2 3 15
>   
>   # get standard environment, filters and checks
>   . ./common/rc
> diff --git a/tests/xfs/004 b/tests/xfs/004
> index d3fb9c95..4d92a08e 100755
> --- a/tests/xfs/004
> +++ b/tests/xfs/004
> @@ -18,9 +18,8 @@ _cleanup()
>   {
>   	_scratch_unmount
>   	rm -f $tmp.*
> -	exit $status
>   }
> -trap "_cleanup" 0 1 2 3 15
> +trap "_cleanup; exit \$status" 0 1 2 3 15
>   
>   _populate_scratch()
>   {
>
diff mbox series

Patch

diff --git a/tests/generic/068 b/tests/generic/068
index 932a8560..573fbd45 100755
--- a/tests/generic/068
+++ b/tests/generic/068
@@ -22,10 +22,9 @@  _cleanup()
     cd /
 
     trap 0 1 2 3 15
-    exit $status
 }
 
-trap "_cleanup" 0 1 2 3 15
+trap "_cleanup; exit \$status" 0 1 2 3 15
 
 # get standard environment, filters and checks
 . ./common/rc
diff --git a/tests/xfs/004 b/tests/xfs/004
index d3fb9c95..4d92a08e 100755
--- a/tests/xfs/004
+++ b/tests/xfs/004
@@ -18,9 +18,8 @@  _cleanup()
 {
 	_scratch_unmount
 	rm -f $tmp.*
-	exit $status
 }
-trap "_cleanup" 0 1 2 3 15
+trap "_cleanup; exit \$status" 0 1 2 3 15
 
 _populate_scratch()
 {