echo "${output[@]}"
test "${found}" -eq "$#"
}
+
+# Skip a test if any of the given fs features aren't present on the scratch
+# filesystem. The scratch fs must have been formatted already.
+_require_scratch_xfs_features()
+{
+ local features="$(_scratch_xfs_db -c 'version' 2>/dev/null)"
+
+ for feature in "$@"; do
+ echo "${features}" | grep -q -w "${feature}" ||
+ _notrun "Missing scratch feature: ${feature}"
+ done
+}
+
+# Decide if xfs_repair knows how to set (or clear) a filesystem feature.
+_require_xfs_repair_upgrade()
+{
+ local type="$1"
+
+ $XFS_REPAIR_PROG -c "$type=garbagevalue" 2>&1 | \
+ grep -q 'unknown option' && \
+ _notrun "xfs_repair does not support upgrading fs with $type"
+}
+
+# Require that the scratch device exists, that mkfs can format with inobtcount
+# enabled, and that the kernel can mount such a filesystem.
+_require_scratch_xfs_inobtcount()
+{
+ _require_scratch
+
+ _scratch_mkfs -m inobtcount=1 &> /dev/null || \
+ _notrun "mkfs.xfs doesn't support inobtcount feature"
+ _try_scratch_mount || \
+ _notrun "kernel doesn't support xfs inobtcount feature"
+ _scratch_unmount
+}
+
+_xfs_timestamp_range()
+{
+ local device="$1"
+ local use_db=0
+ local dbprog="$XFS_DB_PROG $device"
+ test "$device" = "$SCRATCH_DEV" && dbprog=_scratch_xfs_db
+
+ $dbprog -f -c 'help timelimit' | grep -v -q 'not found' && use_db=1
+ if [ $use_db -eq 0 ]; then
+ # The "timelimit" command was added to xfs_db at the same time
+ # that bigtime was added to xfsprogs. Therefore, we can assume
+ # the old timestamp range if the command isn't present.
+ echo "-$((1<<31)) $(((1<<31)-1))"
+ else
+ $dbprog -f -c 'timelimit --compact' | \
+ awk '{printf("%s %s", $1, $2);}'
+ fi
+}
+
+# Require that the scratch device exists, that mkfs can format with bigtime
+# enabled, that the kernel can mount such a filesystem, and that xfs_info
+# advertises the presence of that feature.
+_require_scratch_xfs_bigtime()
+{
+ _require_scratch
+
+ _scratch_mkfs -m bigtime=1 &>/dev/null || \
+ _notrun "mkfs.xfs doesn't support bigtime feature"
+ _try_scratch_mount || \
+ _notrun "kernel doesn't support xfs bigtime feature"
+ $XFS_INFO_PROG "$SCRATCH_MNT" | grep -q -w "bigtime=1" || \
+ _notrun "bigtime feature not advertised on mount?"
+ _scratch_unmount
+}