All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/6] common: add _mkfs_dev helper
@ 2014-08-16 13:13 Dmitry Monakhov
  2014-08-16 13:13 ` [PATCH 2/6] common: _scratch_mkfs_sized should inherent default block size from test_dev Dmitry Monakhov
                   ` (4 more replies)
  0 siblings, 5 replies; 17+ messages in thread
From: Dmitry Monakhov @ 2014-08-16 13:13 UTC (permalink / raw)
  To: fstests; +Cc: david, Dmitry Monakhov

It is not good practice to directly use MKFS_PROG.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 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


^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2014-09-08 12:21 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-16 13:13 [PATCH 1/6] common: add _mkfs_dev helper Dmitry Monakhov
2014-08-16 13:13 ` [PATCH 2/6] common: _scratch_mkfs_sized should inherent default block size from test_dev Dmitry Monakhov
2014-08-20 23:14   ` Dave Chinner
2014-08-21  7:36     ` Dmitry Monakhov
2014-08-21  9:23       ` Dave Chinner
2014-08-21 14:01         ` Theodore Ts'o
2014-08-21 20:44           ` Dave Chinner
2014-08-22 13:24         ` Dmitry Monakhov
2014-08-22 15:09           ` Theodore Ts'o
2014-08-22 15:48             ` Dmitry Monakhov
2014-08-22 16:37               ` Theodore Ts'o
2014-08-23  0:31                 ` Dave Chinner
2014-08-16 13:13 ` [PATCH 3/6] src/e4compact cleanup Dmitry Monakhov
2014-08-16 13:13 ` [PATCH 4/6] src/e4compact: handle various block_size correctly Dmitry Monakhov
2014-08-16 13:13 ` [PATCH 5/6] src/e4compact: add sparse file optimization Dmitry Monakhov
2014-08-16 13:13 ` [PATCH 6/6] ext4/308: add new defrag compact test case Dmitry Monakhov
2014-09-08 12:21   ` Dave Chinner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.