Skip to contentSkip to conversation

xfstests: Add support for config section

RFC PATCH In review Lukas Czerner 3 participants 25 messages Jul 11, 2013 – Oct 17, 2013

lore
Share & tools
lore
#0 lore raw

v2 cover xfstests: Add support for config section

This patch set adds support for sections in the configuration file while maintaining unchanged behaviour when no sections are present in the configuration file, or no configuration file is provided.

V2: Recreate test list when FSTYP changed between sections

Explanation, syntax and example follows.

Configuration file with sections
================================

Configuration file with sections is useful for running xfstests on multiple file systems, or multiple file system setups in a single run without any help of external scripts.

Syntax
------

Syntax for defining a section is the following:

[section_name]

Section name should consist of alphanumeric characters and '_'. Anything else is forbidden and the section will not be recognised.

Each section in the configuration file should contain options in the format

OPTION=value

'OPTION' must not contain any white space characters. 'value' can contain any character you want with one simple limitation - characters ' and " can only appear at the start and end of the 'value', however it is not required.

Note that options are carried between sections so the same options does not have to be specified in each and every sections. However caution should be exercised not to leave unwanted options set from previous sections.

Results
-------

For every section xfstests will run with specified options and will produce separate results in the '$RESULT_BASE/$section_name' directory.

Different mount options
-----------------------

Specifying different mount options in difference config sections is allowed. When MOUNT_OPTIONS differs in the following section TEST_DEV will be remounted with new MOUNT_OPTIONS automatically before running the test.

Multiple file systems
---------------------

Having different file systems in different config sections is allowed. When FSTYP differs in the following section the FSTYP file system will be created automatically before running the test.

Note that if MOUNT_OPTIONS, MKFS_OPTIONS, or FSCK_OPTIONS are not directly specified in the section it will be reset to the default for a given file system.

You can also force the file system recreation by specifying RECREATE_TEST_DEV.

Example
-------

Here is an example of config file with sections:

[ext4_4k_block_size]
TEST_DEV=/dev/sda
TEST_DIR=/mnt/test
SCRATCH_DEV=/dev/sdb
SCRATCH_MNT=/mnt/test1
MKFS_OPTIONS="-q -F -b4096"
FSTYP=ext4
RESULT_BASE="pwd/results/date +%d%m%y_%H%M%S"

[ext4_1k_block_size]
MKFS_OPTIONS="-q -F -b1024"

[ext4_nojournal]
MKFS_OPTIONS="-q -F -b4096 -O ^has_journal"

[xfs_filesystem]
MKFS_OPTIONS="-f"
FSTYP=xfs

[ext3_filesystem]
FSTYP=ext3
MOUNT_OPTIONS="-o noatime"

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#1 lore raw

PATCH v2 1/10 xfstests: Run all tests when nothing is specified

Currently when no tests or test groups is specified xfstests will silently test nothing. Interestingly enough when test groups to exclude is specified the rest of the tests will be run.

This commit changes that to run all possible tests (for a given file system) when no specific tests has been specified. This matches the old xfstests behaviour.

---
 check | 6 +++---
 group | 5 -----
 2 files changed, 3 insertions(+), 8 deletions(-)
 delete mode 100644 group
check +3 -3
index ff8fbcf..71b179b 100755
@@ -115,7 +115,7 @@ get_all_tests()
 	for d in $SRC_GROUPS $FSTYP; do
 		ls $SRC_DIR/$d/* | \
 			grep -v "\..*" | \
-			grep -v group >> $tmp.list 2>/dev/null
+			grep -v "group\|Makefile" >> $tmp.list 2>/dev/null
 	done
 }
 
@@ -263,8 +263,8 @@ elif $have_test_arg; then
 	# had test numbers, but none in group file ... do nothing
 	touch $tmp.list
 else
-	# no test numbers, do everything from group file
-	sed -n -e '/^[0-9][0-9][0-9]*/s/[ 	].*//p' <group >$tmp.list
+	# no test numbers, do everything
+	get_all_tests
 fi
 
 # sort the list of tests into numeric order
group deleted +0 -5
deleted file mode 100644
index 4e01f0c..0000000
@@ -1,5 +0,0 @@
-# QA groups control file
-# Defines test groups and nominal group owners
-# - do not start group names with a digit
-# - comment line before each group is "new" description
-#
Signature · 6 lines
1.8.3.1

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by on v2 1/10
#2 lore raw

Re: [PATCH 01/10 v2] xfstests: Run all tests when nothing is specified

On Thu, 2013-07-11 at 12:37 +0200, Lukas Czerner wrote:

small nits. Otherwise,

Quoted 1 line

Currently when no tests or test groups is specified xfstests will

s/is/are/

Quoted 2 lines

silently test nothing. Interestingly enough when test groups to exclude is specified the rest of the tests will be run.

s/is/are/

Quoted 42 lines

This commit changes that to run all possible tests (for a given file system) when no specific tests has been specified. This matches the old xfstests behaviour.

---
 check | 6 +++---
 group | 5 -----
 2 files changed, 3 insertions(+), 8 deletions(-)
 delete mode 100644 group
check +3 -3
index ff8fbcf..71b179b 100755
@@ -115,7 +115,7 @@ get_all_tests()
 	for d in $SRC_GROUPS $FSTYP; do
 		ls $SRC_DIR/$d/* | \
 			grep -v "\..*" | \
-			grep -v group >> $tmp.list 2>/dev/null
+			grep -v "group\|Makefile" >> $tmp.list 2>/dev/null
 	done
 }
 
@@ -263,8 +263,8 @@ elif $have_test_arg; then
 	# had test numbers, but none in group file ... do nothing
 	touch $tmp.list
 else
-	# no test numbers, do everything from group file
-	sed -n -e '/^[0-9][0-9][0-9]*/s/[ 	].*//p' <group >$tmp.list
+	# no test numbers, do everything
+	get_all_tests
 fi
 
 # sort the list of tests into numeric order
group deleted +0 -0
deleted file mode 100644
index 4e01f0c..0000000

group line 5

Quoted 5 lines
group deleted +0 -5
@@ -1,5 +0,0 @@
-# QA groups control file
-# Defines test groups and nominal group owners
-# - do not start group names with a digit
-# - comment line before each group is "new" description
-#

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#4 lore raw

PATCH v2 2/10 xfstests: Export all important variables in common/config

In reply to Lukas Czerner

Currently we do not export some of the important variables in common/config. Fix this.

---
 common/config | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
common/config +9 -9
index 67c1498..1679acf 100644
@@ -56,19 +56,19 @@ export LANG=C
 [ -d /usr/freeware/bin ] && PATH=$PATH:/usr/freeware/bin
 PATH=".:$PATH"
 
-HOST=`hostname -s`
-HOSTOS=`uname -s`
-[ "$HOSTOS" = "IRIX64" ] && HOSTOS="IRIX"
+export HOST=`hostname -s`
+export HOSTOS=`uname -s`
+[ "$HOSTOS" = "IRIX64" ] && export HOSTOS="IRIX"
 
-MODULAR=0               # using XFS as a module or not
-BOOT="/boot"            # install target for kernels
+export MODULAR=0               # using XFS as a module or not
+export BOOT="/boot"            # install target for kernels
 export EXTRA=${EXTRA:=xfs-qa}
 
 # general parameters (mainly for auto-qa)
-SOAK_PROC=3             # -p option to fsstress
-SOAK_STRESS=10000       # -n option to fsstress
-SOAK_PASSES=-1          # count of repetitions of fsstress (while soaking)
-EMAIL=root@localhost    # where auto-qa will send its status messages
+export SOAK_PROC=3             # -p option to fsstress
+export SOAK_STRESS=10000       # -n option to fsstress
+export SOAK_PASSES=-1          # count of repetitions of fsstress (while soaking)
+export EMAIL=root@localhost    # where auto-qa will send its status messages
 export HOST_OPTIONS=${HOST_OPTIONS:=local.config}
 export CHECK_OPTIONS=${CHECK_OPTIONS:="-g auto"}
 export BENCH_PASSES=${BENCH_PASSES:=5}
Signature · 6 lines
1.8.3.1

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by on v2 2/10
#5 lore raw

Re: [PATCH 02/10 v2] xfstests: Export all important variables in common/config

Quoted 31 lines · Lukas Czerner

Currently we do not export some of the important variables in common/config. Fix this.

---
 common/config | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
common/config +5 -6
index 67c1498..1679acf 100644
@@ -56,19 +56,19 @@ export LANG=C
 [ -d /usr/freeware/bin ] && PATH=$PATH:/usr/freeware/bin
 PATH=".:$PATH"
 
-HOST=`hostname -s`
-HOSTOS=`uname -s`
-[ "$HOSTOS" = "IRIX64" ] && HOSTOS="IRIX"
+export HOST=`hostname -s`
+export HOSTOS=`uname -s`
+[ "$HOSTOS" = "IRIX64" ] && export HOSTOS="IRIX"
 
-MODULAR=0               # using XFS as a module or not
-BOOT="/boot"            # install target for kernels
+export MODULAR=0               # using XFS as a module or not
+export BOOT="/boot"            # install target for kernels
 export EXTRA=${EXTRA:=xfs-qa}
 
 # general parameters (mainly for auto-qa)
-SOAK_PROC=3             # -p option to fsstress

common/config export LANG=C · line 74

Quoted 10 lines
common/config +4 -3
-SOAK_STRESS=10000       # -n option to fsstress
-SOAK_PASSES=-1          # count of repetitions of fsstress (while soaking)
-EMAIL=root@localhost    # where auto-qa will send its status messages
+export SOAK_PROC=3             # -p option to fsstress
+export SOAK_STRESS=10000       # -n option to fsstress
+export SOAK_PASSES=-1          # count of repetitions of fsstress (while soaking)
+export EMAIL=root@localhost    # where auto-qa will send its status messages
 export HOST_OPTIONS=${HOST_OPTIONS:=local.config}
 export CHECK_OPTIONS=${CHECK_OPTIONS:="-g auto"}
 export BENCH_PASSES=${BENCH_PASSES:=5}

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#6 lore raw

PATCH v2 3/10 xfstests: Refactor code for obtaining test list

In reply to Lukas Czerner

Put the code for obtaining the list of test into one place which makes things more readable. It will also allow us to re-init the list in the future if we need it.

---
 check | 100 ++++++++++++++++++++++++++++++++++++------------------------------
 1 file changed, 54 insertions(+), 46 deletions(-)
check +54 -46
index 71b179b..dc972d7 100755
@@ -154,6 +154,56 @@ _timestamp()
     echo -n " [$now]"
 }
 
+_prepare_test_list()
+{
+	unset list
+	# Tests specified on the command line
+	if [ -s $tmp.arglist ]; then
+		cat $tmp.arglist > $tmp.list
+	else
+		touch $tmp.list
+	fi
+
+	# Specified groups to include
+	for group in $GROUP_LIST; do
+		list=$(get_group_list $group)
+		if [ -z "$list" ]; then
+			echo "Group \"$group\" is empty or not defined?"
+			exit 1
+		fi
+
+		for t in $list; do
+			grep -s "^$t\$" $tmp.list >/dev/null || \
+							echo "$t" >>$tmp.list
+		done
+	done
+
+	if ! $have_test_arg && [ -z "$GROUP_LIST" ]; then
+		# no test numbers, do everything
+		get_all_tests
+	fi
+
+	# Specified groups to exclude
+	for xgroup in $XGROUP_LIST; do
+		list=$(get_group_list $xgroup)
+		if [ -z "$list" ]; then
+			echo "Group \"$xgroup\" is empty or not defined?"
+			exit 1
+		fi
+
+		trim_test_list $list
+	done
+
+	# sort the list of tests into numeric order
+	list=`sort -n $tmp.list | uniq`
+	rm -f $tmp.list $tmp.tmp $tmp.grep
+
+	if $randomize
+	then
+		list=`echo $list | awk -f randomize.awk`
+	fi
+}
+
 # Process command arguments first.
 while [ $# -gt 0 ]; do
 	case "$1" in
@@ -164,35 +214,11 @@ while [ $# -gt 0 ]; do
 	-nfs)	FSTYP=nfs ;;
 
 	-g)	group=$2 ; shift ;
-		group_list=$(get_group_list $group)
-		if [ -z "$group_list" ]; then
-		    echo "Group \"$group\" is empty or not defined?"
-		    exit 1
-		fi
-
-		[ ! -s $tmp.list ] && touch $tmp.list
-		for t in $group_list; do
-			grep -s "^$t\$" $tmp.list >/dev/null || \
-							echo "$t" >>$tmp.list
-		done
-
+		GROUP_LIST="$GROUP_LIST $group"
 		;;
 
 	-x)	xgroup=$2 ; shift ;
-
-		# Note: behaviour is dependent on command line ordering of
-		# -g and -x parameters. If there are no preceding -g commands,
-		# this works on all tests, otherwise just the tests specified by
-		# the early -g inclusions.
-		[ ! -s $tmp.list ] && get_all_tests
-
-		group_list=$(get_group_list $xgroup)
-		if [ -z "$group_list" ]; then
-		    echo "Group \"$xgroup\" is empty or not defined?"
-		    exit 1
-		fi
-
-		trim_test_list $group_list
+		XGROUP_LIST="$XGROUP_LIST $xgroup"
 		;;
 
 	-X)	xfile=$2; shift ;
@@ -244,7 +270,7 @@ if $have_test_arg; then
 
 			if egrep "^$test_name" $group_file >/dev/null ; then
 				# in group file ... OK
-				echo $SRC_DIR/$1 >>$tmp.list
+				echo $SRC_DIR/$1 >>$tmp.arglist
 			else
 				# oops
 				echo "$1 - unknown test, ignored"
@@ -256,25 +282,7 @@ if $have_test_arg; then
 	done
 fi
 
-if [ -s $tmp.list ]; then
-    # found some valid test numbers ... this is good
-    :
-elif $have_test_arg; then
-	# had test numbers, but none in group file ... do nothing
-	touch $tmp.list
-else
-	# no test numbers, do everything
-	get_all_tests
-fi
-
-# sort the list of tests into numeric order
-list=`sort -n $tmp.list`
-rm -f $tmp.list $tmp.tmp $tmp.grep
-
-if $randomize
-then
-    list=`echo $list | awk -f randomize.awk`
-fi
+_prepare_test_list
 
 # we need common/rc
 if ! . ./common/rc
Signature · 6 lines
1.8.3.1

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by on v2 3/10
#7 lore raw

Re: [PATCH 03/10 v2] xfstests: Refactor code for obtaining test list

Quoted 134 lines · Lukas Czerner

Put the code for obtaining the list of test into one place which makes things more readable. It will also allow us to re-init the list in the future if we need it.

---
 check | 100 ++++++++++++++++++++++++++++++++++++------------------------------
 1 file changed, 54 insertions(+), 46 deletions(-)
check +53 -40
index 71b179b..dc972d7 100755
@@ -154,6 +154,56 @@ _timestamp()
     echo -n " [$now]"
 }
 
+_prepare_test_list()
+{
+	unset list
+	# Tests specified on the command line
+	if [ -s $tmp.arglist ]; then
+		cat $tmp.arglist > $tmp.list
+	else
+		touch $tmp.list
+	fi
+
+	# Specified groups to include
+	for group in $GROUP_LIST; do
+		list=$(get_group_list $group)
+		if [ -z "$list" ]; then
+			echo "Group \"$group\" is empty or not defined?"
+			exit 1
+		fi
+
+		for t in $list; do
+			grep -s "^$t\$" $tmp.list >/dev/null || \
+							echo "$t" >>$tmp.list
+		done
+	done
+
+	if ! $have_test_arg && [ -z "$GROUP_LIST" ]; then
+		# no test numbers, do everything
+		get_all_tests
+	fi
+
+	# Specified groups to exclude
+	for xgroup in $XGROUP_LIST; do
+		list=$(get_group_list $xgroup)
+		if [ -z "$list" ]; then
+			echo "Group \"$xgroup\" is empty or not defined?"
+			exit 1
+		fi
+
+		trim_test_list $list
+	done
+
+	# sort the list of tests into numeric order
+	list=`sort -n $tmp.list | uniq`
+	rm -f $tmp.list $tmp.tmp $tmp.grep
+
+	if $randomize
+	then
+		list=`echo $list | awk -f randomize.awk`
+	fi
+}
+
 # Process command arguments first.
 while [ $# -gt 0 ]; do
 	case "$1" in
@@ -164,35 +214,11 @@ while [ $# -gt 0 ]; do
 	-nfs)	FSTYP=nfs ;;
 
 	-g)	group=$2 ; shift ;
-		group_list=$(get_group_list $group)
-		if [ -z "$group_list" ]; then
-		    echo "Group \"$group\" is empty or not defined?"
-		    exit 1
-		fi
-
-		[ ! -s $tmp.list ] && touch $tmp.list
-		for t in $group_list; do
-			grep -s "^$t\$" $tmp.list >/dev/null || \
-							echo "$t" >>$tmp.list
-		done
-
+		GROUP_LIST="$GROUP_LIST $group"
 		;;
 
 	-x)	xgroup=$2 ; shift ;
-
-		# Note: behaviour is dependent on command line ordering of
-		# -g and -x parameters. If there are no preceding -g commands,
-		# this works on all tests, otherwise just the tests specified by
-		# the early -g inclusions.
-		[ ! -s $tmp.list ] && get_all_tests
-
-		group_list=$(get_group_list $xgroup)
-		if [ -z "$group_list" ]; then
-		    echo "Group \"$xgroup\" is empty or not defined?"
-		    exit 1
-		fi
-
-		trim_test_list $group_list
+		XGROUP_LIST="$XGROUP_LIST $xgroup"
 		;;
 
 	-X)	xfile=$2; shift ;
@@ -244,7 +270,7 @@ if $have_test_arg; then
 
 			if egrep "^$test_name" $group_file >/dev/null ; then
 				# in group file ... OK
-				echo $SRC_DIR/$1 >>$tmp.list
+				echo $SRC_DIR/$1 >>$tmp.arglist
 			else
 				# oops
 				echo "$1 - unknown test, ignored"
@@ -256,25 +282,7 @@ if $have_test_arg; then
 	done
 fi
 
-if [ -s $tmp.list ]; then
-    # found some valid test numbers ... this is good
-    :
-elif $have_test_arg; then
-	# had test numbers, but none in group file ... do nothing
-	touch $tmp.list
-else
-	# no test numbers, do everything
-	get_all_tests
-fi
-
-# sort the list of tests into numeric order
-list=`sort -n $tmp.list`

check if $have_test_arg; then · line 288

Quoted 10 lines
check +1 -6
-rm -f $tmp.list $tmp.tmp $tmp.grep
-
-if $randomize
-then
-    list=`echo $list | awk -f randomize.awk`
-fi
+_prepare_test_list
 
 # we need common/rc
 if ! . ./common/rc

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#8 lore raw

PATCH v2 4/10 xfstests: Allow to recheck options in common/rc

In reply to Lukas Czerner

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.

---
 common/rc | 74 ++++++++++++++++++++++++++++++++-------------------------------
 1 file changed, 38 insertions(+), 36 deletions(-)
common/rc +38 -36
index fe6bbfc..0dd30a3 100644
@@ -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
Signature · 6 lines
1.8.3.1

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by on v2 4/10
#9 lore raw

Re: [PATCH 04/10 v2] xfstests: Allow to recheck options in common/rc

Quoted 88 lines · Lukas Czerner

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.

---
 common/rc | 74 ++++++++++++++++++++++++++++++++-------------------------------
 1 file changed, 38 insertions(+), 36 deletions(-)
common/rc +34 -35
index fe6bbfc..0dd30a3 100644
@@ -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

common/rc run_check() · line 2178

Quoted 10 lines
common/rc +4 -1
+	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

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#10 lore raw

PATCH v2 5/10 xfstests: Allow to re-read configuration

In reply to Lukas Czerner

Move configuration initialization into a function so we can re-read it without the need to reinclude the common/config file which would be ugly. This is in preparation for adding support for sections into config files.

---
 common/config | 104 +++++++++++++++++++++++++++++++---------------------------
 1 file changed, 55 insertions(+), 49 deletions(-)
common/config +55 -49
index 1679acf..34c99e1 100644
@@ -214,64 +214,70 @@ esac
 
 known_hosts()
 {
-  [ "$HOST_CONFIG_DIR" ] || HOST_CONFIG_DIR=`pwd`/configs
-
-  [ -f /etc/xfsqa.config ]             && . /etc/xfsqa.config
-  [ -f $HOST_CONFIG_DIR/$HOST ]        && . $HOST_CONFIG_DIR/$HOST
-  [ -f $HOST_CONFIG_DIR/$HOST.config ] && . $HOST_CONFIG_DIR/$HOST.config
-
-  #  Mandatory Config values.
-  MC=""
-  [ -z "$EMAIL" ]          && MC="$MC EMAIL"
-  [ -z "$TEST_DIR" ]       && MC="$MC TEST_DIR"
-  [ -z "$TEST_DEV" ]       && MC="$MC TEST_DEV"
-
-  if [ -n "$MC" ]; then
-    echo "Warning: need to define parameters for host $HOST"
-    echo "       or set variables:"
-    echo "       $MC"
-    exit 1
-  fi
+	[ "$HOST_CONFIG_DIR" ] || HOST_CONFIG_DIR=`pwd`/configs
+
+	[ -f /etc/xfsqa.config ]             && export HOST_OPTIONS=/etc/xfsqa.config
+	[ -f $HOST_CONFIG_DIR/$HOST ]        && export HOST_OPTIONS=$HOST_CONFIG_DIR/$HOST
+	[ -f $HOST_CONFIG_DIR/$HOST.config ] && export HOST_OPTIONS=$HOST_CONFIG_DIR/$HOST.config
 }
 
-if [ -f "$HOST_OPTIONS" ]; then
-    . "$HOST_OPTIONS"
-else
-    known_hosts
+if [ ! -f "$HOST_OPTIONS" ]; then
+	known_hosts
 fi
 
-echo $TEST_DEV | grep -q ":" > /dev/null 2>&1
-if [ ! -b "$TEST_DEV" -a "$?" != "0" ]; then
-    echo "common/config: Error: \$TEST_DEV ($TEST_DEV) is not a block device or a NFS filesystem"
-    exit 1
+if [ -f "$HOST_OPTIONS" ]; then
+	. $HOST_OPTIONS
 fi
 
-if [ ! -d "$TEST_DIR" ]; then
-    echo "common/config: Error: \$TEST_DIR ($TEST_DIR) is not a directory"
-    exit 1
-fi
+get_next_config() {
+	#  Mandatory Config values.
+	MC=""
+	[ -z "$EMAIL" ]          && MC="$MC EMAIL"
+	[ -z "$TEST_DIR" ]       && MC="$MC TEST_DIR"
+	[ -z "$TEST_DEV" ]       && MC="$MC TEST_DEV"
+
+	if [ -n "$MC" ]; then
+		echo "Warning: need to define parameters for host $HOST"
+		echo "       or set variables:"
+		echo "       $MC"
+		exit 1
+	fi
 
-# a btrfs tester will set only SCRATCH_DEV_POOL, we will put first of its dev
-# 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"
-        exit 1
-    fi
-    SCRATCH_DEV=`echo $SCRATCH_DEV_POOL | awk '{print $1}'`
-    SCRATCH_DEV_POOL=`echo $SCRATCH_DEV_POOL | awk '{ ORS=" "; for (i = 2; i <= NF; i++) print $i}'`
-fi
+	echo $TEST_DEV | grep -q ":" > /dev/null 2>&1
+	if [ ! -b "$TEST_DEV" -a "$?" != "0" ]; then
+		echo "common/config: Error: \$TEST_DEV ($TEST_DEV) is not a block device or a NFS filesystem"
+		exit 1
+	fi
 
-echo $SCRATCH_DEV | grep -q ":" > /dev/null 2>&1
-if [ ! -z "$SCRATCH_DEV" -a ! -b "$SCRATCH_DEV" -a "$?" != "0" ]; then
-    echo "common/config: Error: \$SCRATCH_DEV ($SCRATCH_DEV) is not a block device or a NFS filesystem"
-    exit 1
-fi
+	if [ ! -d "$TEST_DIR" ]; then
+		echo "common/config: Error: \$TEST_DIR ($TEST_DIR) is not a directory"
+		exit 1
+	fi
 
-if [ ! -z "$SCRATCH_MNT" -a ! -d "$SCRATCH_MNT" ]; then
-    echo "common/config: Error: \$SCRATCH_MNT ($SCRATCH_MNT) is not a directory"
-    exit 1
-fi
+	# a btrfs tester will set only SCRATCH_DEV_POOL, we will put first of its dev
+	# 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"
+			exit 1
+		fi
+		SCRATCH_DEV=`echo $SCRATCH_DEV_POOL | awk '{print $1}'`
+		SCRATCH_DEV_POOL=`echo $SCRATCH_DEV_POOL | awk '{ ORS=" "; for (i = 2; i <= NF; i++) print $i}'`
+	fi
+
+	echo $SCRATCH_DEV | grep -q ":" > /dev/null 2>&1
+	if [ ! -z "$SCRATCH_DEV" -a ! -b "$SCRATCH_DEV" -a "$?" != "0" ]; then
+		echo "common/config: Error: \$SCRATCH_DEV ($SCRATCH_DEV) is not a block device or a NFS filesystem"
+		exit 1
+	fi
+
+	if [ ! -z "$SCRATCH_MNT" -a ! -d "$SCRATCH_MNT" ]; then
+		echo "common/config: Error: \$SCRATCH_MNT ($SCRATCH_MNT) is not a directory"
+		exit 1
+	fi
+}
+
+get_next_config
 
 # make sure this script returns success
 /bin/true
Signature · 6 lines
1.8.3.1

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by on v2 5/10
#11 lore raw

Re: [PATCH 05/10 v2] xfstests: Allow to re-read configuration

Quoted 124 lines · Lukas Czerner

Move configuration initialization into a function so we can re-read it without the need to reinclude the common/config file which would be ugly. This is in preparation for adding support for sections into config files.

---
 common/config | 104 +++++++++++++++++++++++++++++++---------------------------
 1 file changed, 55 insertions(+), 49 deletions(-)
common/config +48 -49
index 1679acf..34c99e1 100644
@@ -214,64 +214,70 @@ esac
 
 known_hosts()
 {
-  [ "$HOST_CONFIG_DIR" ] || HOST_CONFIG_DIR=`pwd`/configs
-
-  [ -f /etc/xfsqa.config ]             && . /etc/xfsqa.config
-  [ -f $HOST_CONFIG_DIR/$HOST ]        && . $HOST_CONFIG_DIR/$HOST
-  [ -f $HOST_CONFIG_DIR/$HOST.config ] && . $HOST_CONFIG_DIR/$HOST.config
-
-  #  Mandatory Config values.
-  MC=""
-  [ -z "$EMAIL" ]          && MC="$MC EMAIL"
-  [ -z "$TEST_DIR" ]       && MC="$MC TEST_DIR"
-  [ -z "$TEST_DEV" ]       && MC="$MC TEST_DEV"
-
-  if [ -n "$MC" ]; then
-    echo "Warning: need to define parameters for host $HOST"
-    echo "       or set variables:"
-    echo "       $MC"
-    exit 1
-  fi
+	[ "$HOST_CONFIG_DIR" ] || HOST_CONFIG_DIR=`pwd`/configs
+
+	[ -f /etc/xfsqa.config ]             && export HOST_OPTIONS=/etc/xfsqa.config
+	[ -f $HOST_CONFIG_DIR/$HOST ]        && export HOST_OPTIONS=$HOST_CONFIG_DIR/$HOST
+	[ -f $HOST_CONFIG_DIR/$HOST.config ] && export HOST_OPTIONS=$HOST_CONFIG_DIR/$HOST.config
 }
 
-if [ -f "$HOST_OPTIONS" ]; then
-    . "$HOST_OPTIONS"
-else
-    known_hosts
+if [ ! -f "$HOST_OPTIONS" ]; then
+	known_hosts
 fi
 
-echo $TEST_DEV | grep -q ":" > /dev/null 2>&1
-if [ ! -b "$TEST_DEV" -a "$?" != "0" ]; then
-    echo "common/config: Error: \$TEST_DEV ($TEST_DEV) is not a block device or a NFS filesystem"
-    exit 1
+if [ -f "$HOST_OPTIONS" ]; then
+	. $HOST_OPTIONS
 fi
 
-if [ ! -d "$TEST_DIR" ]; then
-    echo "common/config: Error: \$TEST_DIR ($TEST_DIR) is not a directory"
-    exit 1
-fi
+get_next_config() {
+	#  Mandatory Config values.
+	MC=""
+	[ -z "$EMAIL" ]          && MC="$MC EMAIL"
+	[ -z "$TEST_DIR" ]       && MC="$MC TEST_DIR"
+	[ -z "$TEST_DEV" ]       && MC="$MC TEST_DEV"
+
+	if [ -n "$MC" ]; then
+		echo "Warning: need to define parameters for host $HOST"
+		echo "       or set variables:"
+		echo "       $MC"
+		exit 1
+	fi
 
-# a btrfs tester will set only SCRATCH_DEV_POOL, we will put first of its dev
-# 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"
-        exit 1
-    fi
-    SCRATCH_DEV=`echo $SCRATCH_DEV_POOL | awk '{print $1}'`
-    SCRATCH_DEV_POOL=`echo $SCRATCH_DEV_POOL | awk '{ ORS=" "; for (i = 2; i <= NF; i++) print $i}'`
-fi
+	echo $TEST_DEV | grep -q ":" > /dev/null 2>&1
+	if [ ! -b "$TEST_DEV" -a "$?" != "0" ]; then
+		echo "common/config: Error: \$TEST_DEV ($TEST_DEV) is not a block device or a NFS filesystem"
+		exit 1
+	fi
 
-echo $SCRATCH_DEV | grep -q ":" > /dev/null 2>&1
-if [ ! -z "$SCRATCH_DEV" -a ! -b "$SCRATCH_DEV" -a "$?" != "0" ]; then
-    echo "common/config: Error: \$SCRATCH_DEV ($SCRATCH_DEV) is not a block device or a NFS filesystem"
-    exit 1
-fi
+	if [ ! -d "$TEST_DIR" ]; then
+		echo "common/config: Error: \$TEST_DIR ($TEST_DIR) is not a directory"
+		exit 1
+	fi
 
-if [ ! -z "$SCRATCH_MNT" -a ! -d "$SCRATCH_MNT" ]; then
-    echo "common/config: Error: \$SCRATCH_MNT ($SCRATCH_MNT) is not a directory"
-    exit 1
-fi
+	# a btrfs tester will set only SCRATCH_DEV_POOL, we will put first of its dev
+	# 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"
+			exit 1
+		fi
+		SCRATCH_DEV=`echo $SCRATCH_DEV_POOL | awk '{print $1}'`
+		SCRATCH_DEV_POOL=`echo $SCRATCH_DEV_POOL | awk '{ ORS=" "; for (i = 2; i <= NF; i++) print $i}'`
+	fi
+
+	echo $SCRATCH_DEV | grep -q ":" > /dev/null 2>&1
+	if [ ! -z "$SCRATCH_DEV" -a ! -b "$SCRATCH_DEV" -a "$?" != "0" ]; then
+		echo "common/config: Error: \$SCRATCH_DEV ($SCRATCH_DEV) is not a block device or a NFS filesystem"
+		exit 1
+	fi
+

common/config esac · line 283

Quoted 10 lines
common/config +7 -0
+	if [ ! -z "$SCRATCH_MNT" -a ! -d "$SCRATCH_MNT" ]; then
+		echo "common/config: Error: \$SCRATCH_MNT ($SCRATCH_MNT) is not a directory"
+		exit 1
+	fi
+}
+
+get_next_config
 
 # make sure this script returns success
 /bin/true

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#12 lore raw

PATCH v2 6/10 xfstests: Allow to specify RESULT_BASE directory

In reply to Lukas Czerner

This commit adds the possibility to specify RESULT_BASE directory from the config file, or with environment variable. The default remains the same "$here/results/".

---
 check         | 1 -
 common/config | 5 +++++
 2 files changed, 5 insertions(+), 1 deletion(-)
check +0 -1
index dc972d7..428eba1 100755
@@ -66,7 +66,6 @@ export FSTYP
 SUPPORTED_TESTS="[0-9][0-9][0-9] [0-9][0-9][0-9][0-9]"
 SRC_GROUPS="generic shared"
 export SRC_DIR="tests"
-export RESULT_BASE=${RESULT_BASE:="$here/results"}
 
 usage()
 {
common/config +5 -0
index 34c99e1..39dd469 100644
@@ -230,6 +230,11 @@ if [ -f "$HOST_OPTIONS" ]; then
 fi
 
 get_next_config() {
+	# set default RESULT_BASE
+	if [ -z "$RESULT_BASE" ]; then
+		export RESULT_BASE="$here/results/"
+	fi
+
 	#  Mandatory Config values.
 	MC=""
 	[ -z "$EMAIL" ]          && MC="$MC EMAIL"
Signature · 6 lines
1.8.3.1

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by on v2 6/10
#13 lore raw

Re: [PATCH 06/10 v2] xfstests: Allow to specify RESULT_BASE directory

Quoted 5 lines · Lukas Czerner

This commit adds the possibility to specify RESULT_BASE directory from the config file, or with environment variable. The default remains the same "$here/results/".

Quoted 23 lines
---
 check         | 1 -
 common/config | 5 +++++
 2 files changed, 5 insertions(+), 1 deletion(-)
check +0 -1
index dc972d7..428eba1 100755
@@ -66,7 +66,6 @@ export FSTYP
 SUPPORTED_TESTS="[0-9][0-9][0-9] [0-9][0-9][0-9][0-9]"
 SRC_GROUPS="generic shared"
 export SRC_DIR="tests"
-export RESULT_BASE=${RESULT_BASE:="$here/results"}
 
 usage()
 {
common/config +0 -0
index 34c99e1..39dd469 100644
@@ -230,6 +230,11 @@ if [ -f "$HOST_OPTIONS" ]; then
 fi

common/config if [ -f "$HOST_OPTIONS" ]; then · line 240

Quoted 10 lines
common/config +5 -0
 
 get_next_config() {
+	# set default RESULT_BASE
+	if [ -z "$RESULT_BASE" ]; then
+		export RESULT_BASE="$here/results/"
+	fi
+
 	#  Mandatory Config values.
 	MC=""
 	[ -z "$EMAIL" ]          && MC="$MC EMAIL"

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#14 lore raw

PATCH v2 7/10 xfstests: Prepare for config section

In reply to Lukas Czerner

This stupid patch only put the indentation in place so we will be able to clearly see and review changes made in the second patch which will add a loop (instead of allways-true condition introduced in this patch) adding support for config sections. There are no changes in the logic, only indentation changes.

---
 check | 314 +++++++++++++++++++++++++++++++++---------------------------------
 1 file changed, 157 insertions(+), 157 deletions(-)
check +157 -157
index 428eba1..677650c 100755
@@ -356,186 +356,186 @@ END	{ if (NR > 0) {
 
 trap "_wrapup; exit \$status" 0 1 2 3 15
 
-mkdir -p $RESULT_BASE
-if [ ! -d $RESULT_BASE ]; then
-	echo "failed to create results directory $RESULTS_BASE"
-	exit 1;
-fi
+if true; then
+	mkdir -p $RESULT_BASE
+	if [ ! -d $RESULT_BASE ]; then
+		echo "failed to create results directory $RESULTS_BASE"
+		exit 1;
+	fi
 
-seq="check"
-check="$RESULT_BASE/check"
+	seq="check"
+	check="$RESULT_BASE/check"
 
 # don't leave old full output behind on a clean run
-rm -f $check.full
+	rm -f $check.full
 
-[ -f $check.time ] || touch $check.time
+	[ -f $check.time ] || touch $check.time
 
 # print out our test configuration
-echo "FSTYP         -- `_full_fstyp_details`"
-echo "PLATFORM      -- `_full_platform_details`"
-if [ ! -z "$SCRATCH_DEV" ]; then
-  echo "MKFS_OPTIONS  -- `_scratch_mkfs_options`"
-  echo "MOUNT_OPTIONS -- `_scratch_mount_options`"
-fi
-echo
-
-
-if [ ! -z "$SCRATCH_DEV" ]; then
-  umount $SCRATCH_DEV 2>/dev/null
-  # call the overridden mkfs - make sure the FS is built
-  # the same as we'll create it later.
-
-  if ! _scratch_mkfs $flag >$tmp.err 2>&1
-  then
-      echo "our local _scratch_mkfs routine ..."
-      cat $tmp.err
-      echo "check: failed to mkfs \$SCRATCH_DEV using specified options"
-      exit 1
-  fi
-
-  # call the overridden mount - make sure the FS mounts with
-  # the same options that we'll mount with later.
-  if ! _scratch_mount >$tmp.err 2>&1
-  then
-      echo "our local mount routine ..."
-      cat $tmp.err
-      echo "check: failed to mount \$SCRATCH_DEV using specified options"
-      exit 1
-  fi
-fi
-
-seqres="$check"
-_check_test_fs
-
-for seq in $list
-do
-    err=false
+	echo "FSTYP         -- `_full_fstyp_details`"
+	echo "PLATFORM      -- `_full_platform_details`"
+	if [ ! -z "$SCRATCH_DEV" ]; then
+		echo "MKFS_OPTIONS  -- `_scratch_mkfs_options`"
+		echo "MOUNT_OPTIONS -- `_scratch_mount_options`"
+	fi
+	echo
 
-    # the filename for the test and the name output are different.
-    # we don't include the tests/ directory in the name output.
-    seqnum=`echo $seq | sed -e "s;$SRC_DIR/;;"`
 
-    # Similarly, the result directory needs to replace the tests/
-    # part of the test location.
-    group=`dirname $seq`
-    export RESULT_DIR=`echo $group | sed -e "s;$SRC_DIR;$RESULT_BASE;"`
-    mkdir -p $RESULT_DIR
-    seqres="$RESULT_BASE/$seqnum"
+	if [ ! -z "$SCRATCH_DEV" ]; then
+		umount $SCRATCH_DEV 2>/dev/null
+		# call the overridden mkfs - make sure the FS is built
+		# the same as we'll create it later.
 
-    echo -n "$seqnum"
+		if ! _scratch_mkfs $flag >$tmp.err 2>&1
+		then
+			echo "our local _scratch_mkfs routine ..."
+			cat $tmp.err
+			echo "check: failed to mkfs \$SCRATCH_DEV using specified options"
+			exit 1
+		fi
 
-    if $showme
-    then
-	echo
-	continue
-    elif [ ! -f $seq ]
-    then
-	echo " - no such test?"
-    else
-	# really going to try and run this one
-	#
-	rm -f $seqres.out.bad
-
-	# check if we really should run it
-	if [ -s $tmp.xlist ]; then
-		if grep $seqnum $tmp.xlist > /dev/null 2>&1 ; then
-			echo "       [expunged]"
-			continue
+		# call the overridden mount - make sure the FS mounts with
+		# the same options that we'll mount with later.
+		if ! _scratch_mount >$tmp.err 2>&1
+		then
+			echo "our local mount routine ..."
+			cat $tmp.err
+			echo "check: failed to mount \$SCRATCH_DEV using specified options"
+			exit 1
 		fi
 	fi
 
-	# slashes now in names, sed barfs on them so use grep
-	lasttime=`grep -w ^$seqnum $check.time | awk '// {print $2}'`
-	if [ "X$lasttime" != X ]; then
-		echo -n " ${lasttime}s ..."
-	else
-		echo -n "	"	# prettier output with timestamps.
-	fi
-	rm -f core $seqres.notrun
+	seqres="$check"
+	_check_test_fs
 
-	start=`_wallclock`
-	$timestamp && echo -n "	["`date "+%T"`"]"
-	[ ! -x $seq ] && chmod u+x $seq # ensure we can run it
-	$LOGGER_PROG "run xfstest $seqnum"
-	./$seq >$tmp.rawout 2>&1
-	sts=$?
-	$timestamp && _timestamp
-	stop=`_wallclock`
+	for seq in $list
+	do
+		err=false
 
-	_fix_malloc <$tmp.rawout >$tmp.out
-	rm -f $tmp.rawout
+		# the filename for the test and the name output are different.
+		# we don't include the tests/ directory in the name output.
+		seqnum=`echo $seq | sed -e "s;$SRC_DIR/;;"`
 
-	if [ -f core ]
-	then
-	    echo -n " [dumped core]"
-	    mv core $RESULT_BASE/$seqnum.core
-	    err=true
-	fi
+		# Similarly, the result directory needs to replace the tests/
+		# part of the test location.
+		group=`dirname $seq`
+		export RESULT_DIR=`echo $group | sed -e "s;$SRC_DIR;$RESULT_BASE;"`
+		mkdir -p $RESULT_DIR
+		seqres="$RESULT_BASE/$seqnum"
 
-	if [ -f $seqres.notrun ]
-	then
-	    $timestamp || echo -n " [not run] "
-	    $timestamp && echo " [not run]" && echo -n "	$seqnum -- "
-	    cat $seqres.notrun
-	    notrun="$notrun $seqnum"
-	else
-	    if [ $sts -ne 0 ]
-	    then
-		echo -n " [failed, exit status $sts]"
-		err=true
-	    fi
-	    if [ ! -f $seq.out ]
-	    then
-		echo " - no qualified output"
-		err=true
-	    else
-		if diff $seq.out $tmp.out >/dev/null 2>&1
+		echo -n "$seqnum"
+
+		if $showme
+		then
+			echo
+			continue
+		elif [ ! -f $seq ]
 		then
-		    if $err
-		    then
-			:
-		    else
-			echo "$seqnum `expr $stop - $start`" >>$tmp.time
-			echo -n " `expr $stop - $start`s"
-		    fi
-		    echo ""
+			echo " - no such test?"
 		else
-		    echo " - output mismatch (see $seqres.out.bad)"
-		    mv $tmp.out $seqres.out.bad
-		    $diff $seq.out $seqres.out.bad | {
-		        if test "$DIFF_LENGTH" -le 0; then
-				cat
+			# really going to try and run this one
+			#
+			rm -f $seqres.out.bad
+
+			# check if we really should run it
+			if [ -s $tmp.xlist ]; then
+				if grep $seqnum $tmp.xlist > /dev/null 2>&1 ; then
+					echo "       [expunged]"
+					continue
+				fi
+			fi
+
+			# slashes now in names, sed barfs on them so use grep
+			lasttime=`grep -w ^$seqnum $check.time | awk '// {print $2}'`
+			if [ "X$lasttime" != X ]; then
+				echo -n " ${lasttime}s ..."
 			else
-				head -n "$DIFF_LENGTH"
-			fi; } | \
-			sed -e 's/^\(.\)/    \1/'
-		    echo "     ..."
-		    echo "     (Run '$diff $seq.out $seqres.out.bad' to see the" \
-			 "entire diff)"
-		    err=true
-		fi
-	    fi
-	fi
+				echo -n "	"	# prettier output with timestamps.
+			fi
+			rm -f core $seqres.notrun
+
+			start=`_wallclock`
+			$timestamp && echo -n "	["`date "+%T"`"]"
+			[ ! -x $seq ] && chmod u+x $seq # ensure we can run it
+			$LOGGER_PROG "run xfstest $seqnum"
+			./$seq >$tmp.rawout 2>&1
+			sts=$?
+			$timestamp && _timestamp
+			stop=`_wallclock`
+
+			_fix_malloc <$tmp.rawout >$tmp.out
+			rm -f $tmp.rawout
+
+			if [ -f core ]
+			then
+				echo -n " [dumped core]"
+				mv core $RESULT_BASE/$seqnum.core
+			    err=true
+			fi
 
-    fi
+			if [ -f $seqres.notrun ]
+			then
+				$timestamp || echo -n " [not run] "
+				$timestamp && echo " [not run]" && echo -n "	$seqnum -- "
+				cat $seqres.notrun
+				notrun="$notrun $seqnum"
+			else
+				if [ $sts -ne 0 ]
+				then
+					echo -n " [failed, exit status $sts]"
+					err=true
+				fi
+				if [ ! -f $seq.out ]
+				then
+					echo " - no qualified output"
+					err=true
+				else
+					if diff $seq.out $tmp.out >/dev/null 2>&1
+					then
+						if $err
+						then
+							:
+						else
+							echo "$seqnum `expr $stop - $start`" >>$tmp.time
+							echo -n " `expr $stop - $start`s"
+						fi
+						echo ""
+					else
+						echo " - output mismatch (see $seqres.out.bad)"
+						mv $tmp.out $seqres.out.bad
+						$diff $seq.out $seqres.out.bad | {
+						if test "$DIFF_LENGTH" -le 0; then
+							cat
+						else
+							head -n "$DIFF_LENGTH"
+						fi; } | \
+						sed -e 's/^\(.\)/    \1/'
+						echo "     ..."
+						echo "     (Run '$diff $seq.out $seqres.out.bad' to see the entire diff)"
+						err=true
+					fi
+				fi
+			fi
+		fi
 
-    # come here for each test, except when $showme is true
-    #
-    if $err
-    then
-	bad="$bad $seqnum"
-	n_bad=`expr $n_bad + 1`
-	quick=false
-    fi
-    if [ ! -f $seqres.notrun ]
-    then
-	try="$try $seqnum"
-	n_try=`expr $n_try + 1`
-        _check_test_fs
-    fi
+		# come here for each test, except when $showme is true
+		#
+		if $err
+		then
+			bad="$bad $seqnum"
+			n_bad=`expr $n_bad + 1`
+			quick=false
+		fi
+		if [ ! -f $seqres.notrun ]
+		then
+			try="$try $seqnum"
+			n_try=`expr $n_try + 1`
+			_check_test_fs
+		fi
 
-    seq="after_$seqnum"
-done
+		 seq="after_$seqnum"
+	done
+fi
 
 interrupt=false
 status=`expr $n_bad`
Signature · 6 lines
1.8.3.1

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#15 lore raw

Re: [PATCH 07/10 v2] xfstests: Prepare for config section

Quoted 1 line · Lukas Czerner

This stupid patch only put the indentation in place so we will be able

I would suggest to remove "stupid" :).

You can simply say that this patch just indents the script to make the review of next patch easier.

Quoted 1 line

to clearly see and review changes made in the second patch which will

s/second/next/

Quoted 1 line

add a loop (instead of allways-true condition introduced in this patch)

s/allways/always/

Quoted 346 lines

adding support for config sections. There are no changes in the logic, only indentation changes.

---
 check | 314 +++++++++++++++++++++++++++++++++---------------------------------
 1 file changed, 157 insertions(+), 157 deletions(-)
check +153 -155
index 428eba1..677650c 100755
@@ -356,186 +356,186 @@ END	{ if (NR > 0) {
 
 trap "_wrapup; exit \$status" 0 1 2 3 15
 
-mkdir -p $RESULT_BASE
-if [ ! -d $RESULT_BASE ]; then
-	echo "failed to create results directory $RESULTS_BASE"
-	exit 1;
-fi
+if true; then
+	mkdir -p $RESULT_BASE
+	if [ ! -d $RESULT_BASE ]; then
+		echo "failed to create results directory $RESULTS_BASE"
+		exit 1;
+	fi
 
-seq="check"
-check="$RESULT_BASE/check"
+	seq="check"
+	check="$RESULT_BASE/check"
 
 # don't leave old full output behind on a clean run
-rm -f $check.full
+	rm -f $check.full
 
-[ -f $check.time ] || touch $check.time
+	[ -f $check.time ] || touch $check.time
 
 # print out our test configuration
-echo "FSTYP         -- `_full_fstyp_details`"
-echo "PLATFORM      -- `_full_platform_details`"
-if [ ! -z "$SCRATCH_DEV" ]; then
-  echo "MKFS_OPTIONS  -- `_scratch_mkfs_options`"
-  echo "MOUNT_OPTIONS -- `_scratch_mount_options`"
-fi
-echo
-
-
-if [ ! -z "$SCRATCH_DEV" ]; then
-  umount $SCRATCH_DEV 2>/dev/null
-  # call the overridden mkfs - make sure the FS is built
-  # the same as we'll create it later.
-
-  if ! _scratch_mkfs $flag >$tmp.err 2>&1
-  then
-      echo "our local _scratch_mkfs routine ..."
-      cat $tmp.err
-      echo "check: failed to mkfs \$SCRATCH_DEV using specified options"
-      exit 1
-  fi
-
-  # call the overridden mount - make sure the FS mounts with
-  # the same options that we'll mount with later.
-  if ! _scratch_mount >$tmp.err 2>&1
-  then
-      echo "our local mount routine ..."
-      cat $tmp.err
-      echo "check: failed to mount \$SCRATCH_DEV using specified options"
-      exit 1
-  fi
-fi
-
-seqres="$check"
-_check_test_fs
-
-for seq in $list
-do
-    err=false
+	echo "FSTYP         -- `_full_fstyp_details`"
+	echo "PLATFORM      -- `_full_platform_details`"
+	if [ ! -z "$SCRATCH_DEV" ]; then
+		echo "MKFS_OPTIONS  -- `_scratch_mkfs_options`"
+		echo "MOUNT_OPTIONS -- `_scratch_mount_options`"
+	fi
+	echo
 
-    # the filename for the test and the name output are different.
-    # we don't include the tests/ directory in the name output.
-    seqnum=`echo $seq | sed -e "s;$SRC_DIR/;;"`
 
-    # Similarly, the result directory needs to replace the tests/
-    # part of the test location.
-    group=`dirname $seq`
-    export RESULT_DIR=`echo $group | sed -e "s;$SRC_DIR;$RESULT_BASE;"`
-    mkdir -p $RESULT_DIR
-    seqres="$RESULT_BASE/$seqnum"
+	if [ ! -z "$SCRATCH_DEV" ]; then
+		umount $SCRATCH_DEV 2>/dev/null
+		# call the overridden mkfs - make sure the FS is built
+		# the same as we'll create it later.
 
-    echo -n "$seqnum"
+		if ! _scratch_mkfs $flag >$tmp.err 2>&1
+		then
+			echo "our local _scratch_mkfs routine ..."
+			cat $tmp.err
+			echo "check: failed to mkfs \$SCRATCH_DEV using specified options"
+			exit 1
+		fi
 
-    if $showme
-    then
-	echo
-	continue
-    elif [ ! -f $seq ]
-    then
-	echo " - no such test?"
-    else
-	# really going to try and run this one
-	#
-	rm -f $seqres.out.bad
-
-	# check if we really should run it
-	if [ -s $tmp.xlist ]; then
-		if grep $seqnum $tmp.xlist > /dev/null 2>&1 ; then
-			echo "       [expunged]"
-			continue
+		# call the overridden mount - make sure the FS mounts with
+		# the same options that we'll mount with later.
+		if ! _scratch_mount >$tmp.err 2>&1
+		then
+			echo "our local mount routine ..."
+			cat $tmp.err
+			echo "check: failed to mount \$SCRATCH_DEV using specified options"
+			exit 1
 		fi
 	fi
 
-	# slashes now in names, sed barfs on them so use grep
-	lasttime=`grep -w ^$seqnum $check.time | awk '// {print $2}'`
-	if [ "X$lasttime" != X ]; then
-		echo -n " ${lasttime}s ..."
-	else
-		echo -n "	"	# prettier output with timestamps.
-	fi
-	rm -f core $seqres.notrun
+	seqres="$check"
+	_check_test_fs
 
-	start=`_wallclock`
-	$timestamp && echo -n "	["`date "+%T"`"]"
-	[ ! -x $seq ] && chmod u+x $seq # ensure we can run it
-	$LOGGER_PROG "run xfstest $seqnum"
-	./$seq >$tmp.rawout 2>&1
-	sts=$?
-	$timestamp && _timestamp
-	stop=`_wallclock`
+	for seq in $list
+	do
+		err=false
 
-	_fix_malloc <$tmp.rawout >$tmp.out
-	rm -f $tmp.rawout
+		# the filename for the test and the name output are different.
+		# we don't include the tests/ directory in the name output.
+		seqnum=`echo $seq | sed -e "s;$SRC_DIR/;;"`
 
-	if [ -f core ]
-	then
-	    echo -n " [dumped core]"
-	    mv core $RESULT_BASE/$seqnum.core
-	    err=true
-	fi
+		# Similarly, the result directory needs to replace the tests/
+		# part of the test location.
+		group=`dirname $seq`
+		export RESULT_DIR=`echo $group | sed -e "s;$SRC_DIR;$RESULT_BASE;"`
+		mkdir -p $RESULT_DIR
+		seqres="$RESULT_BASE/$seqnum"
 
-	if [ -f $seqres.notrun ]
-	then
-	    $timestamp || echo -n " [not run] "
-	    $timestamp && echo " [not run]" && echo -n "	$seqnum -- "
-	    cat $seqres.notrun
-	    notrun="$notrun $seqnum"
-	else
-	    if [ $sts -ne 0 ]
-	    then
-		echo -n " [failed, exit status $sts]"
-		err=true
-	    fi
-	    if [ ! -f $seq.out ]
-	    then
-		echo " - no qualified output"
-		err=true
-	    else
-		if diff $seq.out $tmp.out >/dev/null 2>&1
+		echo -n "$seqnum"
+
+		if $showme
+		then
+			echo
+			continue
+		elif [ ! -f $seq ]
 		then
-		    if $err
-		    then
-			:
-		    else
-			echo "$seqnum `expr $stop - $start`" >>$tmp.time
-			echo -n " `expr $stop - $start`s"
-		    fi
-		    echo ""
+			echo " - no such test?"
 		else
-		    echo " - output mismatch (see $seqres.out.bad)"
-		    mv $tmp.out $seqres.out.bad
-		    $diff $seq.out $seqres.out.bad | {
-		        if test "$DIFF_LENGTH" -le 0; then
-				cat
+			# really going to try and run this one
+			#
+			rm -f $seqres.out.bad
+
+			# check if we really should run it
+			if [ -s $tmp.xlist ]; then
+				if grep $seqnum $tmp.xlist > /dev/null 2>&1 ; then
+					echo "       [expunged]"
+					continue
+				fi
+			fi
+
+			# slashes now in names, sed barfs on them so use grep
+			lasttime=`grep -w ^$seqnum $check.time | awk '// {print $2}'`
+			if [ "X$lasttime" != X ]; then
+				echo -n " ${lasttime}s ..."
 			else
-				head -n "$DIFF_LENGTH"
-			fi; } | \
-			sed -e 's/^\(.\)/    \1/'
-		    echo "     ..."
-		    echo "     (Run '$diff $seq.out $seqres.out.bad' to see the" \
-			 "entire diff)"
-		    err=true
-		fi
-	    fi
-	fi
+				echo -n "	"	# prettier output with timestamps.
+			fi
+			rm -f core $seqres.notrun
+
+			start=`_wallclock`
+			$timestamp && echo -n "	["`date "+%T"`"]"
+			[ ! -x $seq ] && chmod u+x $seq # ensure we can run it
+			$LOGGER_PROG "run xfstest $seqnum"
+			./$seq >$tmp.rawout 2>&1
+			sts=$?
+			$timestamp && _timestamp
+			stop=`_wallclock`
+
+			_fix_malloc <$tmp.rawout >$tmp.out
+			rm -f $tmp.rawout
+
+			if [ -f core ]
+			then
+				echo -n " [dumped core]"
+				mv core $RESULT_BASE/$seqnum.core
+			    err=true
+			fi
 
-    fi
+			if [ -f $seqres.notrun ]
+			then
+				$timestamp || echo -n " [not run] "
+				$timestamp && echo " [not run]" && echo -n "	$seqnum -- "
+				cat $seqres.notrun
+				notrun="$notrun $seqnum"
+			else
+				if [ $sts -ne 0 ]
+				then
+					echo -n " [failed, exit status $sts]"
+					err=true
+				fi
+				if [ ! -f $seq.out ]
+				then
+					echo " - no qualified output"
+					err=true
+				else
+					if diff $seq.out $tmp.out >/dev/null 2>&1
+					then
+						if $err
+						then
+							:
+						else
+							echo "$seqnum `expr $stop - $start`" >>$tmp.time
+							echo -n " `expr $stop - $start`s"
+						fi
+						echo ""
+					else
+						echo " - output mismatch (see $seqres.out.bad)"
+						mv $tmp.out $seqres.out.bad
+						$diff $seq.out $seqres.out.bad | {
+						if test "$DIFF_LENGTH" -le 0; then
+							cat
+						else
+							head -n "$DIFF_LENGTH"
+						fi; } | \
+						sed -e 's/^\(.\)/    \1/'
+						echo "     ..."
+						echo "     (Run '$diff $seq.out $seqres.out.bad' to see the entire diff)"
+						err=true
+					fi
+				fi
+			fi
+		fi
 
-    # come here for each test, except when $showme is true
-    #
-    if $err
-    then
-	bad="$bad $seqnum"
-	n_bad=`expr $n_bad + 1`
-	quick=false
-    fi
-    if [ ! -f $seqres.notrun ]
-    then
-	try="$try $seqnum"
-	n_try=`expr $n_try + 1`
-        _check_test_fs
-    fi
+		# come here for each test, except when $showme is true
+		#
+		if $err
+		then
+			bad="$bad $seqnum"
+			n_bad=`expr $n_bad + 1`
+			quick=false
+		fi
+		if [ ! -f $seqres.notrun ]
+		then
+			try="$try $seqnum"
+			n_try=`expr $n_try + 1`
+			_check_test_fs

check END { if (NR > 0) { · line 541

Quoted 10 lines
check +4 -2
+		fi
 
-    seq="after_$seqnum"
-done
+		 seq="after_$seqnum"
+	done
+fi
 
 interrupt=false
 status=`expr $n_bad`

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#16 lore raw

PATCH v2 8/10 xfstests: Add support for sections in config file

In reply to Lukas Czerner

This patch add support for sections in the config file. Each section can contain configuration options in the format

OPTION=value

when one section is processed xfstests will proceed to next section until all secitons are processed, or an error occur.

The name of the section can consist of alphanumeric characters + '_', nothing else is allowed. Name of the section is also used to create results subdirectory for each section. After all the sections are processed summary of all runs is printed out.

If the config file does not contain sections, or we're not using config file at all, nothing is changed and xfstests will work the same way as it used to.

This is very useful for testing file system with different options. Here is an example of the config file with sections:

[ext4_4k_block_size]
TEST_DEV=/dev/sda
TEST_DIR=/mnt/test
SCRATCH_DEV=/dev/sdb
SCRATCH_MNT=/mnt/test1
MKFS_OPTIONS="-q -F -b4096"
FSTYP=ext4

[ext4_1k_block_size]
MKFS_OPTIONS="-q -F -b1024"

[ext4_nojournal]
MKFS_OPTIONS="-q -F -b4096 -O ^has_journal"

[ext4_discard_ssd]
MKFS_OPTIONS="-q -F -b4096"
TEST_DEV=/dev/sdc
SCRATCH_DEV=/dev/sdd
MOUNT_OPTIONS="-o discard"

Note that once the variable is set it remains set across the sections, so you do not have to specify all the options in all sections. However one have to make sure that unwanted options are not set from previous sections.

---
 README.config-sections | 50 ++++++++++++++++++++++++++++++++++
 check                  | 73 +++++++++++++++++++++++++++++++++++++++++---------
 common/config          | 49 +++++++++++++++++++++++++++++++--
 3 files changed, 158 insertions(+), 14 deletions(-)
 create mode 100644 README.config-sections
README.config-sections new file +50 -0
new file mode 100644
index 0000000..6d88a6f
@@ -0,0 +1,50 @@
+Configuration file with sections
+================================
+
+Configuration file with sections is useful for running xfstests on multiple
+file systems, or multiple file system setups in a single run without any
+help of external scripts.
+
+Syntax for defining a section is the following:
+
+[section_name]
+
+Section name should consist of alphanumeric characters and '_'. Anything
+else is forbidden and the section will not be recognised.
+
+Each section in the configuration file should contain options in the format
+
+OPTION=value
+
+'OPTION' must not contain any white space characters. 'value' can contain
+any character you want with one simple limitation - characters ' and " can
+only appear at the start and end of the 'value', however it is not required.
+
+Note that options are carried between sections so the same options does not
+have to be specified in each and every sections. However caution should be
+exercised not to leave unwanted options set from previous sections.
+
+For every section xfstests will run with specified options and will produce
+separate results in the '$RESULT_BASE/$section_name' directory.
+
+Here is an example of config file with sections:
+
+[ext4_4k_block_size]
+TEST_DEV=/dev/sda
+TEST_DIR=/mnt/test
+SCRATCH_DEV=/dev/sdb
+SCRATCH_MNT=/mnt/test1
+MKFS_OPTIONS="-q -F -b4096"
+FSTYP=ext4
+
+[ext4_1k_block_size]
+MKFS_OPTIONS="-q -F -b1024"
+
+[ext4_nojournal]
+MKFS_OPTIONS="-q -F -b4096 -O ^has_journal"
+
+[ext4_discard_ssd]
+MKFS_OPTIONS="-q -F -b4096"
+TEST_DEV=/dev/sdc
+SCRATCH_DEV=/dev/sdd
+MOUNT_OPTIONS="-o discard"
check +61 -12

149 lines not on this page · raw message

common/config +47 -2

69 lines not on this page · raw message

Signature · 6 lines
1.8.3.1

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#17 lore raw

Re: [PATCH 08/10 v2] xfstests: Add support for sections in config file

Quoted 1 line · Lukas Czerner

This patch add support for sections in the config file. Each section can

s/add/adds/

Quoted 4 lines

contain configuration options in the format

OPTION=value

you can say something along the lines of.... sections would contain different environment variables that can change
- mount options
- mkfs options
- filesystem type
- different devices
- whatever I missed....
and xfs will be run with those options and then next section will be parsed and the tests will be run with those options etc.,

It would be useful to have see that information in README, not necessarily in commit log.

Quoted 4 lines

when one section is processed xfstests will proceed to next section until all secitons are processed, or an error occur.

The name of the section can consist of alphanumeric characters + '_',

s/+/and/

note: no comments below

Quoted 326 lines

nothing else is allowed. Name of the section is also used to create results subdirectory for each section. After all the sections are processed summary of all runs is printed out.

If the config file does not contain sections, or we're not using config file at all, nothing is changed and xfstests will work the same way as it used to.

This is very useful for testing file system with different options. Here is an example of the config file with sections:

[ext4_4k_block_size]
TEST_DEV=/dev/sda
TEST_DIR=/mnt/test
SCRATCH_DEV=/dev/sdb
SCRATCH_MNT=/mnt/test1
MKFS_OPTIONS="-q -F -b4096"
FSTYP=ext4

[ext4_1k_block_size]
MKFS_OPTIONS="-q -F -b1024"

[ext4_nojournal]
MKFS_OPTIONS="-q -F -b4096 -O ^has_journal"

[ext4_discard_ssd]
MKFS_OPTIONS="-q -F -b4096"
TEST_DEV=/dev/sdc
SCRATCH_DEV=/dev/sdd
MOUNT_OPTIONS="-o discard"

Note that once the variable is set it remains set across the sections, so you do not have to specify all the options in all sections. However one have to make sure that unwanted options are not set from previous sections.

---
 README.config-sections | 50 ++++++++++++++++++++++++++++++++++
 check                  | 73 +++++++++++++++++++++++++++++++++++++++++---------
 common/config          | 49 +++++++++++++++++++++++++++++++--
 3 files changed, 158 insertions(+), 14 deletions(-)
 create mode 100644 README.config-sections
README.config-sections new file +50 -0
new file mode 100644
index 0000000..6d88a6f
@@ -0,0 +1,50 @@
+Configuration file with sections
+================================
+
+Configuration file with sections is useful for running xfstests on multiple
+file systems, or multiple file system setups in a single run without any
+help of external scripts.
+
+Syntax for defining a section is the following:
+
+[section_name]
+
+Section name should consist of alphanumeric characters and '_'. Anything
+else is forbidden and the section will not be recognised.
+
+Each section in the configuration file should contain options in the format
+
+OPTION=value
+
+'OPTION' must not contain any white space characters. 'value' can contain
+any character you want with one simple limitation - characters ' and " can
+only appear at the start and end of the 'value', however it is not required.
+
+Note that options are carried between sections so the same options does not
+have to be specified in each and every sections. However caution should be
+exercised not to leave unwanted options set from previous sections.
+
+For every section xfstests will run with specified options and will produce
+separate results in the '$RESULT_BASE/$section_name' directory.
+
+Here is an example of config file with sections:
+
+[ext4_4k_block_size]
+TEST_DEV=/dev/sda
+TEST_DIR=/mnt/test
+SCRATCH_DEV=/dev/sdb
+SCRATCH_MNT=/mnt/test1
+MKFS_OPTIONS="-q -F -b4096"
+FSTYP=ext4
+
+[ext4_1k_block_size]
+MKFS_OPTIONS="-q -F -b1024"
+
+[ext4_nojournal]
+MKFS_OPTIONS="-q -F -b4096 -O ^has_journal"
+
+[ext4_discard_ssd]
+MKFS_OPTIONS="-q -F -b4096"
+TEST_DEV=/dev/sdc
+SCRATCH_DEV=/dev/sdd
+MOUNT_OPTIONS="-o discard"
check +61 -12
index 677650c..1df7a37 100755
@@ -22,9 +22,11 @@
 tmp=/tmp/$$
 status=0
 needwrap=true
+needsum=true
 n_try=0
 try=""
 n_bad=0
+sum_bad=0
 bad=""
 notrun=""
 interrupt=true
@@ -296,7 +298,12 @@ then
     exit 1
 fi
 
-# Ok, time to start running...
+_wipe_counters()
+{
+	n_try="0"
+	n_bad="0"
+	unset try notrun bad
+}
 
 _wrapup()
 {
@@ -325,16 +332,20 @@ END	{ if (NR > 0) {
 	date >>$check.log
 	echo $list | fmt | sed -e 's/^/    /' -e "s;$SRC_DIR/;;g" >>$check.log
 	$interrupt && echo "Interrupted!" >>$check.log
-        
+
+	echo "SECTION       -- $section" >>$tmp.summary
+	echo "=========================" >>$tmp.summary
         if [ ! -z "$n_try" -a $n_try != 0 ]
 	then
 	    echo "Ran:$try"
+	    echo "Ran:$try" >>$tmp.summary
 	fi
 
 	if [ ! -z "$notrun" ]
 	then
 	    echo "Not run:$notrun"
 	    echo "Not run:$notrun" >>$check.log
+	    echo "Not run:$notrun" >>$tmp.summary
 	fi
 
         if [ ! -z "$n_bad" -a $n_bad != 0 ]
@@ -343,20 +354,48 @@ END	{ if (NR > 0) {
 	    echo "Failed $n_bad of $n_try tests"
 	    echo "Failures:$bad" | fmt >>$check.log
 	    echo "Failed $n_bad of $n_try tests" >>$check.log
+	    echo "Failures:$bad" >>$tmp.summary
+	    echo "Failed $n_bad of $n_try tests" >>$tmp.summary
 	else
 	    echo "Passed all $n_try tests"
 	    echo "Passed all $n_try tests" >>$check.log
+	    echo "Passed all $n_try tests" >>$tmp.summary
 	fi
+	echo "" >>$tmp.summary
 	needwrap=false
     fi
 
+    sum_bad=`expr $sum_bad + $n_bad`
+    _wipe_counters
     rm -f /tmp/*.rawout /tmp/*.out /tmp/*.err /tmp/*.time
-    rm -f $tmp.*
+    if ! $OPTIONS_HAVE_SECTIONS; then
+        rm -f $tmp.*
+    fi
 }
 
-trap "_wrapup; exit \$status" 0 1 2 3 15
+_summary()
+{
+	_wrapup
+	if $showme; then
+		:
+	elif $needsum; then
+		count=`wc -L $tmp.summary | cut -f1 -d" "`
+		cat $tmp.summary
+		needsum=false
+	fi
+	rm -f $tmp.*
+}
+
+if $OPTIONS_HAVE_SECTIONS; then
+	trap "_summary; exit \$status" 0 1 2 3 15
+else
+	trap "_wrapup; exit \$status" 0 1 2 3 15
+fi
+
+for section in $HOST_OPTIONS_SECTIONS; do
+	get_next_config $section
+	init_rc
 
-if true; then
 	mkdir -p $RESULT_BASE
 	if [ ! -d $RESULT_BASE ]; then
 		echo "failed to create results directory $RESULTS_BASE"
@@ -366,12 +405,15 @@ if true; then
 	seq="check"
 	check="$RESULT_BASE/check"
 
-# don't leave old full output behind on a clean run
+	# don't leave old full output behind on a clean run
 	rm -f $check.full
 
 	[ -f $check.time ] || touch $check.time
 
-# print out our test configuration
+	# 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
@@ -379,7 +421,7 @@ if true; then
 		echo "MOUNT_OPTIONS -- `_scratch_mount_options`"
 	fi
 	echo
-
+	needwrap=true
 
 	if [ ! -z "$SCRATCH_DEV" ]; then
 		umount $SCRATCH_DEV 2>/dev/null
@@ -419,9 +461,14 @@ if true; then
 		# Similarly, the result directory needs to replace the tests/
 		# part of the test location.
 		group=`dirname $seq`
-		export RESULT_DIR=`echo $group | sed -e "s;$SRC_DIR;$RESULT_BASE;"`
+		if $OPTIONS_HAVE_SECTIONS; then
+			export RESULT_DIR=`echo $group | sed -e "s;$SRC_DIR;${RESULT_BASE}/$section;"`
+			seqres="$RESULT_BASE/$section/$seqnum"
+		else
+			export RESULT_DIR=`echo $group | sed -e "s;$SRC_DIR;$RESULT_BASE;"`
+			seqres="$RESULT_BASE/$seqnum"
+		fi
 		mkdir -p $RESULT_DIR
-		seqres="$RESULT_BASE/$seqnum"
 
 		echo -n "$seqnum"
 
@@ -535,8 +582,10 @@ if true; then
 
 		 seq="after_$seqnum"
 	done
-fi
+	_wrapup
+	echo
+done
 
 interrupt=false
-status=`expr $n_bad`
+status=`expr $sum_bad`
 exit
common/config +43 -1
index 39dd469..8011ec4 100644
@@ -221,15 +221,57 @@ known_hosts()
 	[ -f $HOST_CONFIG_DIR/$HOST.config ] && export HOST_OPTIONS=$HOST_CONFIG_DIR/$HOST.config
 }
 
+# Returns a list of sections in config file
+# Each section starts with the section name in the format
+# [section_name1]. Only alphanumeric characters and '_' is allowed
+# in the section name otherwise the section will not be resognised.
+# Section name must be contained between square brackets.
+get_config_sections() {
+	sed -n -e "s/^\[\([[:alnum:]_]*\)\]/\1/p" < $1
+}
+
 if [ ! -f "$HOST_OPTIONS" ]; then
 	known_hosts
 fi
 
+export HOST_OPTIONS_SECTIONS="-no-sections-"
+export OPTIONS_HAVE_SECTIONS=false
 if [ -f "$HOST_OPTIONS" ]; then
-	. $HOST_OPTIONS
+	export HOST_OPTIONS_SECTIONS=`get_config_sections $HOST_OPTIONS`
+	if [ -z "$HOST_OPTIONS_SECTIONS" ]; then
+		. $HOST_OPTIONS
+		export HOST_OPTIONS_SECTIONS="-no-sections-"
+	else
+		export OPTIONS_HAVE_SECTIONS=true
+	fi
 fi
 
+# Parse config section options. This function will parse all the configuration
+# within a single section which name is passed as an argument. For section
+# name format see comments in get_config_sections().
+# Empty lines and everything after '#' will be ignored.
+# Configuration options should be defined in the format
+#
+# CONFIG_OPTION=value
+#
+# This 'CONFIG_OPTION' variable and will be exported as an environment variable.
+parse_config_section() {
+	SECTION=$1
+	if ! $OPTIONS_HAVE_SECTIONS; then
+		return 0
+	fi
+	eval `sed -e 's/[[:space:]]*\=[[:space:]]*/=/g' \
+		-e 's/#.*$//' \
+		-e 's/[[:space:]]*$//' \
+		-e 's/^[[:space:]]*//' \
+		-e "s/^\(.*\)=\"\?'\?\([^\"']*\)\"\?'\?$/export \1=\"\2\"/" \
+		< $HOST_OPTIONS \
+		| sed -n -e "/^\[$SECTION\]/,/^\s*\[/{/^[^#].*\=.*/p;}"`
+}
+
 get_next_config() {
+	parse_config_section $1
+
 	# set default RESULT_BASE
 	if [ -z "$RESULT_BASE" ]; then
 		export RESULT_BASE="$here/results/"
@@ -282,7 +324,10 @@ get_next_config() {
 	fi

common/config get_next_config() { · line 333

Quoted 10 lines
common/config +4 -1
 }
 
-get_next_config
+if [ -z "$CONFIG_INCLUDED" ]; then
+	get_next_config `echo $HOST_OPTIONS_SECTIONS | cut -f1 -d" "`
+	export CONFIG_INCLUDED=true
+fi
 
 # make sure this script returns success
 /bin/true

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#18 lore raw

PATCH v2 9/10 xfstests: Allow to recreate TEST_DEV

In reply to Lukas Czerner

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.

---
 README.config-sections |  43 ++++++++++++++++----
 check                  |  33 ++++++++++++---
 common/config          | 106 +++++++++++++++++++++++++++++++++++++++++++++++++
 common/rc              |  26 +++++++++---
 4 files changed, 189 insertions(+), 19 deletions(-)
README.config-sections +36 -7
index 6d88a6f..4d60272 100644
@@ -5,16 +5,20 @@ Configuration file with sections is useful for running xfstests on multiple
 file systems, or multiple file system setups in a single run without any
 help of external scripts.
 
+
+Syntax
+------
+
 Syntax for defining a section is the following:
 
-[section_name]
+	[section_name]
 
 Section name should consist of alphanumeric characters and '_'. Anything
 else is forbidden and the section will not be recognised.
 
 Each section in the configuration file should contain options in the format
 
-OPTION=value
+	OPTION=value
 
 'OPTION' must not contain any white space characters. 'value' can contain
 any character you want with one simple limitation - characters ' and " can
@@ -24,9 +28,31 @@ Note that options are carried between sections so the same options does not
 have to be specified in each and every sections. However caution should be
 exercised not to leave unwanted options set from previous sections.
 
+
+Results
+-------
+
 For every section xfstests will run with specified options and will produce
 separate results in the '$RESULT_BASE/$section_name' directory.
 
+
+Multiple file systems
+---------------------
+
+Having different file systems in different config sections is allowed. When
+FSTYP differs in the following section the FSTYP file system will be created
+automatically before running the test.
+
+Note that if MOUNT_OPTIONS, MKFS_OPTIONS, or FSCK_OPTIONS are not directly
+specified in the section it will be reset to the default for a given file
+system.
+
+You can also force the file system recreation by specifying RECREATE_TEST_DEV.
+
+
+Example
+-------
+
 Here is an example of config file with sections:
 
 [ext4_4k_block_size]
@@ -36,6 +62,7 @@ SCRATCH_DEV=/dev/sdb
 SCRATCH_MNT=/mnt/test1
 MKFS_OPTIONS="-q -F -b4096"
 FSTYP=ext4
+RESULT_BASE="`pwd`/results/`date +%d%m%y_%H%M%S`"
 
 [ext4_1k_block_size]
 MKFS_OPTIONS="-q -F -b1024"
@@ -43,8 +70,10 @@ MKFS_OPTIONS="-q -F -b1024"
 [ext4_nojournal]
 MKFS_OPTIONS="-q -F -b4096 -O ^has_journal"
 
-[ext4_discard_ssd]
-MKFS_OPTIONS="-q -F -b4096"
-TEST_DEV=/dev/sdc
-SCRATCH_DEV=/dev/sdd
-MOUNT_OPTIONS="-o discard"
+[xfs_filesystem]
+MKFS_OPTIONS="-f"
+FSTYP=xfs
+
+[ext3_filesystem]
+FSTYP=ext3
+MOUNT_OPTIONS="-o noatime"
check +27 -6
index 1df7a37..5775276 100755
@@ -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_or_remount_ro $TEST_DEV 2>&1> /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
common/config +106 -0

126 lines not on this page · raw message

common/rc +20 -6
index 0dd30a3..10116a6 100644
@@ -152,12 +152,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
@@ -490,6 +484,7 @@ _setup_large_ext4_fs()
 	fi
 	return 0
 }
+
 _scratch_mkfs_ext4()
 {
 	local tmp_dir=/tmp/
@@ -518,6 +513,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
@@ -919,6 +932,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()
Signature · 6 lines
1.8.3.1

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#19 lore raw

Re: [PATCH 09/10 v2] xfstests: Allow to recreate TEST_DEV

Quoted 47 lines · Lukas Czerner

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.

---
 README.config-sections |  43 ++++++++++++++++----
 check                  |  33 ++++++++++++---
 common/config          | 106 +++++++++++++++++++++++++++++++++++++++++++++++++
 common/rc              |  26 +++++++++---
 4 files changed, 189 insertions(+), 19 deletions(-)
README.config-sections +6 -2
index 6d88a6f..4d60272 100644
@@ -5,16 +5,20 @@ Configuration file with sections is useful for running xfstests on multiple
 file systems, or multiple file system setups in a single run without any
 help of external scripts.
 
+
+Syntax
+------
+
 Syntax for defining a section is the following:
 
-[section_name]
+	[section_name]
 
 Section name should consist of alphanumeric characters and '_'. Anything
 else is forbidden and the section will not be recognised.
 
 Each section in the configuration file should contain options in the format
 
-OPTION=value
+	OPTION=value
 
 'OPTION' must not contain any white space characters. 'value' can contain
 any character you want with one simple limitation - characters ' and " can

README.config-sections Note that options are carried between sections so the same options does not · line 36

Quoted 9 lines
README.config-sections +4 -0
@@ -24,9 +28,31 @@ Note that options are carried between sections so the same options does not
 have to be specified in each and every sections. However caution should be
 exercised not to leave unwanted options set from previous sections.
 
+
+Results
+-------
+
 For every section xfstests will run with specified options and will produce
 separate results in the '$RESULT_BASE/$section_name' directory.

Above changes can be moved to previous patch

Quoted 9 lines
README.config-sections +8 -0
+
+Multiple file systems
+---------------------
+
+Having different file systems in different config sections is allowed. When
+FSTYP differs in the following section the FSTYP file system will be created
+automatically before running the test.
+

README.config-sections Note that options are carried between sections so the same options does not · line 55

Quoted 10 lines
README.config-sections +10 -0
+Note that if MOUNT_OPTIONS, MKFS_OPTIONS, or FSCK_OPTIONS are not directly
+specified in the section it will be reset to the default for a given file
+system.
+
+You can also force the file system recreation by specifying RECREATE_TEST_DEV.
+
+
+Example
+-------
+

This too (can be moved to previous patch).

README.config-sections SCRATCH_DEV=/dev/sdb · line 65

Quoted 8 lines
README.config-sections +1 -0
 Here is an example of config file with sections:
 
 [ext4_4k_block_size]
@@ -36,6 +62,7 @@ SCRATCH_DEV=/dev/sdb
 SCRATCH_MNT=/mnt/test1
 MKFS_OPTIONS="-q -F -b4096"
 FSTYP=ext4
+RESULT_BASE="`pwd`/results/`date +%d%m%y_%H%M%S`"

This too (can be moved to previous patch).

Quoted 119 lines
README.config-sections +7 -5
 [ext4_1k_block_size]
 MKFS_OPTIONS="-q -F -b1024"
@@ -43,8 +70,10 @@ MKFS_OPTIONS="-q -F -b1024"
 [ext4_nojournal]
 MKFS_OPTIONS="-q -F -b4096 -O ^has_journal"
 
-[ext4_discard_ssd]
-MKFS_OPTIONS="-q -F -b4096"
-TEST_DEV=/dev/sdc
-SCRATCH_DEV=/dev/sdd
-MOUNT_OPTIONS="-o discard"
+[xfs_filesystem]
+MKFS_OPTIONS="-f"
+FSTYP=xfs
+
+[ext3_filesystem]
+FSTYP=ext3
+MOUNT_OPTIONS="-o noatime"
check +27 -6
index 1df7a37..5775276 100755
@@ -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_or_remount_ro $TEST_DEV 2>&1> /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
common/config +12 -0
index 8011ec4..a0b650b 100644
@@ -82,6 +82,8 @@ export PWD=`pwd`
 export MALLOCLIB=${MALLOCLIB:=/usr/lib/libefence.a}
 export LOCAL_CONFIGURE_OPTIONS=${LOCAL_CONFIGURE_OPTIONS:=--enable-readline=yes}
 
+export RECREATE_TEST_DEV=false
+
 # $1 = prog to look for, $2* = default pathnames if not found in $PATH
 set_prog_path()
 {
@@ -212,6 +214,91 @@ case "$HOSTOS" in
         ;;
 esac
 
+_mount_opts()
+{
+	# SELinux adds extra xattrs which can mess up our expected output.
+	# So, mount with a context, and they won't be created
+	# # nfs_t is a "liberal" context so we can use it.
+	if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then
+		SELINUX_MOUNT_OPTIONS="-o context=system_u:object_r:nfs_t:s0"
+		export SELINUX_MOUNT_OPTIONS
+	fi
+

common/config case "$HOSTOS" in · line 236

Quoted 10 lines
common/config +10 -0
+	case $FSTYP in
+	xfs)
+		export MOUNT_OPTIONS=$XFS_MOUNT_OPTIONS
+		;;
+	udf)
+		export MOUNT_OPTIONS=$UDF_MOUNT_OPTIONS
+		;;
+	nfs)
+		export MOUNT_OPTIONS=$NFS_MOUNT_OPTIONS
+		;;

If we need to have these as default for these filesystem below (in these scenario), shouldn't we change them to be the default for other invocations too ?

Basically, change what is default for those filesystems and use them directly (as xfs, udf and nfs above) here. What do you think ?

Quoted 14 lines
common/config +13 -0
+	ext2|ext3|ext4|ext4dev)
+		# acls & xattrs aren't turned on by default on ext$FOO
+		export MOUNT_OPTIONS="-o acl,user_xattr $EXT_MOUNT_OPTIONS"
+		;;
+	reiserfs)
+		# acls & xattrs aren't turned on by default on reiserfs
+		export MOUNT_OPTIONS="-o acl,user_xattr $REISERFS_MOUNT_OPTIONS"
+		;;
+	gfs2)
+		# acls aren't turned on by default on gfs2
+		export MOUNT_OPTIONS="-o acl $GFS2_MOUNT_OPTIONS"
+		;;
+	*)

common/config case "$HOSTOS" in · line 259

Quoted 10 lines
common/config +10 -0
+		;;
+	esac
+}
+
+_mkfs_opts()
+{
+	case $FSTYP in
+	xfs)
+		export MKFS_OPTIONS=$XFS_MKFS_OPTIONS
+		;;

Same comment as above here too

Quoted 124 lines
common/config +61 -0
+	udf)
+		[ ! -z "$udf_fsize" ] && \
+			UDF_MKFS_OPTIONS="$UDF_MKFS_OPTIONS -s $udf_fsize"
+		export MKFS_OPTIONS=$UDF_MKFS_OPTIONS
+		;;
+	nfs)
+		export MKFS_OPTIONS=$NFS_MKFS_OPTIONS
+		;;
+	reiserfs)
+		export MKFS_OPTIONS="$REISERFS_MKFS_OPTIONS -q"
+		;;
+	gfs2)
+		export MKFS_OPTIONS="$GFS2_MKFS_OPTIONS -O -p lock_nolock"
+		;;
+	jfs)
+		export MKFS_OPTIONS="$JFS_MKFS_OPTIONS -q"
+		;;
+	*)
+		;;
+	esac
+}
+
+_fsck_opts()
+{
+	case $FSTYP in
+	ext2|ext3|ext4|ext4dev)
+		export FSCK_OPTIONS="-nf"
+		;;
+	reiserfs)
+		export FSCK_OPTIONS="--yes"
+		;;
+	*)
+		export FSCK_OPTIONS="-n"
+		;;
+	esac
+}
+
+[ -z "$FSTYP" ] && export FSTYP=xfs
+[ -z "$MOUNT_OPTIONS" ] && _mount_opts
+[ -z "$MKFS_OPTIONS" ] && _mkfs_opts
+[ -z "$FSCK_OPTIONS" ] && _fsck_opts
+
 known_hosts()
 {
 	[ "$HOST_CONFIG_DIR" ] || HOST_CONFIG_DIR=`pwd`/configs
@@ -270,8 +357,27 @@ parse_config_section() {
 }
 
 get_next_config() {
+	local OLD_FSTYP=$FSTYP
+	local OLD_MOUNT_OPTIONS=$MOUNT_OPTIONS
+	local OLD_MKFS_OPTIONS=$MKFS_OPTIONS
+	local OLD_FSCK_OPTIONS=$FSCK_OPTIONS
+
+	unset MOUNT_OPTIONS
+	unset MKFS_OPTIONS
+	unset FSCK_OPTIONS
+
 	parse_config_section $1
 
+	if [ -n "$OLD_FSTYP" ] && [ $OLD_FSTYP != $FSTYP ]; then
+		[ -z "$MOUNT_OPTIONS" ] && _mount_opts
+		[ -z "$MKFS_OPTIONS" ] && _mkfs_opts
+		[ -z "$FSCK_OPTIONS" ] && _fsck_opts
+	else
+		[ -z "$MOUNT_OPTIONS" ] && export MOUNT_OPTIONS=$OLD_MOUNT_OPTIONS
+		[ -z "$MKFS_OPTIONS" ] && export MKFS_OPTIONS=$OLD_MKFS_OPTIONS
+		[ -z "$FSCK_OPTIONS" ] && export FSCK_OPTIONS=$OLD_FSCK_OPTIONS
+	fi
+
 	# set default RESULT_BASE
 	if [ -z "$RESULT_BASE" ]; then
 		export RESULT_BASE="$here/results/"
common/rc +19 -6
index 0dd30a3..10116a6 100644
@@ -152,12 +152,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
@@ -490,6 +484,7 @@ _setup_large_ext4_fs()
 	fi
 	return 0
 }
+
 _scratch_mkfs_ext4()
 {
 	local tmp_dir=/tmp/
@@ -518,6 +513,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

common/rc _supported_fs() · line 938

Quoted 7 lines
common/rc +1 -0
@@ -919,6 +932,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()

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#20 lore raw

PATCH v2 10/10 xfstests: Remount file system if MOUNT_OPTIONS changed

In reply to Lukas Czerner

When MOUNT_OPTIONS change we should remount TEST_DEV to put the changes in effect. This will allow us to have different MOUNT_OPTIONS in sections in configuration file.

---
 README.config-sections | 8 ++++++++
 check                  | 8 ++++++++
 2 files changed, 16 insertions(+)
README.config-sections +8 -0
index 4d60272..2849fd5 100644
@@ -36,6 +36,14 @@ For every section xfstests will run with specified options and will produce
 separate results in the '$RESULT_BASE/$section_name' directory.
 
 
+Different mount options
+-----------------------
+
+Specifying different mount options in difference config sections is allowed.
+When MOUNT_OPTIONS differs in the following section TEST_DEV will be remounted
+with new MOUNT_OPTIONS automatically before running the test.
+
+
 Multiple file systems
 ---------------------
 
check +8 -0
index 5775276..ef91260 100755
@@ -394,6 +394,7 @@ fi
 
 for section in $HOST_OPTIONS_SECTIONS; do
 	OLD_FSTYP=$FSTYP
+	OLD_MOUNT_OPTIONS=$MOUNT_OPTIONS
 	get_next_config $section
 
 	mkdir -p $RESULT_BASE
@@ -422,6 +423,13 @@ for section in $HOST_OPTIONS_SECTIONS; do
 			exit 1
 		fi
 		_prepare_test_list
+	elif [ "$OLD_MOUNT_OPTIONS" != "$MOUNT_OPTIONS" ]; then
+		_umount_or_remount_ro $TEST_DEV 2>&1> /dev/null
+		out=`_mount_or_remount_rw "$MOUNT_OPTIONS" $TEST_DEV $TEST_DIR`
+		if [ $? -ne 1 ]; then
+			echo $out
+			exit 1
+		fi
 	fi
 
 	init_rc
Signature · 6 lines
1.8.3.1

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by on v2 10/10
#21 lore raw

Re: [PATCH 10/10 v2] xfstests: Remount file system if MOUNT_OPTIONS changed

Quoted 5 lines · Lukas Czerner

When MOUNT_OPTIONS change we should remount TEST_DEV to put the changes in effect. This will allow us to have different MOUNT_OPTIONS in sections in configuration file.

Quoted 40 lines
---
 README.config-sections | 8 ++++++++
 check                  | 8 ++++++++
 2 files changed, 16 insertions(+)
README.config-sections +8 -0
index 4d60272..2849fd5 100644
@@ -36,6 +36,14 @@ For every section xfstests will run with specified options and will produce
 separate results in the '$RESULT_BASE/$section_name' directory.
 
 
+Different mount options
+-----------------------
+
+Specifying different mount options in difference config sections is allowed.
+When MOUNT_OPTIONS differs in the following section TEST_DEV will be remounted
+with new MOUNT_OPTIONS automatically before running the test.
+
+
 Multiple file systems
 ---------------------
 
check +1 -0
index 5775276..ef91260 100755
@@ -394,6 +394,7 @@ fi
 
 for section in $HOST_OPTIONS_SECTIONS; do
 	OLD_FSTYP=$FSTYP
+	OLD_MOUNT_OPTIONS=$MOUNT_OPTIONS
 	get_next_config $section
 
 	mkdir -p $RESULT_BASE
@@ -422,6 +423,13 @@ for section in $HOST_OPTIONS_SECTIONS; do
 			exit 1
 		fi
 		_prepare_test_list

check for section in $HOST_OPTIONS_SECTIONS; do · line 435

Quoted 10 lines
check +7 -0
+	elif [ "$OLD_MOUNT_OPTIONS" != "$MOUNT_OPTIONS" ]; then
+		_umount_or_remount_ro $TEST_DEV 2>&1> /dev/null
+		out=`_mount_or_remount_rw "$MOUNT_OPTIONS" $TEST_DEV $TEST_DIR`
+		if [ $? -ne 1 ]; then
+			echo $out
+			exit 1
+		fi
 	fi
 
 	init_rc

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#22 lore raw

Re: [PATCH 10/10 v2] xfstests: Remount file system if MOUNT_OPTIONS changed

In reply to Lukas Czerner

Hi Lukas,

Quoted 46 lines · Lukas Czerner

When MOUNT_OPTIONS change we should remount TEST_DEV to put the changes in effect. This will allow us to have different MOUNT_OPTIONS in sections in configuration file.

---
  README.config-sections | 8 ++++++++
  check                  | 8 ++++++++
  2 files changed, 16 insertions(+)
README.config-sections +8 -0
index 4d60272..2849fd5 100644
@@ -36,6 +36,14 @@ For every section xfstests will run with specified options and will produce
  separate results in the '$RESULT_BASE/$section_name' directory.
 
 
+Different mount options
+-----------------------
+
+Specifying different mount options in difference config sections is allowed.
+When MOUNT_OPTIONS differs in the following section TEST_DEV will be remounted
+with new MOUNT_OPTIONS automatically before running the test.
+
+
  Multiple file systems
  ---------------------
 
check +1 -0
index 5775276..ef91260 100755
@@ -394,6 +394,7 @@ fi
 
  for section in $HOST_OPTIONS_SECTIONS; do
  	OLD_FSTYP=$FSTYP
+	OLD_MOUNT_OPTIONS=$MOUNT_OPTIONS
  	get_next_config $section
 
  	mkdir -p $RESULT_BASE
@@ -422,6 +423,13 @@ for section in $HOST_OPTIONS_SECTIONS; do
  			exit 1
  		fi
  		_prepare_test_list

check for section in $HOST_OPTIONS_SECTIONS; do · line 435

Quoted 10 lines
check +7 -0
+	elif [ "$OLD_MOUNT_OPTIONS" != "$MOUNT_OPTIONS" ]; then
+		_umount_or_remount_ro $TEST_DEV 2>&1> /dev/null
+		out=`_mount_or_remount_rw "$MOUNT_OPTIONS" $TEST_DEV $TEST_DIR`
+		if [ $? -ne 1 ]; then
+			echo $out
+			exit 1
+		fi
  	fi
 
  	init_rc

Sorry this took so long to get to but this no longer applies cleanly.

Thanks
--Rich

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#23 lore raw

Re: [PATCH 10/10 v2] xfstests: Remount file system if MOUNT_OPTIONS changedx

Quoted 67 lines · Rich Johnston

Date: Wed, 16 Oct 2013 15:51:21 -0500
From: Rich Johnston <[email protected]>
To: Lukas Czerner <[email protected]>, [email protected]
Subject: Re: [PATCH 10/10 v2] xfstests: Remount file system if MOUNT_OPTIONS
changed

Hi Lukas,

Quoted 58 lines · Lukas Czerner

When MOUNT_OPTIONS change we should remount TEST_DEV to put the changes in effect. This will allow us to have different MOUNT_OPTIONS in sections in configuration file.

---
  README.config-sections | 8 ++++++++
  check                  | 8 ++++++++
  2 files changed, 16 insertions(+)
README.config-sections +0 -0
index 4d60272..2849fd5 100644
@@ -36,6 +36,14 @@ For every section xfstests will run with specified

options and will produce
separate results in the '$RESULT_BASE/$section_name' directory.

README.config-sections +4 -0
+Different mount options
+-----------------------
+
+Specifying different mount options in difference config sections is

allowed.
+When MOUNT_OPTIONS differs in the following section TEST_DEV will be remounted

README.config-sections +3 -0
+with new MOUNT_OPTIONS automatically before running the test.
+
+
  Multiple file systems
  ---------------------
check +4 -0
index 5775276..ef91260 100755
@@ -394,6 +394,7 @@ fi
 
  for section in $HOST_OPTIONS_SECTIONS; do
  	OLD_FSTYP=$FSTYP
+	OLD_MOUNT_OPTIONS=$MOUNT_OPTIONS
  	get_next_config $section
 
  	mkdir -p $RESULT_BASE
@@ -422,6 +423,13 @@ for section in $HOST_OPTIONS_SECTIONS; do
  			exit 1
  		fi
  		_prepare_test_list
+	elif [ "$OLD_MOUNT_OPTIONS" != "$MOUNT_OPTIONS" ]; then
+		_umount_or_remount_ro $TEST_DEV 2>&1> /dev/null
+		out=`_mount_or_remount_rw "$MOUNT_OPTIONS" $TEST_DEV

$TEST_DIR`

check +4 -0
+		if [ $? -ne 1 ]; then
+			echo $out
+			exit 1
+		fi
  	fi
Quoted 4 lines
Quoted 2 lines

init_rc

Sorry this took so long to get to but this no longer applies cleanly.

Yeah, it has been a long time. I planned to rebase and resend, however I have not had a time to do so. But hopefully I'll be able to get to it at some point.

Thanks!
-Lukas

Quoted 4 lines

Thanks
--Rich

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#24 lore raw
In reply to Lukas Czerner

Hey Lukas thanks for the patchset,

I have committed the reviewed patches 2, 4, 5 and 6.
Patches 3 and 10 have also been reviewed by Chandra but no longer apply cleanly to the current tree. The other patches 1, 7, 8 and 9 are waiting your response to Chandras comments.

Thanks again
--Rich

commit c8527d1c8a90fc0dcb0c8edfc8ddf4c19267bd64

Author: Lukas Czerner <[email protected]>
Date:   Thu Jul 11 10:37:57 2013 +0000

xfstests: Export all important variables in common/config

commit 2ff460998d3c548da9c29c2a52a7f419a309a154

Author: Lukas Czerner <[email protected]>
Date:   Thu Jul 11 10:37:59 2013 +0000

xfstests: Allow to recheck options in common/rc

commit dcaf8661876c438f31eda196232d950f65648e96

Author: Lukas Czerner <[email protected]>
Date:   Thu Jul 11 10:38:00 2013 +0000

xfstests: Allow to re-read configuration

commit 9fe92ade36a71322e15fc1a57a3edc4a94c6d2c4

Author: Lukas Czerner <[email protected]>
Date:   Thu Jul 11 10:38:01 2013 +0000

xfstests: Allow to specify RESULT_BASE directory

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs