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: lczerner@redhat.com
Subject: [PATCH 04/10 v2] xfstests: Allow to recheck options in common/rc
Date: Thu, 11 Jul 2013 12:37:59 +0200	[thread overview]
Message-ID: <1373539085-8577-5-git-send-email-lczerner@redhat.com> (raw)
In-Reply-To: <1373539085-8577-1-git-send-email-lczerner@redhat.com>

Move configuration checks into separate function to allow us to recheck
the options without the need to reinclude the whole source file which is
ugly. We still run the check on include.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
---
 common/rc | 74 ++++++++++++++++++++++++++++++++-------------------------------
 1 file changed, 38 insertions(+), 36 deletions(-)

diff --git a/common/rc b/common/rc
index fe6bbfc..0dd30a3 100644
--- a/common/rc
+++ b/common/rc
@@ -2131,46 +2131,48 @@ run_check()
 	"$@" >> $seqres.full 2>&1 || _fail "failed: '$@'"
 }
 
-################################################################################
-
-if [ "$iam" != new ]
-then
-    # make some further configuration checks here
-
-    if [ "$TEST_DEV" = ""  ]
-    then
-        echo "common/rc: Error: \$TEST_DEV is not set"
-        exit 1
-    fi
-
-    # if $TEST_DEV is not mounted, mount it now as XFS
-    if [ -z "`_fs_type $TEST_DEV`" ]
-    then
-        # $TEST_DEV is not mounted
-        if ! _test_mount
-        then
-            echo "common/rc: retrying test device mount with external set"
-            [ "$USE_EXTERNAL" != "yes" ] && export USE_EXTERNAL=yes
-            if ! _test_mount
-            then
-                echo "common/rc: could not mount $TEST_DEV on $TEST_DIR"
-                exit 1
-            fi
-        fi
-    fi
+init_rc()
+{
+	if [ "$iam" == new ]
+	then
+		return
+	fi
+	# make some further configuration checks here
+	if [ "$TEST_DEV" = ""  ]
+	then
+		echo "common/rc: Error: \$TEST_DEV is not set"
+		exit 1
+	fi
 
-    if [ "`_fs_type $TEST_DEV`" != "$FSTYP" ]
-    then
-        echo "common/rc: Error: \$TEST_DEV ($TEST_DEV) is not a MOUNTED $FSTYP filesystem"
-        $DF_PROG $TEST_DEV
-        exit 1
-    fi
+	# if $TEST_DEV is not mounted, mount it now as XFS
+	if [ -z "`_fs_type $TEST_DEV`" ]
+	then
+		# $TEST_DEV is not mounted
+		if ! _test_mount
+		then
+			echo "common/rc: retrying test device mount with external set"
+			[ "$USE_EXTERNAL" != "yes" ] && export USE_EXTERNAL=yes
+			if ! _test_mount
+			then
+				echo "common/rc: could not mount $TEST_DEV on $TEST_DIR"
+				exit 1
+			fi
+		fi
+	fi
 
-    # Figure out if we need to add -F ("foreign", deprecated) option to xfs_io
-    xfs_io -c stat $TEST_DIR 2>&1 | grep -q "is not on an XFS filesystem" && \
+	if [ "`_fs_type $TEST_DEV`" != "$FSTYP" ]
+	then
+		echo "common/rc: Error: \$TEST_DEV ($TEST_DEV) is not a MOUNTED $FSTYP filesystem"
+		$DF_PROG $TEST_DEV
+		exit 1
+	fi
+	# Figure out if we need to add -F ("foreign", deprecated) option to xfs_io
+	xfs_io -c stat $TEST_DIR 2>&1 | grep -q "is not on an XFS filesystem" && \
 	export XFS_IO_PROG="$XFS_IO_PROG -F"
+}
 
-fi
+init_rc
 
+################################################################################
 # make sure this script returns success
 /bin/true
-- 
1.8.3.1

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

  parent reply	other threads:[~2013-07-11 10:38 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-11 10:37 [RFC][PATCH 00/10 v2] xfstests: Add support for config section Lukas Czerner
2013-07-11 10:37 ` [PATCH 01/10 v2] xfstests: Run all tests when nothing is specified Lukas Czerner
2013-08-02 23:48   ` Chandra Seetharaman
2013-10-16 19:36   ` Rich Johnston
2013-07-11 10:37 ` [PATCH 02/10 v2] xfstests: Export all important variables in common/config Lukas Czerner
2013-08-02 23:49   ` Chandra Seetharaman
2013-07-11 10:37 ` [PATCH 03/10 v2] xfstests: Refactor code for obtaining test list Lukas Czerner
2013-08-02 23:49   ` Chandra Seetharaman
2013-07-11 10:37 ` Lukas Czerner [this message]
2013-08-02 23:50   ` [PATCH 04/10 v2] xfstests: Allow to recheck options in common/rc Chandra Seetharaman
2013-07-11 10:38 ` [PATCH 05/10 v2] xfstests: Allow to re-read configuration Lukas Czerner
2013-08-02 23:51   ` Chandra Seetharaman
2013-07-11 10:38 ` [PATCH 06/10 v2] xfstests: Allow to specify RESULT_BASE directory Lukas Czerner
2013-08-02 23:51   ` Chandra Seetharaman
2013-07-11 10:38 ` [PATCH 07/10 v2] xfstests: Prepare for config section Lukas Czerner
2013-08-02 23:53   ` Chandra Seetharaman
2013-07-11 10:38 ` [PATCH 08/10 v2] xfstests: Add support for sections in config file Lukas Czerner
2013-08-03  0:05   ` Chandra Seetharaman
2013-07-11 10:38 ` [PATCH 09/10 v2] xfstests: Allow to recreate TEST_DEV Lukas Czerner
2013-08-03  0:13   ` Chandra Seetharaman
2013-07-11 10:38 ` [PATCH 10/10 v2] xfstests: Remount file system if MOUNT_OPTIONS changed Lukas Czerner
2013-08-03  0:14   ` Chandra Seetharaman
2013-10-16 20:51   ` Rich Johnston
2013-10-17 10:49     ` [PATCH 10/10 v2] xfstests: Remount file system if MOUNT_OPTIONS changedx Lukáš Czerner
2013-08-16 15:43 ` [RFC][PATCH 00/10 v2] xfstests: Add support for config section Rich Johnston

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=1373539085-8577-5-git-send-email-lczerner@redhat.com \
    --to=lczerner@redhat.com \
    --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