common/fuzzy: if the fuzz verb is random, keep fuzzing until we get a new value
[xfstests-dev.git] / common / config
index b29c0eb0e691d6cf50cda3ad77bf404a491823fc..4b3402e675bd32f76da7f2ad373c961f94d094e9 100644 (file)
 export LANG=C
 export LC_ALL=C
 
-# Warning: don't put freeware before /usr/bsd on IRIX coz you'll
-#  get the wrong hostname and set your system name to -s  :)
-[ -d /usr/bsd ] && PATH=$PATH:/usr/bsd
-[ -d /usr/freeware/bin ] && PATH=$PATH:/usr/freeware/bin
 PATH=".:$PATH"
 
 export HOST=`hostname -s`
 export HOSTOS=`uname -s`
-[ "$HOSTOS" = "IRIX64" ] && export HOSTOS="IRIX"
 
 export MODULAR=0               # using XFS as a module or not
 export BOOT="/boot"            # install target for kernels
@@ -96,12 +91,7 @@ export RECREATE_TEST_DEV=false
 # $1 = prog to look for
 set_prog_path()
 {
-    p=`which $1 2> /dev/null`
-    if [ -n "$p" -a -x "$p" ]; then
-        echo $p
-        return 0
-    fi
-    return 1
+       type -P $1
 }
 
 # Handle mkfs.btrfs which does (or does not) require -f to overwrite
@@ -159,6 +149,7 @@ export XFS_LOGPRINT_PROG="`set_prog_path xfs_logprint`"
 export XFS_REPAIR_PROG="`set_prog_path xfs_repair`"
 export XFS_DB_PROG="`set_prog_path xfs_db`"
 export XFS_GROWFS_PROG=`set_prog_path xfs_growfs`
+export XFS_SPACEMAN_PROG="`set_prog_path xfs_spaceman`"
 export XFS_SCRUB_PROG="`set_prog_path xfs_scrub`"
 export XFS_PARALLEL_REPAIR_PROG="`set_prog_path xfs_prepair`"
 export XFS_PARALLEL_REPAIR64_PROG="`set_prog_path xfs_prepair64`"
@@ -201,6 +192,11 @@ export XZ_PROG="`set_prog_path xz`"
 export FLOCK_PROG="`set_prog_path flock`"
 export LDD_PROG="`set_prog_path ldd`"
 export TIMEOUT_PROG="`set_prog_path timeout`"
+export MAN_PROG="`set_prog_path man`"
+export NFS4_SETFACL_PROG="`set_prog_path nfs4_setfacl`"
+export NFS4_GETFACL_PROG="`set_prog_path nfs4_getfacl`"
+export UBIUPDATEVOL_PROG="`set_prog_path ubiupdatevol`"
+export THIN_CHECK_PROG="$(set_prog_path thin_check)"
 
 # use 'udevadm settle' or 'udevsettle' to wait for lv to be settled.
 # newer systems have udevadm command but older systems like RHEL5 don't.
@@ -221,13 +217,6 @@ fi
 export UDEV_SETTLE_PROG
 
 case "$HOSTOS" in
-    IRIX*)
-        export MKFS_XFS_PROG="`set_prog_path mkfs_xfs`"
-        export MKFS_UDF_PROG="`set_prog_path mkfs_udf`"
-        export XFS_FSR_PROG="`set_prog_path /usr/etc/fsr_xfs`"
-        export MKFS_NFS_PROG="false"
-        export MKFS_CIFS_PROG="false"
-        ;;
     Linux)
         export MKFS_XFS_PROG="`set_prog_path mkfs.xfs`"
         export MKFS_EXT4_PROG="`set_prog_path mkfs.ext4`"
@@ -325,6 +314,9 @@ _mount_opts()
                # We need to specify the size at mount, use 1G by default
                export MOUNT_OPTIONS="-o size=1G $TMPFS_MOUNT_OPTIONS"
                ;;
+       ubifs)
+               export MOUNT_OPTIONS=$UBIFS_MOUNT_OPTIONS
+               ;;
        *)
                ;;
        esac
@@ -345,6 +337,10 @@ _test_mount_opts()
        glusterfs)
                export TEST_FS_MOUNT_OPTS=$GLUSTERFS_MOUNT_OPTIONS
                ;;
+       ext2|ext3|ext4|ext4dev)
+               # acls & xattrs aren't turned on by default on older ext$FOO
+               export TEST_FS_MOUNT_OPTS="-o acl,user_xattr $EXT_MOUNT_OPTIONS"
+               ;;
        *)
                ;;
        esac
@@ -460,13 +456,20 @@ _check_device()
                return 0
        fi
 
-       if [ "$FSTYP" == "overlay" ]; then
+       case "$FSTYP" in
+       overlay)
                if [ ! -d "$dev" ]; then
                        _fatal "common/config: $name ($dev) is not a directory for overlay"
                fi
-       else
+               ;;
+       ubifs)
+               if [ ! -c "$dev" ]; then
+                       _fatal "common/config: $name ($dev) is not a character device"
+               fi
+               ;;
+       *)
                _fatal "common/config: $name ($dev) is not a block device or a network filesystem"
-       fi
+       esac
 }
 
 # check and return a canonical mount point path
@@ -531,6 +534,10 @@ _overlay_config_override()
        # Store original base fs vars
        export OVL_BASE_TEST_DEV="$TEST_DEV"
        export OVL_BASE_TEST_DIR="$TEST_DIR"
+       # If config does not set MOUNT_OPTIONS, its value may be
+       # leftover from previous _overlay_config_override, so
+       # don't use that value for base fs mount
+       [ "$MOUNT_OPTIONS" != "$OVERLAY_MOUNT_OPTIONS" ] || unset MOUNT_OPTIONS
        export OVL_BASE_MOUNT_OPTIONS="$MOUNT_OPTIONS"
 
        # Set TEST vars to overlay base and mount dirs inside base fs
@@ -605,6 +612,7 @@ get_next_config() {
        local OLD_USE_EXTERNAL=$USE_EXTERNAL
 
        unset MOUNT_OPTIONS
+       unset TEST_FS_MOUNT_OPTS
        unset MKFS_OPTIONS
        unset FSCK_OPTIONS
        unset USE_EXTERNAL