check: Allow to recreate TEST_DEV

Add config option RECREATE_TEST_DEV to allow to recreate file system on
the TEST_DEV device. Permitted values are true and false.

If RECREATE_TEST_DEV is set to true the TEST_DEV device will be
unmounted and FSTYP file system will be created on it. Afterwards it
will be mounted to TEST_DIR again with the default, or specified mount
options.

Also recreate the file system if FSTYP differs from the previous
section.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
Lukas Czerner
2014-04-04 17:18:15 +11:00
committed by Dave Chinner
parent 667308dd97
commit f8e4f532f1
4 changed files with 189 additions and 19 deletions
+20 -6
View File
@@ -168,12 +168,6 @@ _fsck_opts()
esac
}
[ -z "$FSTYP" ] && FSTYP=xfs
[ -z "$MOUNT_OPTIONS" ] && _mount_opts
[ -z "$MKFS_OPTIONS" ] && _mkfs_opts
[ -z "$FSCK_OPTIONS" ] && _fsck_opts
# we need common/config
if [ "$iam" != "check" ]
then
@@ -536,6 +530,7 @@ _setup_large_ext4_fs()
fi
return 0
}
_scratch_mkfs_ext4()
{
local tmp_dir=/tmp/
@@ -564,6 +559,24 @@ _scratch_mkfs_ext4()
return $mkfs_status
}
_test_mkfs()
{
case $FSTYP in
nfs*)
# do nothing for nfs
;;
udf)
$MKFS_UDF_PROG $MKFS_OPTIONS $* $TEST_DEV > /dev/null
;;
btrfs)
$MKFS_BTRFS_PROG $MKFS_OPTIONS $* $TEST_DEV > /dev/null
;;
*)
yes | $MKFS_PROG -t $FSTYP -- $MKFS_OPTIONS $* $TEST_DEV
;;
esac
}
_scratch_mkfs()
{
case $FSTYP in
@@ -998,6 +1011,7 @@ _supported_fs()
_notrun "not suitable for this filesystem type: $FSTYP"
}
# tests whether $FSTYP is one of the supported OSes for a test
#
_supported_os()