From: Lukas Czerner Date: Tue, 8 Apr 2014 23:55:52 +0000 (+1000) Subject: config: Fix setting FSTYP automatically X-Git-Tag: v2022.05.01~3187 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=e0f5daf3710778862c8ab88679ae3b8e9bc64cf1;p=users%2Fhch%2Fxfstests-dev.git config: Fix setting FSTYP automatically Currently if the FSTYP is not set, the code to get FSTYP using blikd would not work. This is because we're using HOSTOS environment variable which might not be set (at least not on my system) and because it's already late in the code path. Fix this by using OSTYP environment variable as a fallback in the case that HOSTOS does not work and move the check to common/config. Signed-off-by: Lukas Czerner Tested-by: Filipe David Manana Reviewed-by: Dave Chinner Signed-off-by: Dave Chinner --- diff --git a/check b/check index 8f1a6e146..ed1834dcc 100755 --- a/check +++ b/check @@ -58,14 +58,6 @@ then exit 1 fi -# Autodetect fs type based on what's on $TEST_DEV unless it's been set -# externally -if [ -z "$FSTYP" -a "$HOSTOS" == "Linux" ]; then - FSTYP=`blkid -c /dev/null -s TYPE -o value $TEST_DEV` -fi -FSTYP=${FSTYP:=xfs} -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" diff --git a/common/config b/common/config index 316380144..00249e6a4 100644 --- a/common/config +++ b/common/config @@ -297,11 +297,6 @@ _fsck_opts() 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 @@ -446,6 +441,19 @@ get_next_config() { if [ -z "$CONFIG_INCLUDED" ]; then get_next_config `echo $HOST_OPTIONS_SECTIONS | cut -f1 -d" "` export CONFIG_INCLUDED=true + + # Autodetect fs type based on what's on $TEST_DEV unless it's been set + # externally + if [ -z "$FSTYP" ] && \ + [ "$HOSTOS" == "Linux" -o "$OSTYPE" == "linux-gnu" ] && \ + [ ! -z "$TEST_DEV" ]; then + FSTYP=`blkid -c /dev/null -s TYPE -o value $TEST_DEV` + fi + FSTYP=${FSTYP:=xfs} + export FSTYP + [ -z "$MOUNT_OPTIONS" ] && _mount_opts + [ -z "$MKFS_OPTIONS" ] && _mkfs_opts + [ -z "$FSCK_OPTIONS" ] && _fsck_opts fi # make sure this script returns success