common: drop HOSTOS
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 18 Sep 2020 02:10:22 +0000 (19:10 -0700)
committerEryu Guan <guaneryu@gmail.com>
Sun, 20 Sep 2020 17:18:26 +0000 (01:18 +0800)
We effectively support only Linux these days, so drop most of the
special casing of HOSTOS.  We'll retain the simple check just in case
someone tries to run this on a different operating system.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/config
common/rc
common/xfs

index 1fe1e0e18867d8416e9b531afabebfd6c24ade7e..3de87ea7d0a67264620cf2beadd5e0e358bd830f 100644 (file)
@@ -46,7 +46,7 @@ export LC_ALL=C
 PATH=".:$PATH"
 
 export HOST=`hostname -s`
-export HOSTOS=`uname -s`
+test `uname -s` = "Linux" || _fatal "fstests only supports Linux"
 
 export MODULAR=0               # using XFS as a module or not
 export BOOT="/boot"            # install target for kernels
@@ -143,7 +143,7 @@ export PS_ALL_FLAGS="-ef"
 
 export DF_PROG="$(type -P df)"
 [ "$DF_PROG" = "" ] && _fatal "df not found"
-[ "$HOSTOS" = "Linux" ] && export DF_PROG="$DF_PROG -T -P"
+export DF_PROG="$DF_PROG -T -P"        # Linux
 
 export XFS_IO_PROG="$(type -P xfs_io)"
 [ "$XFS_IO_PROG" = "" ] && _fatal "xfs_io not found"
@@ -242,29 +242,25 @@ if [ "$UDEV_SETTLE_PROG" == "" ]; then
 fi
 export UDEV_SETTLE_PROG
 
-case "$HOSTOS" in
-    Linux)
-       export MKFS_XFS_PROG=$(type -P mkfs.xfs)
-       export MKFS_EXT4_PROG=$(type -P mkfs.ext4)
-       export MKFS_UDF_PROG=$(type -P mkudffs)
-       export MKFS_BTRFS_PROG=$(set_mkfs_prog_path_with_opts btrfs)
-       export MKFS_F2FS_PROG=$(set_mkfs_prog_path_with_opts f2fs)
-       export DUMP_F2FS_PROG=$(type -P dump.f2fs)
-       export F2FS_IO_PROG=$(type -P f2fs_io)
-       export BTRFS_UTIL_PROG=$(type -P btrfs)
-       export BTRFS_SHOW_SUPER_PROG=$(type -P btrfs-show-super)
-       export BTRFS_CONVERT_PROG=$(type -P btrfs-convert)
-       export BTRFS_TUNE_PROG=$(type -P btrfstune)
-       export XFS_FSR_PROG=$(type -P xfs_fsr)
-       export MKFS_NFS_PROG="false"
-       export MKFS_CIFS_PROG="false"
-       export MKFS_OVERLAY_PROG="false"
-       export MKFS_REISER4_PROG=$(type -P mkfs.reiser4)
-       export E2FSCK_PROG=$(type -P e2fsck)
-       export TUNE2FS_PROG=$(type -P tune2fs)
-       export FSCK_OVERLAY_PROG=$(type -P fsck.overlay)
-        ;;
-esac
+export MKFS_XFS_PROG=$(type -P mkfs.xfs)
+export MKFS_EXT4_PROG=$(type -P mkfs.ext4)
+export MKFS_UDF_PROG=$(type -P mkudffs)
+export MKFS_BTRFS_PROG=$(set_mkfs_prog_path_with_opts btrfs)
+export MKFS_F2FS_PROG=$(set_mkfs_prog_path_with_opts f2fs)
+export DUMP_F2FS_PROG=$(type -P dump.f2fs)
+export F2FS_IO_PROG=$(type -P f2fs_io)
+export BTRFS_UTIL_PROG=$(type -P btrfs)
+export BTRFS_SHOW_SUPER_PROG=$(type -P btrfs-show-super)
+export BTRFS_CONVERT_PROG=$(type -P btrfs-convert)
+export BTRFS_TUNE_PROG=$(type -P btrfstune)
+export XFS_FSR_PROG=$(type -P xfs_fsr)
+export MKFS_NFS_PROG="false"
+export MKFS_CIFS_PROG="false"
+export MKFS_OVERLAY_PROG="false"
+export MKFS_REISER4_PROG=$(type -P mkfs.reiser4)
+export E2FSCK_PROG=$(type -P e2fsck)
+export TUNE2FS_PROG=$(type -P tune2fs)
+export FSCK_OVERLAY_PROG=$(type -P fsck.overlay)
 
 # SELinux adds extra xattrs which can mess up our expected output.
 # So, mount with a context, and they won't be created.
@@ -753,9 +749,7 @@ if [ -z "$CONFIG_INCLUDED" ]; then
 
        # 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
+       if [ -z "$FSTYP" ] && [ ! -z "$TEST_DEV" ]; then
                FSTYP=`blkid -c /dev/null -s TYPE -o value $TEST_DEV`
        fi
        FSTYP=${FSTYP:=xfs}
index 861eac3b1999ee42e574ac8fdcd9b618c6479651..a2ac967e31c2ba909457497d161d45d1f7b92280 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -31,19 +31,13 @@ _math()
 
 dd()
 {
-   if [ "$HOSTOS" == "Linux" ]
-   then        
        command dd --help 2>&1 | grep noxfer >/dev/null
-       
        if [ "$?" -eq 0 ]
            then
                command dd status=noxfer $@
            else
                command dd $@
-       fi
-   else
-       command dd $@
-   fi
+       fi
 }
 
 # Prints the md5 checksum of a given file
@@ -971,7 +965,7 @@ _scratch_mkfs_sized()
 
     local blocks=`expr $fssize / $blocksize`
 
-    if [ "$HOSTOS" == "Linux" -a -b "$SCRATCH_DEV" ]; then
+    if [ -b "$SCRATCH_DEV" ]; then
        local devsize=`blockdev --getsize64 $SCRATCH_DEV`
        [ "$fssize" -gt "$devsize" ] && _notrun "Scratch device too small"
     fi
@@ -1743,11 +1737,6 @@ _require_logdev()
 #
 _require_loop()
 {
-    if [ "$HOSTOS" != "Linux" ]
-    then
-       _notrun "This test requires linux for loopback device support"
-    fi
-
     modprobe loop >/dev/null 2>&1
     if grep loop /proc/devices >/dev/null 2>&1
     then
@@ -1761,11 +1750,6 @@ _require_loop()
 #
 _require_ext2()
 {
-    if [ "$HOSTOS" != "Linux" ]
-    then
-       _notrun "This test requires linux for ext2 filesystem support"
-    fi
-
     modprobe ext2 >/dev/null 2>&1
     if grep ext2 /proc/filesystems >/dev/null 2>&1
     then
index 6520ad290a304d463c048f00d661a2008a7c808f..79dab0583b40104e3bc95641d23ddfbf39530268 100644 (file)
@@ -465,7 +465,7 @@ _check_xfs_filesystem()
 
        $XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
                | tee $tmp.logprint | grep -q "<CLEAN>"
-       if [ $? -ne 0 -a "$HOSTOS" = "Linux" ]; then
+       if [ $? -ne 0 ]; then
                _log_err "_check_xfs_filesystem: filesystem on $device has dirty log"
                echo "*** xfs_logprint -t output ***"   >>$seqres.full
                cat $tmp.logprint                       >>$seqres.full