It is not good practice to directly use MKFS_PROG. Signed-off-by: Dmitry Monakhov <dmonakhov@xxxxxxxxxx> --- common/rc | 28 ++++++++++++++++++++++++++++ tests/btrfs/020 | 4 ++-- tests/shared/298 | 4 ++-- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/common/rc b/common/rc index 16da898..84fef35 100644 --- a/common/rc +++ b/common/rc @@ -509,6 +509,34 @@ _test_mkfs() esac } +_mkfs_dev() +{ + case $FSTYP in + nfs*) + # do nothing for nfs + ;; + udf) + $MKFS_UDF_PROG $MKFS_OPTIONS $* 2>$tmp_dir.mkfserr 1>$tmp_dir.mkfsstd + ;; + btrfs) + $MKFS_BTRFS_PROG $MKFS_OPTIONS $* 2>$tmp_dir.mkfserr 1>$tmp_dir.mkfsstd + ;; + *) + yes | $MKFS_PROG -t $FSTYP -- $MKFS_OPTIONS $* \ + 2>$tmp_dir.mkfserr 1>$tmp_dir.mkfsstd + ;; + esac + + if [ $? -ne 0 ]; then + # output stored mkfs output + cat $tmp_dir.mkfserr >&2 + cat $tmp_dir.mkfsstd + status=1 + exit 1 + fi + rm -f $tmp_dir.mkfserr $tmp_dir.mkfsstd +} + _scratch_mkfs() { case $FSTYP in diff --git a/tests/btrfs/020 b/tests/btrfs/020 index 5a928dd..84251f3 100755 --- a/tests/btrfs/020 +++ b/tests/btrfs/020 @@ -73,8 +73,8 @@ loop_dev1=`_create_loop_device $fs_img1` loop_dev2=`_create_loop_device $fs_img2` loop_dev3=`_create_loop_device $fs_img3` -$MKFS_BTRFS_PROG -m raid1 -d raid1 $loop_dev1 $loop_dev2 >>$seqres.full 2>&1 -$MOUNT_PROG -o ro $loop_dev1 $loop_mnt +_mkfs_dev -m raid1 -d raid1 $loop_dev1 $loop_dev2 >>$seqres.full 2>&1 +_mount -o ro $loop_dev1 $loop_mnt # Fail the second device and replace with the third _destroy_loop_device $loop_dev2 diff --git a/tests/shared/298 b/tests/shared/298 index 372fd02..2b7fdd1 100755 --- a/tests/shared/298 +++ b/tests/shared/298 @@ -134,8 +134,8 @@ mkdir $loop_mnt [ "$FSTYP" = "xfs" ] && MKFS_OPTIONS="-f $MKFS_OPTIONS" -$MKFS_PROG -t $FSTYP $MKFS_OPTIONS $loop_dev &> /dev/null -$MOUNT_PROG $loop_dev $loop_mnt +_mkfs_dev $loop_dev +_mount $loop_dev $loop_mnt echo -n "Generating garbage on loop..." # Goal is to fill it up, ignore any errors. -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html