fstests: Make ./new work for non-root user

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>
This commit is contained in:
Jan Kara
2018-05-29 18:51:19 +02:00
committed by Eryu Guan
parent c4f104cdf4
commit 141bd37a36
5 changed files with 24 additions and 42 deletions
+2 -25
View File
@@ -20,18 +20,9 @@
# Mountain View, CA 94043, USA, or: http://www.sgi.com
#-----------------------------------------------------------------------
BC=$(which bc 2> /dev/null) || BC=
. common/config
# 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,
@@ -110,16 +101,6 @@ _ls_l()
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="$*"
@@ -3574,10 +3555,6 @@ _disable_dmesg_check()
init_rc()
{
if [ "$iam" == new ]
then
return
fi
# make some further configuration checks here
if [ "$TEST_DEV" = "" ]
then