Currently 'new' script sources common/config which tries to find
mkfs and fails if not found (which is likely for non-root user).
This is inconvenient as development usually does not happen as root.
In fact the vast majority of setup in common/config and common/rc is
not necessary for 'new'. Split out the necessary bits into new
common/test_names and use it in 'new'. Cleanup common/rc and
common/config now that they're only used from 'check' and 'setup'.
Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
-# we need common/config, source it after processing args, overlay needs FSTYP
-# set before sourcing common/config
-if ! . ./common/config; then
- echo "$iam: failed to source common/config"
+# we need common/rc, that also sources common/config. We need to source it
+# after processing args, overlay needs FSTYP set before sourcing common/config
+if ! . ./common/rc; then
+ echo "check: failed to source common/rc"
-# we need common/rc
-if ! . ./common/rc
-then
- echo "check: failed to source common/rc"
- exit 1
-fi
-
if [ `id -u` -ne 0 ]
then
echo "check: QA must be run as root"
if [ `id -u` -ne 0 ]
then
echo "check: QA must be run as root"
# validity or mountedness.
#
# validity or mountedness.
#
# all tests should use a common language setting to prevent golden
# output mismatches.
export LANG=C
# all tests should use a common language setting to prevent golden
# output mismatches.
export LANG=C
rm -f /tmp/crc_check.img
export XFS_MKFS_HAS_NO_META_SUPPORT
rm -f /tmp/crc_check.img
export XFS_MKFS_HAS_NO_META_SUPPORT
-# new doesn't need config file parsed, we can stop here
-if [ "$iam" == "new" ]; then
- return 0
-fi
-
_mount_opts()
{
case $FSTYP in
_mount_opts()
{
case $FSTYP in
# Mountain View, CA 94043, USA, or: http://www.sgi.com
#-----------------------------------------------------------------------
# Mountain View, CA 94043, USA, or: http://www.sgi.com
#-----------------------------------------------------------------------
-BC=$(which bc 2> /dev/null) || BC=
-# Valid test names start with 3 digits "NNN":
-# "[0-9]\{3\}"
-# followed by an optional "-":
-# "-\?"
-# followed by an optional combination of alphanumeric and "-" chars:
-# "[[:alnum:]-]*"
-# e.g. 999-the-mark-of-fstests
-#
-VALID_TEST_ID="[0-9]\{3\}"
-VALID_TEST_NAME="$VALID_TEST_ID-\?[[:alnum:]-]*"
+BC=$(which bc 2> /dev/null) || BC=
# Some tests are not relevant or functional when testing XFS realtime
# subvolumes along with the rtinherit=1 mkfs option. In these cases,
# Some tests are not relevant or functional when testing XFS realtime
# subvolumes along with the rtinherit=1 mkfs option. In these cases,
ls -l $* | sed "s/\(^[-rwxdlbcpsStT]*\)\. /\1 /" | grep -v 'lost+found'
}
ls -l $* | sed "s/\(^[-rwxdlbcpsStT]*\)\. /\1 /" | grep -v 'lost+found'
}
-# we need common/config
-if [ "$iam" != "check" ]
-then
- if ! . ./common/config
- then
- echo "$iam: failed to source common/config"
- exit 1
- fi
-fi
-
_dump_err()
{
_err_msg="$*"
_dump_err()
{
_err_msg="$*"
- if [ "$iam" == new ]
- then
- return
- fi
# make some further configuration checks here
if [ "$TEST_DEV" = "" ]
then
# make some further configuration checks here
if [ "$TEST_DEV" = "" ]
then
--- /dev/null
+##/bin/bash
+
+# Valid test names start with 3 digits "NNN":
+# "[0-9]\{3\}"
+# followed by an optional "-":
+# "-\?"
+# followed by an optional combination of alphanumeric and "-" chars:
+# "[[:alnum:]-]*"
+# e.g. 999-the-mark-of-fstests
+#
+VALID_TEST_ID="[0-9]\{3\}"
+VALID_TEST_NAME="$VALID_TEST_ID-\?[[:alnum:]-]*"
# generic initialization
iam=new
# generic initialization
iam=new
trap "rm -f /tmp/$$.; exit" 0 1 2 3 15
trap "rm -f /tmp/$$.; exit" 0 1 2 3 15
eof=1
[ -f "$tdir/group" ] || usage
eof=1
[ -f "$tdir/group" ] || usage
+export AWK_PROG="$(type -P awk)"
+[ "$AWK_PROG" = "" ] && { echo "awk not found"; exit; }
+
for found in `cat $tdir/group | tr - ' ' | $AWK_PROG '{ print $1 }'`
do
line=$((line+1))
for found in `cat $tdir/group | tr - ' ' | $AWK_PROG '{ print $1 }'`
do
line=$((line+1))