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
+27 -6
View File
@@ -283,8 +283,6 @@ if $have_test_arg; then
done
fi
_prepare_test_list
# we need common/rc
if ! . ./common/rc
then
@@ -386,6 +384,8 @@ _summary()
rm -f $tmp.*
}
_prepare_test_list
if $OPTIONS_HAVE_SECTIONS; then
trap "_summary; exit \$status" 0 1 2 3 15
else
@@ -393,8 +393,8 @@ else
fi
for section in $HOST_OPTIONS_SECTIONS; do
OLD_FSTYP=$FSTYP
get_next_config $section
init_rc
mkdir -p $RESULT_BASE
if [ ! -d $RESULT_BASE ]; then
@@ -402,6 +402,30 @@ for section in $HOST_OPTIONS_SECTIONS; do
exit 1;
fi
if $OPTIONS_HAVE_SECTIONS; then
echo "SECTION -- $section"
fi
if $RECREATE_TEST_DEV || [ "$OLD_FSTYP" != "$FSTYP" ]; then
echo "RECREATING -- $FSTYP on $TEST_DEV"
umount $TEST_DEV 2> /dev/null
if ! _test_mkfs >$tmp.err 2>&1
then
echo "our local _test_mkfs routine ..."
cat $tmp.err
echo "check: failed to mkfs \$TEST_DEV using specified options"
exit 1
fi
out=`_mount_or_remount_rw "$MOUNT_OPTIONS" $TEST_DEV $TEST_DIR`
if [ $? -ne 1 ]; then
echo $out
exit 1
fi
_prepare_test_list
fi
init_rc
seq="check"
check="$RESULT_BASE/check"
@@ -411,9 +435,6 @@ for section in $HOST_OPTIONS_SECTIONS; do
[ -f $check.time ] || touch $check.time
# print out our test configuration
if $OPTIONS_HAVE_SECTIONS; then
echo "SECTION -- $section"
fi
echo "FSTYP -- `_full_fstyp_details`"
echo "PLATFORM -- `_full_platform_details`"
if [ ! -z "$SCRATCH_DEV" ]; then