Whamcloud - gitweb
LU-16589 tests: add sanity/31l to test ln command 65/50265/2
authorAndreas Dilger <adilger@whamcloud.com>
Mon, 13 Mar 2023 04:43:53 +0000 (21:43 -0700)
committerOleg Drokin <green@whamcloud.com>
Tue, 28 Mar 2023 22:19:11 +0000 (22:19 +0000)
This patch adds a new subtest sanity/31l to test
hard-linking a file to a target direcory that has
trailing "/".

The subtest will be skipped if the coreutils version
>= 8.31 and kernel version < 5.18 because the
coreutils commit v8.30-18-g571f63f5010b reveals
a kernel issue, which is fixed by kernel commit
v5.18-rc2-188-gb3d4650d82c7.

Test-Parameters: trivial clientdistro=el7.9 env=ONLY=31l testlist=sanity
Test-Parameters: trivial clientdistro=el8.7 env=ONLY=31l testlist=sanity
Test-Parameters: trivial clientdistro=el9.1 env=ONLY=31l testlist=sanity
Test-Parameters: trivial clientdistro=el9.0 env=ONLY=31l testlist=sanity
Test-Parameters: trivial clientdistro=sles15sp4 env=ONLY=31l testlist=sanity
Test-Parameters: trivial clientdistro=sles15sp3 env=ONLY=31l testlist=sanity

Change-Id: I45d7c277a37fa538d5137150bfc7ba1704052873
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Jian Yu <yujian@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50265
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Alex Deiter <alex.deiter@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/sanity.sh

index b536b4f..f34737c 100755 (executable)
@@ -3731,6 +3731,19 @@ test_31k() {
 }
 run_test 31k "link to file: the same, non-existing, dir==============="
 
+test_31l() {
+       local ln_ver=$(ln --version | awk '/coreutils/ { print $4 }')
+
+       (( $(version_code $ln_ver) < $(version_code 8.31) )) ||
+       (( $(version_code $(uname -r)) >= $(version_code 5.18) )) ||
+               skip "need coreutils < 8.31 or kernel >= 5.18 for ln"
+
+       touch $DIR/$tfile || error "create failed"
+       mkdir $DIR/$tdir || error "mkdir failed"
+       ln $DIR/$tfile $DIR/$tdir/ || error "ln to '$tdir/' failed"
+}
+run_test 31l "link to file: target dir has trailing slash"
+
 test_31m() {
         mkdir $DIR/d31m
         touch $DIR/d31m/s