diff mbox

[2/3] xfstests: Unset SCRATCH_DEV when deduced from SCRATCH_DEV_POOL

Message ID 1396971770-23553-2-git-send-email-lczerner@redhat.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Lukas Czerner April 8, 2014, 3:42 p.m. UTC
In the case that we already have sections in the config file we
have to make sure that we unset SCRATCH_DEV if it has been deduced from
the SCRATCH_DEV_POOL so that it does not complain about SCRATCH_DEV in
this case.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
---
 common/config | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Filipe Manana April 8, 2014, 4:52 p.m. UTC | #1
On Tue, Apr 8, 2014 at 4:42 PM, Lukas Czerner <lczerner@redhat.com> wrote:
> In the case that we already have sections in the config file we
> have to make sure that we unset SCRATCH_DEV if it has been deduced from
> the SCRATCH_DEV_POOL so that it does not complain about SCRATCH_DEV in
> this case.
>
> Signed-off-by: Lukas Czerner <lczerner@redhat.com>

Tested-by: Filipe David Manana <fdmanana@gmail.com>

Tests working for btrfs now.
Thanks Lukas.

> ---
>  common/config | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/common/config b/common/config
> index 6fa18e2..3163801 100644
> --- a/common/config
> +++ b/common/config
> @@ -372,10 +372,15 @@ get_next_config() {
>         unset MOUNT_OPTIONS
>         unset MKFS_OPTIONS
>         unset FSCK_OPTIONS
> +       # We might have deduced SCRATCH_DEV from the SCRATCH_DEV_POOL in the previous
> +       # run, so we have to unset it now.
> +       if [ "$SCRATCH_DEV_NOT_SET" == "true" ]; then
> +               unset SCRATCH_DEV
> +       fi
>
>         parse_config_section $1
>
> -       if [ -n "$OLD_FSTYP" ] && [ $OLD_FSTYP != $FSTYP ]; then
> +       if [ ! -z "$OLD_FSTYP" ] && [ $OLD_FSTYP != $FSTYP ]; then
>                 [ -z "$MOUNT_OPTIONS" ] && _mount_opts
>                 [ -z "$MKFS_OPTIONS" ] && _mkfs_opts
>                 [ -z "$FSCK_OPTIONS" ] && _fsck_opts
> @@ -423,6 +428,7 @@ get_next_config() {
>                 fi
>                 SCRATCH_DEV=`echo $SCRATCH_DEV_POOL | awk '{print $1}'`
>                 export SCRATCH_DEV
> +               export SCRATCH_DEV_NOT_SET=true
>         fi
>
>         echo $SCRATCH_DEV | grep -q ":" > /dev/null 2>&1
> --
> 1.8.3.1
>
diff mbox

Patch

diff --git a/common/config b/common/config
index 6fa18e2..3163801 100644
--- a/common/config
+++ b/common/config
@@ -372,10 +372,15 @@  get_next_config() {
 	unset MOUNT_OPTIONS
 	unset MKFS_OPTIONS
 	unset FSCK_OPTIONS
+	# We might have deduced SCRATCH_DEV from the SCRATCH_DEV_POOL in the previous
+	# run, so we have to unset it now.
+	if [ "$SCRATCH_DEV_NOT_SET" == "true" ]; then
+		unset SCRATCH_DEV
+	fi
 
 	parse_config_section $1
 
-	if [ -n "$OLD_FSTYP" ] && [ $OLD_FSTYP != $FSTYP ]; then
+	if [ ! -z "$OLD_FSTYP" ] && [ $OLD_FSTYP != $FSTYP ]; then
 		[ -z "$MOUNT_OPTIONS" ] && _mount_opts
 		[ -z "$MKFS_OPTIONS" ] && _mkfs_opts
 		[ -z "$FSCK_OPTIONS" ] && _fsck_opts
@@ -423,6 +428,7 @@  get_next_config() {
 		fi
 		SCRATCH_DEV=`echo $SCRATCH_DEV_POOL | awk '{print $1}'`
 		export SCRATCH_DEV
+		export SCRATCH_DEV_NOT_SET=true
 	fi
 
 	echo $SCRATCH_DEV | grep -q ":" > /dev/null 2>&1