]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
common: source base fs specific common file
authorZorro Lang <zlang@kernel.org>
Wed, 25 May 2022 07:34:26 +0000 (15:34 +0800)
committerZorro Lang <zlang@kernel.org>
Thu, 26 May 2022 10:00:18 +0000 (18:00 +0800)
When tests overlayfs, sometimes we need the underlying fs specific
helpers, e.g. common/rc has:
  _filesystem_timestamp_range $OVL_BASE_TEST_DEV $OVL_BASE_FSTYP

So when we source common/overlay, better to source OVL_BASE_FSTYP
too.

Signed-off-by: Zorro Lang <zlang@kernel.org>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
common/config
common/overlay
common/rc

index c6428f90c7c7253aa1a2046c2f458190b3bbdd0d..558f148bec6ae582d9a199579d211ebc8280ba71 100644 (file)
@@ -481,6 +481,65 @@ _fsck_opts()
        esac
 }
 
+# check necessary running dependences then source sepcific fs helpers
+_source_specific_fs()
+{
+       local fs=$1
+
+       if [ -z "$fs" ];then
+               fs=$FSTYP
+       fi
+
+       case "$fs" in
+       xfs)
+               [ "$XFS_LOGPRINT_PROG" = "" ] && _fatal "xfs_logprint not found"
+               [ "$XFS_REPAIR_PROG" = "" ] && _fatal "xfs_repair not found"
+               [ "$XFS_DB_PROG" = "" ] && _fatal "xfs_db not found"
+               [ "$MKFS_XFS_PROG" = "" ] && _fatal "mkfs_xfs not found"
+               [ "$XFS_INFO_PROG" = "" ] && _fatal "xfs_info not found"
+
+               . ./common/xfs
+               ;;
+       udf)
+               [ "$MKFS_UDF_PROG" = "" ] && _fatal "mkfs_udf/mkudffs not found"
+               ;;
+       btrfs)
+               [ "$MKFS_BTRFS_PROG" = "" ] && _fatal "mkfs.btrfs not found"
+
+               . ./common/btrfs
+               ;;
+       ext4)
+               [ "$MKFS_EXT4_PROG" = "" ] && _fatal "mkfs.ext4 not found"
+               ;;
+       f2fs)
+               [ "$MKFS_F2FS_PROG" = "" ] && _fatal "mkfs.f2fs not found"
+               ;;
+       nfs)
+               . ./common/nfs
+               ;;
+       cifs)
+               ;;
+       9p)
+               ;;
+       ceph)
+               . ./common/ceph
+               ;;
+       glusterfs)
+               ;;
+       overlay)
+               . ./common/overlay
+               ;;
+       reiser4)
+               [ "$MKFS_REISER4_PROG" = "" ] && _fatal "mkfs.reiser4 not found"
+               ;;
+       pvfs2)
+               ;;
+       ubifs)
+               [ "$UBIUPDATEVOL_PROG" = "" ] && _fatal "ubiupdatevol not found"
+               ;;
+       esac
+}
+
 known_hosts()
 {
        [ "$HOST_CONFIG_DIR" ] || HOST_CONFIG_DIR=`pwd`/configs
index c4e7ee5896b569e7f46ae197b39c4e88ee0141e1..e35419d0e0452a18e93a88dc5b255345a687e4ea 100644 (file)
@@ -12,6 +12,10 @@ export OVL_XATTR_NLINK="trusted.overlay.nlink"
 export OVL_XATTR_UPPER="trusted.overlay.upper"
 export OVL_XATTR_METACOPY="trusted.overlay.metacopy"
 
+if [ -n "$OVL_BASE_FSTYP" ];then
+       _source_specific_fs $OVL_BASE_FSTYP
+fi
+
 # helper function to do the actual overlayfs mount operation
 _overlay_mount_dirs()
 {
index 70a15f9ca156706a01de25a6aea2fddf9d1cd209..2f31ca464621c7578e2c534e61e67039c5429633 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -96,54 +96,7 @@ _log_err()
 umask 022
 
 # check for correct setup and source the $FSTYP specific functions now
-case "$FSTYP" in
-    xfs)
-        [ "$XFS_LOGPRINT_PROG" = "" ] && _fatal "xfs_logprint not found"
-        [ "$XFS_REPAIR_PROG" = "" ] && _fatal "xfs_repair not found"
-        [ "$XFS_DB_PROG" = "" ] && _fatal "xfs_db not found"
-        [ "$MKFS_XFS_PROG" = "" ] && _fatal "mkfs_xfs not found"
-        [ "$XFS_INFO_PROG" = "" ] && _fatal "xfs_info not found"
-
-        . ./common/xfs
-        ;;
-    udf)
-        [ "$MKFS_UDF_PROG" = "" ] && _fatal "mkfs_udf/mkudffs not found"
-        ;;
-    btrfs)
-        [ "$MKFS_BTRFS_PROG" = "" ] && _fatal "mkfs.btrfs not found"
-
-        . ./common/btrfs
-        ;;
-    ext4)
-        [ "$MKFS_EXT4_PROG" = "" ] && _fatal "mkfs.ext4 not found"
-        ;;
-    f2fs)
-        [ "$MKFS_F2FS_PROG" = "" ] && _fatal "mkfs.f2fs not found"
-        ;;
-    nfs)
-        . ./common/nfs
-        ;;
-    cifs)
-        ;;
-    9p)
-        ;;
-    ceph)
-        . ./common/ceph
-        ;;
-    glusterfs)
-        ;;
-    overlay)
-        . ./common/overlay
-        ;;
-    reiser4)
-        [ "$MKFS_REISER4_PROG" = "" ] && _fatal "mkfs.reiser4 not found"
-        ;;
-    pvfs2)
-       ;;
-    ubifs)
-       [ "$UBIUPDATEVOL_PROG" = "" ] && _fatal "ubiupdatevol not found"
-       ;;
-esac
+_source_specific_fs $FSTYP
 
 if [ ! -z "$REPORT_LIST" ]; then
        . ./common/report