public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Lukas Czerner <lczerner@redhat.com>
To: xfs@oss.sgi.com
Cc: Lukas Czerner <lczerner@redhat.com>,
	fdmanana@gmail.com, linux-btrfs@vger.kernel.org
Subject: [PATCH 1/3] xfstests: Fix SCRATCH_DEV_POOL handling
Date: Tue,  8 Apr 2014 17:42:48 +0200	[thread overview]
Message-ID: <1396971770-23553-1-git-send-email-lczerner@redhat.com> (raw)
In-Reply-To: <20140404211224.GX17603@dastard>

With changes introduced in 667308dd97bf41382d4ab299fa5b56c235cfeb27
it is no longer possible to use SCRATCH_DEV_POOL variable because of
error:

 common/config: Error: $SCRATCH_DEV should be unset when
 $SCRATCH_DEV_POOL is set

This was because get_next_config() would get called twice and hence it
would complain on the second run that SCRATCH_DEV is already set. Fix
it by making sure that we call get_next_config() only once if there
are no sections in the config file.

Also make sure that we export SCRATCH_DEV in the case we're deducing it
from SCRATCH_DEV_POOL.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reported-by: Filipe David Manana <fdmanana@gmail.com>
---
 common/config | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/common/config b/common/config
index 4178c27..6fa18e2 100644
--- a/common/config
+++ b/common/config
@@ -360,6 +360,10 @@ parse_config_section() {
 }
 
 get_next_config() {
+	if [ ! -z "$CONFIG_INCLUDED" ] && ! $OPTIONS_HAVE_SECTIONS; then
+		return 0
+	fi
+
 	local OLD_FSTYP=$FSTYP
 	local OLD_MOUNT_OPTIONS=$MOUNT_OPTIONS
 	local OLD_MKFS_OPTIONS=$MKFS_OPTIONS
@@ -414,10 +418,11 @@ get_next_config() {
 	# to SCRATCH_DEV and rest to SCRATCH_DEV_POOL to maintain the backward compatibility
 	if [ ! -z "$SCRATCH_DEV_POOL" ]; then
 		if [ ! -z "$SCRATCH_DEV" ]; then
-			echo "common/config: Error: \$SCRATCH_DEV should be unset when \$SCRATCH_DEV_POOL is set"
+			echo "common/config: Error: \$SCRATCH_DEV ($SCRATCH_DEV) should be unset when \$SCRATCH_DEV_POOL ($SCRATCH_DEV_POOL) is set"
 			exit 1
 		fi
 		SCRATCH_DEV=`echo $SCRATCH_DEV_POOL | awk '{print $1}'`
+		export SCRATCH_DEV
 	fi
 
 	echo $SCRATCH_DEV | grep -q ":" > /dev/null 2>&1
-- 
1.8.3.1

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  parent reply	other threads:[~2014-04-08 15:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-04  9:03 [ANNOUNCE] xfstests: updated to cf1ed54 Dave Chinner
2014-04-04 13:07 ` Filipe David Manana
2014-04-04 21:12   ` Dave Chinner
2014-04-08 10:07     ` Lukáš Czerner
2014-04-08 15:42     ` Lukas Czerner [this message]
2014-04-08 15:42       ` [PATCH 2/3] xfstests: Unset SCRATCH_DEV when deduced from SCRATCH_DEV_POOL Lukas Czerner
2014-04-08 16:52         ` Filipe David Manana
2014-04-08 15:42       ` [PATCH 3/3] xfstests: Fix setting FSTYP automatically Lukas Czerner
2014-04-08 16:52         ` Filipe David Manana
2014-04-08 16:51       ` [PATCH 1/3] xfstests: Fix SCRATCH_DEV_POOL handling Filipe David Manana
2014-04-08  0:14   ` [ANNOUNCE] xfstests: updated to cf1ed54 Dave Chinner
2014-04-08 15:16     ` Filipe David Manana

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1396971770-23553-1-git-send-email-lczerner@redhat.com \
    --to=lczerner@redhat.com \
    --cc=fdmanana@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox