generic/{453,454}: Don't run for FSs restricting names
[xfstests-dev.git] / common / rc
index e53d1569eef732d8db9f0b45e0a3c636e1a253d7..d4b1f21f64c1eb0500d94cc6513bc9824ab5dfd9 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -628,7 +628,7 @@ _ext4_metadump()
        test -n "$E2IMAGE_PROG" || _fail "e2image not installed"
        $E2IMAGE_PROG -Q "$device" "$dumpfile"
        [ "$compressopt" = "compress" ] && [ -n "$DUMP_COMPRESSOR" ] &&
-               $DUMP_COMPRESSOR "$dumpfile" &>> "$seqres.full"
+               $DUMP_COMPRESSOR -f "$dumpfile" &>> "$seqres.full"
 }
 
 _test_mkfs()
@@ -1065,6 +1065,9 @@ _scratch_mkfs_sized()
                fi
                export MOUNT_OPTIONS="-o size=$fssize $TMPFS_MOUNT_OPTIONS"
                ;;
+       bcachefs)
+               $MKFS_PROG -t $FSTYP -- $MKFS_OPTIONS --fs_size=$fssize --block_size=$blocksize $SCRATCH_DEV
+               ;;
        *)
                _notrun "Filesystem $FSTYP not supported in _scratch_mkfs_sized"
                ;;
@@ -1113,30 +1116,44 @@ _scratch_mkfs_geom()
 # _scratch_mkfs_blocksized blocksize
 _scratch_mkfs_blocksized()
 {
-    local blocksize=$1
+       local blocksize=$1
 
-    local re='^[0-9]+$'
-    if ! [[ $blocksize =~ $re ]] ; then
-        _notrun "error: _scratch_mkfs_sized: block size \"$blocksize\" not an integer."
-    fi
+       local re='^[0-9]+$'
+       if ! [[ $blocksize =~ $re ]] ; then
+               _notrun "error: _scratch_mkfs_sized: block size \"$blocksize\" not an integer."
+       fi
 
-    case $FSTYP in
-    xfs)
-       _scratch_mkfs_xfs $MKFS_OPTIONS -b size=$blocksize
-       ;;
-    ext2|ext3|ext4)
-       ${MKFS_PROG} -t $FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV
-       ;;
-    gfs2)
-       ${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS -O -b $blocksize $SCRATCH_DEV
-       ;;
-    ocfs2)
-       yes | ${MKFS_PROG} -t $FSTYP -F $MKFS_OPTIONS -b $blocksize -C $blocksize $SCRATCH_DEV
-       ;;
-    *)
-       _notrun "Filesystem $FSTYP not supported in _scratch_mkfs_blocksized"
-       ;;
-    esac
+       case $FSTYP in
+       btrfs)
+               test -f /sys/fs/btrfs/features/supported_sectorsizes || \
+               _notrun "Subpage sectorsize support is not found in $FSTYP"
+
+               grep -wq $blocksize /sys/fs/btrfs/features/supported_sectorsizes || \
+               _notrun "$FSTYP does not support sectorsize=$blocksize yet"
+
+               _scratch_mkfs --sectorsize=$blocksize
+               ;;
+       xfs)
+               _scratch_mkfs_xfs $MKFS_OPTIONS -b size=$blocksize
+               ;;
+       ext2|ext3|ext4)
+               ${MKFS_PROG} -t $FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV
+               ;;
+       gfs2)
+               ${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS -O -b $blocksize $SCRATCH_DEV
+               ;;
+       ocfs2)
+               yes | ${MKFS_PROG} -t $FSTYP -F $MKFS_OPTIONS -b $blocksize \
+                                               -C $blocksize $SCRATCH_DEV
+               ;;
+       bcachefs)
+               ${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS --block_size=$blocksize \
+                                                               $SCRATCH_DEV
+               ;;
+       *)
+               _notrun "Filesystem $FSTYP not supported in _scratch_mkfs_blocksized"
+               ;;
+       esac
 }
 
 _scratch_resvblks()
@@ -1179,6 +1196,11 @@ _repair_scratch_fs()
        fi
        return $res
         ;;
+    bcachefs)
+       # With bcachefs, if fsck detects any errors we consider it a bug and we
+       # want the test to fail:
+       _check_scratch_fs
+       ;;
     *)
        local dev=$SCRATCH_DEV
        local fstyp=$FSTYP
@@ -4231,7 +4253,8 @@ _get_block_size()
 }
 
 # Require that the fundamental allocation unit of a file is the same as the
-# filesystem block size.
+# filesystem block size.  The sole parameter must be the root dir of a
+# filesystem.
 _require_file_block_size_equals_fs_block_size()
 {
        local file_alloc_unit="$(_get_file_block_size $1)"
@@ -4570,6 +4593,25 @@ _getcap()
        return ${PIPESTATUS[0]}
 }
 
+_require_od_endian_flag()
+{
+       od --endian=little < /dev/null > /dev/null 2>&1 || \
+               _notrun "od does not support endian flag"
+}
+
+# Skip this test unless the filesystem treats names (directory entries,
+# fs labels, and extended attribute names) as raw byte sequences.
+_require_names_are_bytes() {
+        case "$FSTYP" in
+        ext2|ext3|ext4|f2fs|xfs|btrfs)
+               # do nothing
+               ;;
+       *)
+                _notrun "$FSTYP does not allow unrestricted byte streams for names"
+               ;;
+        esac
+}
+
 init_rc
 
 ################################################################################