Skip to contentSkip to conversation

xfs: fix check of whether the mkfs fail

PATCH In review Sun Ke 2 participants 3 messages May 28, 2021 – May 29, 2021

lore
Share & tools
lore

Sun Ke

author
#0 lore raw

PATCH 1/1 xfs: fix check of whether the mkfs fail

The return value ("$?") is always the status of the last command in the pipe.

---
 tests/xfs/070 | 3 ++-
 tests/xfs/448 | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
tests/xfs/070 +2 -1
index 8249c5c01cfd..9ef1e786a0a5 100755
@@ -84,7 +84,8 @@ _supported_fs xfs
 _require_scratch_nocheck
 _require_command "$KILLALL_PROG" killall
 
-_scratch_mkfs | _filter_mkfs > /dev/null 2> $tmp.mkfs || _fail "mkfs failed"
+_scratch_mkfs | _filter_mkfs > /dev/null 2> $tmp.mkfs
+test "${PIPESTATUS[0]}" -eq 0 || _fail "mkfs failed"
 
 . $tmp.mkfs # import agcount
 
tests/xfs/448 +2 -1
index 493d303e62cf..a11698fa2d8c 100755
@@ -47,7 +47,8 @@ _require_no_xfs_bug_on_assert
 rm -f "$seqres.full"
 
 # Format and mount
-_scratch_mkfs | _filter_mkfs > $seqres.full 2> $tmp.mkfs || _fail "mkfs failed"
+_scratch_mkfs | _filter_mkfs > $seqres.full 2> $tmp.mkfs
+test "${PIPESTATUS[0]}" -eq 0 || _fail "mkfs failed"
 _scratch_mount
 
 # Get directory block size
Signature · 1 line
2.25.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Sun Ke

The return value ("$?") is always the status of the last command in the pipe.

Heh, whooops. Thanks for fixing this!

--D

Quoted 36 lines
---
 tests/xfs/070 | 3 ++-
 tests/xfs/448 | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
tests/xfs/070 +2 -1
index 8249c5c01cfd..9ef1e786a0a5 100755
@@ -84,7 +84,8 @@ _supported_fs xfs
 _require_scratch_nocheck
 _require_command "$KILLALL_PROG" killall
 
-_scratch_mkfs | _filter_mkfs > /dev/null 2> $tmp.mkfs || _fail "mkfs failed"
+_scratch_mkfs | _filter_mkfs > /dev/null 2> $tmp.mkfs
+test "${PIPESTATUS[0]}" -eq 0 || _fail "mkfs failed"
 
 . $tmp.mkfs # import agcount
 
tests/xfs/448 +2 -1
index 493d303e62cf..a11698fa2d8c 100755
@@ -47,7 +47,8 @@ _require_no_xfs_bug_on_assert
 rm -f "$seqres.full"
 
 # Format and mount
-_scratch_mkfs | _filter_mkfs > $seqres.full 2> $tmp.mkfs || _fail "mkfs failed"
+_scratch_mkfs | _filter_mkfs > $seqres.full 2> $tmp.mkfs
+test "${PIPESTATUS[0]}" -eq 0 || _fail "mkfs failed"
 _scratch_mount
 
 # Get directory block size
Signature · 1 line
2.25.4