fstests: add _require_mknod
[xfstests-dev.git] / common / rc
index d30204e6bdbd75351c9b05db505d09ea5986483b..310fdc46a888f7bbd7b315531579431791ae0021 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -2357,7 +2357,7 @@ _require_fs_space()
 _require_sparse_files()
 {
     case $FSTYP in
-    hfsplus)
+    hfsplus|exfat)
         _notrun "Sparse files not supported by this filesystem type: $FSTYP"
        ;;
     *)
@@ -3211,7 +3211,7 @@ _has_metadata_journaling()
        fi
 
        case "$FSTYP" in
-       ext2|vfat|msdos|udf)
+       ext2|vfat|msdos|udf|exfat)
                echo "$FSTYP does not support metadata journaling"
                return 1
                ;;
@@ -3481,7 +3481,7 @@ run_check()
        "$@" >> $seqres.full 2>&1 || _fail "failed: '$@'"
 }
 
-_require_test_symlinks()
+_require_symlinks()
 {
        local target=`mktemp -p $TEST_DIR`
        local link=`mktemp -p $TEST_DIR -u`
@@ -3493,6 +3493,18 @@ _require_test_symlinks()
        rm -f $target $link
 }
 
+_require_hardlinks()
+{
+       local target=`mktemp -p $TEST_DIR`
+       local link=`mktemp -p $TEST_DIR -u`
+       ln $target $link
+       if [ "$?" -ne 0 ]; then
+               rm -f $target
+               _notrun "No hardlink support"
+       fi
+       rm -f $target $link
+}
+
 _require_test_fcntl_advisory_locks()
 {
        [ "$FSTYP" != "cifs" ] && return 0
@@ -3501,6 +3513,14 @@ _require_test_fcntl_advisory_locks()
                _notrun "Require fcntl advisory locks support"
 }
 
+_require_test_fcntl_setlease()
+{
+       _require_test_program "locktest"
+       touch $TEST_DIR/setlease_testfile
+       $here/src/locktest -t $TEST_DIR/setlease_testfile >/dev/null 2>&1
+       [ $? -eq 22 ] && _notrun "Require fcntl setlease support"
+}
+
 _require_ofd_locks()
 {
        # Give a test run by getlk wrlck on testfile.
@@ -4168,14 +4188,40 @@ _check_xfs_scrub_does_unicode() {
        return 0
 }
 
+# exfat timestamps start at 1980 and cannot be prior to epoch
 _require_negative_timestamps() {
        case "$FSTYP" in
-       ceph)
+       ceph|exfat)
                _notrun "$FSTYP does not support negative timestamps"
                ;;
        esac
 }
 
+# Require the 'accton' userspace tool and CONFIG_BSD_PROCESS_ACCT=y.
+_require_bsd_process_accounting()
+{
+       _require_command "$ACCTON_PROG" accton
+       $ACCTON_PROG on &> $tmp.test_accton
+       cat $tmp.test_accton >> $seqres.full
+       if grep 'Function not implemented' $tmp.test_accton; then
+               _notrun "BSD process accounting support unavailable"
+       fi
+       $ACCTON_PROG off >> $seqres.full
+}
+
+_require_sysctl_variable()
+{
+       local name=$1
+       sysctl $name &>/dev/null || _notrun "$name sysctl unavailable"
+}
+
+_require_mknod()
+{
+       mknod $TEST_DIR/$seq.null c 1 3 \
+               || _notrun "$FSTYP does not support mknod/mkfifo"
+       rm -f $TEST_DIR/$seq.null
+}
+
 init_rc
 
 ################################################################################