fstests: add _require_hardlinks for all necessary tests
authorEric Sandeen <sandeen@sandeen.net>
Wed, 15 Apr 2020 20:20:33 +0000 (15:20 -0500)
committerEryu Guan <guaneryu@gmail.com>
Sun, 19 Apr 2020 16:42:11 +0000 (00:42 +0800)
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>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
22 files changed:
common/rc
tests/generic/002
tests/generic/039
tests/generic/040
tests/generic/041
tests/generic/056
tests/generic/057
tests/generic/065
tests/generic/089
tests/generic/090
tests/generic/104
tests/generic/106
tests/generic/107
tests/generic/236
tests/generic/336
tests/generic/343
tests/generic/378
tests/generic/480
tests/generic/498
tests/generic/502
tests/generic/526
tests/generic/527

index 31361d0e00732010f7a90d9acc31a29af922677a..742b99de1283202f650b6d7f0583a7e3528ddcc9 100644 (file)
--- 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
index 575ac42ba5bae086200435ca446f0199d2d7b2f5..480b77bcdc2709fa33ac4606d5129d50d3a28bf8 100755 (executable)
@@ -28,6 +28,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_test
+_require_hardlinks
 
 rm -f $seqres.full
 
index daa2e3537ad8741f342a82e6b89974854ebfd8d3..27cd6bf534eac0d21e42660dbb5ba8e30df349f7 100755 (executable)
@@ -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
index 712ae5957f54c5d15abd99b8a5437f17bf93fd44..b69d81273b4fd7b18d9a0603996331cebfe7276c 100755 (executable)
@@ -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
index 8001e8ce5ec11b96c87b516bb4c0afdc51c928af..1674d544ac35a6915a0beb6907949387d92a2882 100755 (executable)
@@ -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
index 9caf1166a3505823a0c1306de99118e154507af8..28920d3614d352fe2574283e83b1420add4ec0d3 100755 (executable)
@@ -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
index ba51dbb962910691bfeeef5d4f080f5dc79ec008..91e1d98e97a27f8e1046890b67208bd6137f3cc3 100755 (executable)
@@ -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
index d6a1670be7605c375c0d84a4c7b435af67bc2a47..30f3c32e9910e99e588256ebc2906ec276815d96 100755 (executable)
@@ -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
index 3d60826955814d1b096699ba379eaa36ca78c3ea..5264959698e5221201befab74ddc431d874d6f0d 100755 (executable)
@@ -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
index bf38d1c864c19f7b6a2489877922cc5e5b56fea7..db1aeef36a59e6debebc2389a04e9c0ffc204bca 100755 (executable)
@@ -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
index d78689f40ea9744e003282d6872ed587def9abab..4b6256db57360265cd18cc103afc45ada0fb2aba 100755 (executable)
@@ -31,6 +31,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
index 74d5dc30c8d834611b9f346f91c787f4ed136cb0..e1c859e5e0f8fcf9da0feeae70fab6bcdbfd24b8 100755 (executable)
@@ -30,6 +30,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
index 5c6bbfcaf97f1485541f62ea31784558e41a75d8..214f33894af93efaaf8e44b8f2400ac78b425151 100755 (executable)
@@ -33,6 +33,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
index f207165fe739c5e1dd6ff58a5c67cac0c0ddb2ad..2110b05383452d3d73c3cf3d117d001231935b4b 100755 (executable)
@@ -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*
index e007552c347a26ec2994ad319ab2aba2aef04e2c..6832ccde01f0080f68f2da8a5a63bd49ec5b2ff5 100755 (executable)
@@ -32,6 +32,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
index e35488dd67538f66216b998631ac2f52a7aa0eb9..2034197ec9a4790d3cd2c44751f515c97da813e6 100755 (executable)
@@ -32,6 +32,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
index 393d1ce7645e2100ae62c3e5f14f358948f43fe0..ea776949476e5206ecda5a83f29a65a7861e0a9b 100755 (executable)
@@ -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
index ba2c34addf9a8c610d85abedc6cbab988401ad66..63a87519cb1f928a1855535abe1a6bb57fa3052d 100755 (executable)
@@ -32,6 +32,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
index 71f5091c30aff228167fbff7c6ffc45a95ce09ca..7adf0b32d812e960ada56df1a9e7499e27b8d53d 100755 (executable)
@@ -31,6 +31,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
index a60ac9a7d94eb87eb72fb85b0e2e68beb05dd9f7..a49ee0b3184f68095cb651d38a924f0ae75e2ccc 100755 (executable)
@@ -34,6 +34,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
index d0b51f8703dda521058ea7473bc7fe91d03c093e..934d263fc003629c179fa274036baa6b96e3aaa8 100755 (executable)
@@ -32,6 +32,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
index 61dd4f0b1442922a220398a0ea7c5126448580bd..4b664da9a108cb2435f76e9400d02f8b034b544d 100755 (executable)
@@ -32,6 +32,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full