diff mbox series

[3/4] fstests: add _require_hardlinks for all necessary tests

Message ID 215d9e5c-2b76-907b-d881-a6177a150260@sandeen.net (mailing list archive)
State New, archived
Headers show
Series fstests: fix test requirements for exfat testing support | expand

Commit Message

Eric Sandeen April 15, 2020, 8:20 p.m. UTC
Add a new _require function for hardlinks, to test hardlink support
in all tests which need it.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

V2: Use full pathname for ln target
diff mbox series

Patch

diff --git a/common/rc b/common/rc
index 31361d0e..742b99de 100644
--- a/common/rc
+++ b/common/rc
@@ -3493,6 +3493,18 @@  _require_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
diff --git a/tests/generic/002 b/tests/generic/002
index 575ac42b..480b77bc 100755
--- a/tests/generic/002
+++ b/tests/generic/002
@@ -28,6 +28,7 @@  _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_test
+_require_hardlinks
 
 rm -f $seqres.full
 
diff --git a/tests/generic/039 b/tests/generic/039
index daa2e353..27cd6bf5 100755
--- a/tests/generic/039
+++ b/tests/generic/039
@@ -39,6 +39,7 @@  trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
diff --git a/tests/generic/040 b/tests/generic/040
index 712ae595..b69d8127 100755
--- a/tests/generic/040
+++ b/tests/generic/040
@@ -44,6 +44,7 @@  trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
diff --git a/tests/generic/041 b/tests/generic/041
index 8001e8ce..1674d544 100755
--- a/tests/generic/041
+++ b/tests/generic/041
@@ -48,6 +48,7 @@  trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
diff --git a/tests/generic/056 b/tests/generic/056
index 9caf1166..28920d36 100755
--- a/tests/generic/056
+++ b/tests/generic/056
@@ -37,6 +37,7 @@  trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
diff --git a/tests/generic/057 b/tests/generic/057
index ba51dbb9..91e1d98e 100755
--- a/tests/generic/057
+++ b/tests/generic/057
@@ -37,6 +37,7 @@  trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
diff --git a/tests/generic/065 b/tests/generic/065
index d6a1670b..30f3c32e 100755
--- a/tests/generic/065
+++ b/tests/generic/065
@@ -38,6 +38,7 @@  trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
diff --git a/tests/generic/089 b/tests/generic/089
index 3d608269..52649596 100755
--- a/tests/generic/089
+++ b/tests/generic/089
@@ -36,6 +36,7 @@  addentries()
 _supported_fs generic
 _supported_os Linux
 _require_test
+_require_hardlinks
 
 rm -f $seqres.full
 [ "X$TEST_DIR" = "X" ] && exit 1
diff --git a/tests/generic/090 b/tests/generic/090
index bf38d1c8..db1aeef3 100755
--- a/tests/generic/090
+++ b/tests/generic/090
@@ -36,6 +36,7 @@  trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
diff --git a/tests/generic/104 b/tests/generic/104
index d78689f4..4b6256db 100755
--- a/tests/generic/104
+++ b/tests/generic/104
@@ -31,6 +31,7 @@  _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
diff --git a/tests/generic/106 b/tests/generic/106
index 74d5dc30..e1c859e5 100755
--- a/tests/generic/106
+++ b/tests/generic/106
@@ -30,6 +30,7 @@  _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
diff --git a/tests/generic/107 b/tests/generic/107
index 5c6bbfca..214f3389 100755
--- a/tests/generic/107
+++ b/tests/generic/107
@@ -33,6 +33,7 @@  _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
diff --git a/tests/generic/236 b/tests/generic/236
index f207165f..2110b053 100755
--- a/tests/generic/236
+++ b/tests/generic/236
@@ -25,8 +25,8 @@  trap "_cleanup; exit \$status" 0 1 2 3 15
 
 # real QA test starts here
 _supported_fs generic
-# only Linux supports fallocate
 _supported_os Linux
+_require_hardlinks
 _require_test
 
 rm -f $TEST_DIR/ouch*
diff --git a/tests/generic/336 b/tests/generic/336
index e007552c..6832ccde 100755
--- a/tests/generic/336
+++ b/tests/generic/336
@@ -32,6 +32,7 @@  _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
diff --git a/tests/generic/343 b/tests/generic/343
index e35488dd..2034197e 100755
--- a/tests/generic/343
+++ b/tests/generic/343
@@ -32,6 +32,7 @@  _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
diff --git a/tests/generic/378 b/tests/generic/378
index 393d1ce7..ea776949 100755
--- a/tests/generic/378
+++ b/tests/generic/378
@@ -39,6 +39,7 @@  _supported_fs generic
 _supported_os Linux
 _require_test
 _require_user
+_require_hardlinks
 
 # Setup testfile and its hardlink
 testfile=$TEST_DIR/testfile.$seq
diff --git a/tests/generic/480 b/tests/generic/480
index ba2c34ad..63a87519 100755
--- a/tests/generic/480
+++ b/tests/generic/480
@@ -32,6 +32,7 @@  _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
diff --git a/tests/generic/498 b/tests/generic/498
index 71f5091c..7adf0b32 100755
--- a/tests/generic/498
+++ b/tests/generic/498
@@ -31,6 +31,7 @@  _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
diff --git a/tests/generic/502 b/tests/generic/502
index a60ac9a7..a49ee0b3 100755
--- a/tests/generic/502
+++ b/tests/generic/502
@@ -34,6 +34,7 @@  _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
diff --git a/tests/generic/526 b/tests/generic/526
index d0b51f87..934d263f 100755
--- a/tests/generic/526
+++ b/tests/generic/526
@@ -32,6 +32,7 @@  _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
diff --git a/tests/generic/527 b/tests/generic/527
index 61dd4f0b..4b664da9 100755
--- a/tests/generic/527
+++ b/tests/generic/527
@@ -32,6 +32,7 @@  _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full