From e998d21caf99e32495950219e88dd9e7f981363e Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Sun, 12 Mar 2023 21:43:53 -0700 Subject: [PATCH] LU-16589 tests: add sanity/31l to test ln command 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 Signed-off-by: Jian Yu Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50265 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Alex Deiter Reviewed-by: Oleg Drokin --- lustre/tests/sanity.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index b536b4f..f34737c 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -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 -- 1.8.3.1