Skip to contentSkip to conversation

fstests: add/enhance requires tests for hardlinks & softlinks

PATCH In review Eric Sandeen 4 participants 9 messages Apr 9, 2020 – Apr 13, 2020 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

cover fstests: add/enhance requires tests for hardlinks & softlinks

AFAICT exfat does not support hardlinks or softlinks, so any test which tries to link files will fail.

We have an older test for symlink capability, but it's not widely used. Fix that, and add a separate explicit _requires test for hardlinks as well.

With this ./check -g auto,quick on exfat failures are reduced to about 27 tests.

-Eric

#1 lore raw

PATCH 1/2 fstests: use _require_symlinks on all necessary tests

Consistently use _require_symlinks on all generic tests which create a symlink.

Rename an old require function, "_require_test_symlinks" to simply "_require_symlinks" because it's reasonable to assume that if the test device doesn't support it, neither does the scratch device and vice versa.

---

common/rc +2 -2
index 24a8f145..476d3d07 100644
@@ -3481,14 +3481,14 @@ 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`
 	ln -s `basename $target` $link
 	if [ "$?" -ne 0 ]; then
 		rm -f $target
-		_notrun "Require symlinks support"
+		_notrun "No symlink support"
 	fi
 	rm -f $target $link
 }
tests/generic/005 +1 -1
index 118fca20..c49109e9 100755
@@ -48,7 +48,7 @@ _touch()
 # real QA test starts here
 _supported_fs generic
 _require_test
-_require_test_symlinks
+_require_symlinks
 
 _supported_os Linux
 
tests/generic/023 +1 -1
index ea40f3d2..1cfa25cd 100755
@@ -30,7 +30,7 @@ _supported_os Linux
 
 _require_test
 _require_renameat2
-_require_test_symlinks
+_require_symlinks
 
 # real QA test starts here
 
tests/generic/024 +1 -1
index 531a515f..b6ac4182 100755
@@ -30,7 +30,7 @@ _supported_os Linux
 
 _require_test
 _require_renameat2 noreplace
-_require_test_symlinks
+_require_symlinks
 
 # real QA test starts here
 
tests/generic/025 +0 -1
index e69d655f..e0f71375 100755
@@ -30,7 +30,6 @@ _supported_os Linux
 
 _require_test
 _require_renameat2 exchange
-_require_test_symlinks
 
 # real QA test starts here
 
tests/generic/062 +1 -0
index 3fef02e8..ba744885 100755
@@ -59,6 +59,7 @@ _supported_os Linux
 
 _require_scratch
 _require_attrs
+_require_symlinks
 
 rm -f $tmp.backup1 $tmp.backup2 $seqres.full
 
tests/generic/067 +1 -1
index bd72dc85..d4c710d2 100755
@@ -37,7 +37,7 @@ _cleanup()
 # Modify as appropriate.
 _supported_fs generic
 _supported_os Linux
-_require_test_symlinks
+_require_symlinks
 _require_test
 _require_scratch
 _require_loop
tests/generic/078 +0 -1
index a421a8ab..ccc5c8d5 100755
@@ -30,7 +30,6 @@ _supported_os Linux
 
 _require_test
 _require_renameat2 whiteout
-_require_test_symlinks
 
 # real QA test starts here
 
tests/generic/109 +1 -0
index 8be70c23..549a95b1 100755
@@ -29,6 +29,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_symlinks
 
 rm -f $seqres.full
 
tests/generic/294 +1 -0
index b74579ac..32c89b03 100755
@@ -32,6 +32,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_symlinks
 
 rm -f $seqres.full
 _scratch_mkfs > $seqres.full 2>&1 || _fail "Could not mkfs scratch device"
tests/generic/306 +1 -0
index 081d1a89..046f4516 100755
@@ -33,6 +33,7 @@ _supported_fs generic
 _supported_os Linux
 _require_scratch
 _require_test
+_require_symlinks
 
 DEVNULL=$SCRATCH_MNT/devnull
 DEVZERO=$SCRATCH_MNT/devzero
tests/generic/348 +1 -0
index 630ff160..e0139d9a 100755
@@ -32,6 +32,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_symlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
tests/generic/360 +1 -0
index a9a4f2f9..f15548e2 100755
@@ -31,6 +31,7 @@ rm -f $seqres.full
 _supported_fs generic
 _supported_os Linux
 _require_test
+_require_symlinks
 
 linkfile=$TEST_DIR/$seq.symlink
 rm -f $linkfile
tests/generic/397 +1 -0
index f2e22950..c2245bd5 100755
@@ -36,6 +36,7 @@ rm -f $seqres.full
 # real QA test starts here
 _supported_fs generic
 _supported_os Linux
+_require_symlinks
 _require_scratch_encryption
 _require_command "$KEYCTL_PROG" keyctl
 
tests/generic/399 +1 -0
index a9b3997a..a4013720 100755
@@ -43,6 +43,7 @@ rm -f $seqres.full
 _supported_fs generic
 _supported_os Linux
 _require_scratch_encryption
+_require_symlinks
 _require_command "$XZ_PROG" xz
 _require_command "$KEYCTL_PROG" keyctl
 
tests/generic/401 +1 -0
index 9d45fbcd..00e9bbe0 100755
@@ -37,6 +37,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_symlinks
 _require_test_program "t_dir_type"
 
 rm -f $seqres.full
tests/generic/423 +1 -0
index b61d5de0..6db55fd6 100755
@@ -38,6 +38,7 @@ _require_test
 _require_test_program "stat_test"
 _require_test_program "af_unix"
 _require_statx
+_require_symlinks
 
 function check_stat () {
 	$here/src/stat_test $* || echo stat_test failed
tests/generic/440 +1 -0
index 1ec1ed48..3446c147 100755
@@ -38,6 +38,7 @@ rm -f $seqres.full
 _supported_fs generic
 _supported_os Linux
 _require_scratch_encryption
+_require_symlinks
 _require_command "$KEYCTL_PROG" keyctl
 
 # Set up an encryption-capable filesystem and an encryption key.
tests/generic/479 +1 -0
index ad20aaee..aaf864a4 100755
@@ -32,6 +32,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_symlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
tests/generic/556 +1 -0
index b7239e34..4899b403 100755
@@ -19,6 +19,7 @@ _supported_os Linux
 _supported_fs generic
 _require_scratch_nocheck
 _require_scratch_casefold
+_require_symlinks
 _require_check_dmesg
 _require_attrs
 
#2 lore raw

Re: [PATCH 1/2] fstests: use _require_symlinks on all necessary tests

Quoted 4 lines · Eric Sandeen

Consistently use _require_symlinks on all generic tests which create a symlink.

Rename an old require function, "_require_test_symlinks" to simply

Wait, we're adding and renaming at the same time?

One thing per patch, please...

Quoted 72 lines

"_require_symlinks" because it's reasonable to assume that if the test device doesn't support it, neither does the scratch device and vice versa.

---

common/rc +2 -2
index 24a8f145..476d3d07 100644
@@ -3481,14 +3481,14 @@ 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`
 	ln -s `basename $target` $link
 	if [ "$?" -ne 0 ]; then
 		rm -f $target
-		_notrun "Require symlinks support"
+		_notrun "No symlink support"
 	fi
 	rm -f $target $link
 }
tests/generic/005 +1 -1
index 118fca20..c49109e9 100755
@@ -48,7 +48,7 @@ _touch()
 # real QA test starts here
 _supported_fs generic
 _require_test
-_require_test_symlinks
+_require_symlinks
 
 _supported_os Linux
 
tests/generic/023 +1 -1
index ea40f3d2..1cfa25cd 100755
@@ -30,7 +30,7 @@ _supported_os Linux
 
 _require_test
 _require_renameat2
-_require_test_symlinks
+_require_symlinks
 
 # real QA test starts here
 
tests/generic/024 +1 -1
index 531a515f..b6ac4182 100755
@@ -30,7 +30,7 @@ _supported_os Linux
 
 _require_test
 _require_renameat2 noreplace
-_require_test_symlinks
+_require_symlinks
 
 # real QA test starts here
 
tests/generic/025 +0 -0
index e69d655f..e0f71375 100755

tests/generic/025 _supported_os Linux · line 33

Quoted 4 lines
tests/generic/025 +0 -1
@@ -30,7 +30,6 @@ _supported_os Linux
 
 _require_test
 _require_renameat2 exchange
-_require_test_symlinks

This drops _require_symlinks, in a add/renaming patch...

/me confused.

--D

Quoted 185 lines
tests/generic/025 +0 -0
 # real QA test starts here
 
tests/generic/062 +1 -0
index 3fef02e8..ba744885 100755
@@ -59,6 +59,7 @@ _supported_os Linux
 
 _require_scratch
 _require_attrs
+_require_symlinks
 
 rm -f $tmp.backup1 $tmp.backup2 $seqres.full
 
tests/generic/067 +1 -1
index bd72dc85..d4c710d2 100755
@@ -37,7 +37,7 @@ _cleanup()
 # Modify as appropriate.
 _supported_fs generic
 _supported_os Linux
-_require_test_symlinks
+_require_symlinks
 _require_test
 _require_scratch
 _require_loop
tests/generic/078 +0 -1
index a421a8ab..ccc5c8d5 100755
@@ -30,7 +30,6 @@ _supported_os Linux
 
 _require_test
 _require_renameat2 whiteout
-_require_test_symlinks
 
 # real QA test starts here
 
tests/generic/109 +1 -0
index 8be70c23..549a95b1 100755
@@ -29,6 +29,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_symlinks
 
 rm -f $seqres.full
 
tests/generic/294 +1 -0
index b74579ac..32c89b03 100755
@@ -32,6 +32,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_symlinks
 
 rm -f $seqres.full
 _scratch_mkfs > $seqres.full 2>&1 || _fail "Could not mkfs scratch device"
tests/generic/306 +1 -0
index 081d1a89..046f4516 100755
@@ -33,6 +33,7 @@ _supported_fs generic
 _supported_os Linux
 _require_scratch
 _require_test
+_require_symlinks
 
 DEVNULL=$SCRATCH_MNT/devnull
 DEVZERO=$SCRATCH_MNT/devzero
tests/generic/348 +1 -0
index 630ff160..e0139d9a 100755
@@ -32,6 +32,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_symlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
tests/generic/360 +1 -0
index a9a4f2f9..f15548e2 100755
@@ -31,6 +31,7 @@ rm -f $seqres.full
 _supported_fs generic
 _supported_os Linux
 _require_test
+_require_symlinks
 
 linkfile=$TEST_DIR/$seq.symlink
 rm -f $linkfile
tests/generic/397 +1 -0
index f2e22950..c2245bd5 100755
@@ -36,6 +36,7 @@ rm -f $seqres.full
 # real QA test starts here
 _supported_fs generic
 _supported_os Linux
+_require_symlinks
 _require_scratch_encryption
 _require_command "$KEYCTL_PROG" keyctl
 
tests/generic/399 +1 -0
index a9b3997a..a4013720 100755
@@ -43,6 +43,7 @@ rm -f $seqres.full
 _supported_fs generic
 _supported_os Linux
 _require_scratch_encryption
+_require_symlinks
 _require_command "$XZ_PROG" xz
 _require_command "$KEYCTL_PROG" keyctl
 
tests/generic/401 +1 -0
index 9d45fbcd..00e9bbe0 100755
@@ -37,6 +37,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_symlinks
 _require_test_program "t_dir_type"
 
 rm -f $seqres.full
tests/generic/423 +1 -0
index b61d5de0..6db55fd6 100755
@@ -38,6 +38,7 @@ _require_test
 _require_test_program "stat_test"
 _require_test_program "af_unix"
 _require_statx
+_require_symlinks
 
 function check_stat () {
 	$here/src/stat_test $* || echo stat_test failed
tests/generic/440 +1 -0
index 1ec1ed48..3446c147 100755
@@ -38,6 +38,7 @@ rm -f $seqres.full
 _supported_fs generic
 _supported_os Linux
 _require_scratch_encryption
+_require_symlinks
 _require_command "$KEYCTL_PROG" keyctl
 
 # Set up an encryption-capable filesystem and an encryption key.
tests/generic/479 +1 -0
index ad20aaee..aaf864a4 100755
@@ -32,6 +32,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_symlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
tests/generic/556 +1 -0
index b7239e34..4899b403 100755
@@ -19,6 +19,7 @@ _supported_os Linux
 _supported_fs generic
 _require_scratch_nocheck
 _require_scratch_casefold
+_require_symlinks
 _require_check_dmesg
 _require_attrs
 
#3 lore raw

Re: [PATCH 1/2] fstests: use _require_symlinks on all necessary tests

Quoted 9 lines · Darrick J. Wong
Quoted 4 lines · Eric Sandeen

Consistently use _require_symlinks on all generic tests which create a symlink.

Rename an old require function, "_require_test_symlinks" to simply

Wait, we're adding and renaming at the same time?

One thing per patch, please...

meh, purely cosmetic but *shrug*

Quoted 14 lines
Quoted 14 lines

"_require_symlinks" because it's reasonable to assume that if the test device doesn't support it, neither does the scratch device and vice versa.

---

tests/generic/025 +0 -0
index e69d655f..e0f71375 100755
@@ -30,7 +30,6 @@ _supported_os Linux
 
Quoted 7 lines

tests/generic/025 _supported_os Linux · line 33

Quoted 3 lines
tests/generic/025 +0 -1
 _require_test
 _require_renameat2 exchange
-_require_test_symlinks

This drops _require_symlinks, in a add/renaming patch...

/me confused.

whoops.

well, yeah, the test doesn't use symlinks but that wasn't supposed to be here. :P

#4 lore raw

PATCH 1/1 fstests: rename _require_test_symlinks

In reply to Eric Sandeen

Generally these tests are not restricted to one device or the other; testing the test device will suffice to determine the capability but it doesn't need to be named that way.

---

common/rc +1 -1
index 24a8f145..31361d0e 100644
@@ -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`
tests/generic/005 +1 -1
index 118fca20..c49109e9 100755
@@ -48,7 +48,7 @@ _touch()
 # real QA test starts here
 _supported_fs generic
 _require_test
-_require_test_symlinks
+_require_symlinks
 
 _supported_os Linux
 
tests/generic/023 +1 -1
index ea40f3d2..1cfa25cd 100755
@@ -30,7 +30,7 @@ _supported_os Linux
 
 _require_test
 _require_renameat2
-_require_test_symlinks
+_require_symlinks
 
 # real QA test starts here
 
tests/generic/024 +1 -1
index 531a515f..b6ac4182 100755
@@ -30,7 +30,7 @@ _supported_os Linux
 
 _require_test
 _require_renameat2 noreplace
-_require_test_symlinks
+_require_symlinks
 
 # real QA test starts here
 
tests/generic/025 +1 -1
index e69d655f..2eb3e5e8 100755
@@ -30,7 +30,7 @@ _supported_os Linux
 
 _require_test
 _require_renameat2 exchange
-_require_test_symlinks
+_require_symlinks
 
 # real QA test starts here
 
tests/generic/067 +1 -1
index bd72dc85..d4c710d2 100755
@@ -37,7 +37,7 @@ _cleanup()
 # Modify as appropriate.
 _supported_fs generic
 _supported_os Linux
-_require_test_symlinks
+_require_symlinks
 _require_test
 _require_scratch
 _require_loop
tests/generic/078 +1 -1
index a421a8ab..ce0201c9 100755
@@ -30,7 +30,7 @@ _supported_os Linux
 
 _require_test
 _require_renameat2 whiteout
-_require_test_symlinks
+_require_symlinks
 
 # real QA test starts here
 
#5 lore raw

PATCH 1/1 fstests: use _require_symlinks on all necessary tests

In reply to Eric Sandeen

Consistently use _require_symlinks on all generic tests which create a symlink when they run.

---

tests/generic/062 +1 -0
index 3fef02e8..ba744885 100755
@@ -59,6 +59,7 @@ _supported_os Linux
 
 _require_scratch
 _require_attrs
+_require_symlinks
 
 rm -f $tmp.backup1 $tmp.backup2 $seqres.full
 
tests/generic/109 +1 -0
index 8be70c23..549a95b1 100755
@@ -29,6 +29,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_symlinks
 
 rm -f $seqres.full
 
tests/generic/294 +1 -0
index b74579ac..32c89b03 100755
@@ -32,6 +32,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_symlinks
 
 rm -f $seqres.full
 _scratch_mkfs > $seqres.full 2>&1 || _fail "Could not mkfs scratch device"
tests/generic/306 +1 -0
index 081d1a89..046f4516 100755
@@ -33,6 +33,7 @@ _supported_fs generic
 _supported_os Linux
 _require_scratch
 _require_test
+_require_symlinks
 
 DEVNULL=$SCRATCH_MNT/devnull
 DEVZERO=$SCRATCH_MNT/devzero
tests/generic/348 +1 -0
index 630ff160..e0139d9a 100755
@@ -32,6 +32,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_symlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
tests/generic/360 +1 -0
index a9a4f2f9..f15548e2 100755
@@ -31,6 +31,7 @@ rm -f $seqres.full
 _supported_fs generic
 _supported_os Linux
 _require_test
+_require_symlinks
 
 linkfile=$TEST_DIR/$seq.symlink
 rm -f $linkfile
tests/generic/397 +1 -0
index f2e22950..c2245bd5 100755
@@ -36,6 +36,7 @@ rm -f $seqres.full
 # real QA test starts here
 _supported_fs generic
 _supported_os Linux
+_require_symlinks
 _require_scratch_encryption
 _require_command "$KEYCTL_PROG" keyctl
 
tests/generic/399 +1 -0
index a9b3997a..a4013720 100755
@@ -43,6 +43,7 @@ rm -f $seqres.full
 _supported_fs generic
 _supported_os Linux
 _require_scratch_encryption
+_require_symlinks
 _require_command "$XZ_PROG" xz
 _require_command "$KEYCTL_PROG" keyctl
 
tests/generic/401 +1 -0
index 9d45fbcd..00e9bbe0 100755
@@ -37,6 +37,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_symlinks
 _require_test_program "t_dir_type"
 
 rm -f $seqres.full
tests/generic/423 +1 -0
index b61d5de0..6db55fd6 100755
@@ -38,6 +38,7 @@ _require_test
 _require_test_program "stat_test"
 _require_test_program "af_unix"
 _require_statx
+_require_symlinks
 
 function check_stat () {
 	$here/src/stat_test $* || echo stat_test failed
tests/generic/440 +1 -0
index 1ec1ed48..3446c147 100755
@@ -38,6 +38,7 @@ rm -f $seqres.full
 _supported_fs generic
 _supported_os Linux
 _require_scratch_encryption
+_require_symlinks
 _require_command "$KEYCTL_PROG" keyctl
 
 # Set up an encryption-capable filesystem and an encryption key.
tests/generic/479 +1 -0
index ad20aaee..aaf864a4 100755
@@ -32,6 +32,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_symlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
tests/generic/556 +1 -0
index b7239e34..4899b403 100755
@@ -19,6 +19,7 @@ _supported_os Linux
 _supported_fs generic
 _require_scratch_nocheck
 _require_scratch_casefold
+_require_symlinks
 _require_check_dmesg
 _require_attrs
 
#6 lore raw

PATCH 2/2 fstests: add _require_hardlinks for all necessary tests

In reply to Eric Sandeen

Add a new _require function for hardlinks, to test hardlink support in all tests which need it.

---

common/rc +12 -0
index 476d3d07..8bb9aa1f 100644
@@ -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 `basename $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
tests/generic/002 +1 -0
index 575ac42b..480b77bc 100755
@@ -28,6 +28,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_test
+_require_hardlinks
 
 rm -f $seqres.full
 
tests/generic/039 +1 -0
index daa2e353..27cd6bf5 100755
@@ -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
tests/generic/040 +1 -0
index 712ae595..b69d8127 100755
@@ -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
tests/generic/041 +1 -0
index 8001e8ce..1674d544 100755
@@ -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
tests/generic/056 +1 -0
index 9caf1166..28920d36 100755
@@ -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
tests/generic/057 +1 -0
index ba51dbb9..91e1d98e 100755
@@ -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
tests/generic/065 +1 -0
index d6a1670b..30f3c32e 100755
@@ -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
tests/generic/089 +1 -0
index 3d608269..52649596 100755
@@ -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
tests/generic/090 +1 -0
index bf38d1c8..db1aeef3 100755
@@ -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
tests/generic/104 +1 -0
index d78689f4..4b6256db 100755
@@ -31,6 +31,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
tests/generic/106 +1 -0
index 74d5dc30..e1c859e5 100755
@@ -30,6 +30,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
tests/generic/107 +1 -0
index 5c6bbfca..214f3389 100755
@@ -33,6 +33,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
tests/generic/236 +1 -1
index f207165f..2110b053 100755
@@ -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*
tests/generic/336 +1 -0
index e007552c..6832ccde 100755
@@ -32,6 +32,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
tests/generic/343 +1 -0
index e35488dd..2034197e 100755
@@ -32,6 +32,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
tests/generic/378 +1 -0
index 393d1ce7..ea776949 100755
@@ -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
tests/generic/480 +1 -0
index ba2c34ad..63a87519 100755
@@ -32,6 +32,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
tests/generic/498 +1 -0
index 71f5091c..7adf0b32 100755
@@ -31,6 +31,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
tests/generic/502 +1 -0
index a60ac9a7..a49ee0b3 100755
@@ -34,6 +34,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
tests/generic/526 +1 -0
index d0b51f87..934d263f 100755
@@ -32,6 +32,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
tests/generic/527 +1 -0
index 61dd4f0b..4b664da9 100755
@@ -32,6 +32,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
#7 lore raw

Re: [PATCH 2/2] fstests: add _require_hardlinks for all necessary tests

Quoted 11 lines · Eric Sandeen

Add a new _require function for hardlinks, to test hardlink support in all tests which need it.

---

common/rc +0 -0
index 476d3d07..8bb9aa1f 100644

common/rc _require_symlinks() · line 3500

Quoted 8 lines
common/rc +5 -0
@@ -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 `basename $target` $link

I really doubt if it works. Why we need the basename of the $target? It cause we create a link in *current* directory, and the current directory isn't the $TEST_DIR.

The _require_symlinks won't fail due to symlink can be created cross filesystems, but hardlink can't. But that's not the _require_symlinks want to test, right?

So why we need the basename? Please correct me if I'm wrong.

Thanks,
Zorro

Quoted 265 lines
common/rc +7 -0
+	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
tests/generic/002 +1 -0
index 575ac42b..480b77bc 100755
@@ -28,6 +28,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_test
+_require_hardlinks
 
 rm -f $seqres.full
 
tests/generic/039 +1 -0
index daa2e353..27cd6bf5 100755
@@ -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
tests/generic/040 +1 -0
index 712ae595..b69d8127 100755
@@ -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
tests/generic/041 +1 -0
index 8001e8ce..1674d544 100755
@@ -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
tests/generic/056 +1 -0
index 9caf1166..28920d36 100755
@@ -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
tests/generic/057 +1 -0
index ba51dbb9..91e1d98e 100755
@@ -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
tests/generic/065 +1 -0
index d6a1670b..30f3c32e 100755
@@ -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
tests/generic/089 +1 -0
index 3d608269..52649596 100755
@@ -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
tests/generic/090 +1 -0
index bf38d1c8..db1aeef3 100755
@@ -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
tests/generic/104 +1 -0
index d78689f4..4b6256db 100755
@@ -31,6 +31,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
tests/generic/106 +1 -0
index 74d5dc30..e1c859e5 100755
@@ -30,6 +30,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
tests/generic/107 +1 -0
index 5c6bbfca..214f3389 100755
@@ -33,6 +33,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
tests/generic/236 +1 -1
index f207165f..2110b053 100755
@@ -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*
tests/generic/336 +1 -0
index e007552c..6832ccde 100755
@@ -32,6 +32,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
tests/generic/343 +1 -0
index e35488dd..2034197e 100755
@@ -32,6 +32,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
tests/generic/378 +1 -0
index 393d1ce7..ea776949 100755
@@ -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
tests/generic/480 +1 -0
index ba2c34ad..63a87519 100755
@@ -32,6 +32,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
tests/generic/498 +1 -0
index 71f5091c..7adf0b32 100755
@@ -31,6 +31,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
tests/generic/502 +1 -0
index a60ac9a7..a49ee0b3 100755
@@ -34,6 +34,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
tests/generic/526 +1 -0
index d0b51f87..934d263f 100755
@@ -32,6 +32,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full
tests/generic/527 +1 -0
index 61dd4f0b..4b664da9 100755
@@ -32,6 +32,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_hardlinks
 _require_dm_target flakey
 
 rm -f $seqres.full

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw

Re: [PATCH 2/2] fstests: add _require_hardlinks for all necessary tests

Quoted 31 lines · Eric Sandeen
Quoted 25 lines · Zorro Lang
Quoted 11 lines · Eric Sandeen

Add a new _require function for hardlinks, to test hardlink support in all tests which need it.

---

common/rc +0 -0
index 476d3d07..8bb9aa1f 100644

common/rc _require_symlinks() · line 3500

Quoted 8 lines
common/rc +5 -0
@@ -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 `basename $target` $link

I really doubt if it works. Why we need the basename of the $target? It cause we create a link in *current* directory, and the current directory isn't the $TEST_DIR.

Quoted 4 lines

The _require_symlinks won't fail due to symlink can be created cross filesystems, but hardlink can't. But that's not the _require_symlinks want to test, right?

So why we need the basename? Please correct me if I'm wrong.

Quoted 7 lines

Sigh, no I'm wrong. I just copied _require_symlinks without looking closely, and dropped the "-s" for a hardlink.

I forgot that the argument to ln -s can be an arbitrary relative path,

"Symbolic links can hold arbitrary text; if later resolved, a relative link is interpreted in relation to its parent directory."

Wow, yes! The manual of *ln* talk about that. I even never noticed that :-P Thanks for telling me about it. So the _require_symlinks is fine, but the _require_hardlinks need to fixed.

Thanks,
Zorro

Quoted 22 lines
$ mkdir /tmp/test
$ export TEST_DIR=/tmp/test
$ target=`mktemp -p $TEST_DIR`
$ link=`mktemp -p $TEST_DIR -u`
$ echo $target
/tmp/test/tmp.zjKtdM7Y0r
$ echo $link
/tmp/test/tmp.sdmFq6vyyl
$ ln -s `basename $target` $link
$ ls -l /tmp/test
total 0
lrwxrwxrwx. 1 sandeen sandeen 14 Apr 13 08:27 tmp.sdmFq6vyyl -> tmp.zjKtdM7Y0r
-rw-------. 1 sandeen sandeen  0 Apr 13 08:27 tmp.zjKtdM7Y0r

Thanks for catching this, and sorry for making such a mess of this series.

-Eric