common/config: create $RESULT_BASE before dumping kmemleak leaks
[xfstests-dev.git] / common / config
index f53516b1b03fb35791c8e98b779f621e9fe65771..0f153412bcdc09ffd245a3251fb778ed5b537258 100644 (file)
@@ -1,21 +1,7 @@
 ##/bin/bash
-#
+# SPDX-License-Identifier: GPL-2.0
 # Copyright (c) 2000-2003,2006 Silicon Graphics, Inc.  All Rights Reserved.
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write the Free Software Foundation,
-# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-#
-#
 # setup and check for config parameters, and in particular
 #
 # EMAIL -           email of the script runner.
@@ -184,6 +170,7 @@ export WIPEFS_PROG="$(type -P wipefs)"
 export DUMP_PROG="$(type -P dump)"
 export RESTORE_PROG="$(type -P restore)"
 export LVM_PROG="$(type -P lvm)"
+export LSATTR_PROG="$(type -P lsattr)"
 export CHATTR_PROG="$(type -P chattr)"
 export DEBUGFS_PROG="$(type -P debugfs)"
 export UUIDGEN_PROG="$(type -P uuidgen)"
@@ -205,6 +192,8 @@ export TIMEOUT_PROG="$(type -P timeout)"
 export SETCAP_PROG="$(type -P setcap)"
 export GETCAP_PROG="$(type -P getcap)"
 export CHECKBASHISMS_PROG="$(type -P checkbashisms)"
+export XFS_INFO_PROG="$(type -P xfs_info)"
+export DUPEREMOVE_PROG="$(type -P duperemove)"
 
 # use 'udevadm settle' or 'udevsettle' to wait for lv to be settled.
 # newer systems have udevadm command but older systems like RHEL5 don't.
@@ -235,7 +224,7 @@ case "$HOSTOS" in
        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_DEBUG_TREE_PROG=$(type -P btrfs-debug-tree)
+       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"
@@ -468,8 +457,9 @@ _check_device()
        fi
 
        case "$FSTYP" in
-       9p)
+       9p|tmpfs)
                # 9p mount tags are just plain strings, so anything is allowed
+               # tmpfs doesn't use mount source, ignore
                ;;
        overlay)
                if [ ! -d "$dev" ]; then
@@ -542,7 +532,7 @@ _overlay_config_override()
        [ -b "$TEST_DEV" ] || return 0
 
        # Config file may specify base fs type, but we obay -overlay flag
-       export OVL_BASE_FSTYP="$FSTYP"
+       [ "$FSTYP" == overlay ] || export OVL_BASE_FSTYP="$FSTYP"
        export FSTYP=overlay
 
        # Store original base fs vars
@@ -667,6 +657,20 @@ get_next_config() {
        # set default RESULT_BASE
        if [ -z "$RESULT_BASE" ]; then
                export RESULT_BASE="$here/results/"
+               mkdir -p ${RESULT_BASE}
+               if [ ! -d ${RESULT_BASE} ]; then
+                       echo "failed to create results directory $RESULT_BASE"
+                       exit 1
+               fi
+       fi
+
+       if [ "$FSTYP" == "tmpfs" ]; then
+               if [ -z "TEST_DEV" ]; then
+                       export TEST_DEV=tmpfs_test
+               fi
+               if [ -z "SCRATCH_DEV" ]; then
+                       export TEST_DEV=tmpfs_scratch
+               fi
        fi
 
        #  Mandatory Config values.