fstests: do not call _scratch_mkfs_sized in a pipe

_scratch_mkfs_sized will create a filesystem of the given size, and
call _notrun and exit if current $FSTYP doesn't support sized mkfs.
But when it's called in a pipe, the exit in _notrun only exits from
the subshell created by the pipe not the test itself, and test
continues to run unnecessarily, though the test is still reported as
[notrun] due to existence of $seqres.notrun file.

Fix it by not calling _scratch_mkfs_sized in a pipe, but dumping the
output to a tmp file, which will be fed to _filter_mkfs later.

Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
Eryu Guan
2017-11-05 14:14:11 +08:00
parent 8fd019ba7a
commit 32a8ebcbe6
2 changed files with 4 additions and 3 deletions
+2 -2
View File
@@ -58,8 +58,8 @@ _scratch_mkfs 2> /dev/null | _filter_mkfs 2> $tmp.mkfs > /dev/null
[ $FSTYP = "xfs" ] && MKFS_OPTIONS="$MKFS_OPTIONS -l size=16m -i maxpct=50"
SIZE=`expr 115 \* 1024 \* 1024`
_scratch_mkfs_sized $SIZE $dbsize 2> /dev/null \
| _filter_mkfs 2> $tmp.mkfs > /dev/null
_scratch_mkfs_sized $SIZE $dbsize 2> /dev/null > $tmp.mkfs.raw
cat $tmp.mkfs.raw | _filter_mkfs 2> $tmp.mkfs > /dev/null
_scratch_mount
# Source $tmp.mkfs to get geometry
+2 -1
View File
@@ -74,7 +74,8 @@ _scratch_unmount
rm -f $seqres.full
_scratch_mkfs_sized $((16 * 1024 * 1024)) | _filter_mkfs >$seqres.full 2>$tmp.mkfs
_scratch_mkfs_sized $((16 * 1024 * 1024)) > $tmp.mkfs.raw
cat $tmp.mkfs.raw | _filter_mkfs >$seqres.full 2>$tmp.mkfs
# get original data blocks number and agcount
. $tmp.mkfs
_scratch_mount