From: ChenXiaoSong <chenxiaosong@chenxiaosong.com>
To: smfrench@gmail.com, linkinjeon@kernel.org, pc@manguebit.org,
ronniesahlberg@gmail.com, sprasad@microsoft.com, tom@talpey.com,
bharathsm@microsoft.com, senozhatsky@chromium.org,
dhowells@redhat.com, metze@samba.org, zlang@kernel.org,
lukas@herbolt.com
Cc: linux-cifs@vger.kernel.org, fstests@vger.kernel.org,
ChenXiaoSong <chenxiaosong@kylinos.cn>
Subject: [PATCH v2 xfstests resend 2/3] generic/002: clean up the test
Date: Mon, 20 Jul 2026 16:42:06 +0000 [thread overview]
Message-ID: <20260720164207.732522-3-chenxiaosong@chenxiaosong.com> (raw)
In-Reply-To: <20260720164207.732522-1-chenxiaosong@chenxiaosong.com>
From: ChenXiaoSong <chenxiaosong@kylinos.cn>
Add the hardlink group and use shorter loops. Use _exit() and change
the success text to "Silence is golden".
Suggested-by: Zorro Lang <zlang@kernel.org>
Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
---
tests/generic/002 | 16 ++++++----------
tests/generic/002.out | 2 +-
2 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/tests/generic/002 b/tests/generic/002
index 6df57a7a..9b210705 100755
--- a/tests/generic/002
+++ b/tests/generic/002
@@ -2,12 +2,12 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved.
#
-# FS QA Test No. 002
+# FS QA Test 002
#
# simple inode link count test for a regular file
#
. ./common/preamble
-_begin_fstest metadata udf auto quick
+_begin_fstest metadata udf auto quick hardlink
# Import common functions.
. ./common/filter
@@ -17,14 +17,11 @@ status=0 # success is the default!
_require_test
_require_hardlinks
-echo "Silence is goodness ..."
-
# ensure target directory exists
mkdir `dirname $TEST_DIR/tmp` 2>/dev/null
touch $TEST_DIR/tmp.1
-for l in 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
-do
+for ((l = 2; l <= 20; l++)); do
ln $TEST_DIR/tmp.1 $TEST_DIR/tmp.$l
x=`$here/src/lstat64 $TEST_DIR/tmp.1 | sed -n -e '/ Links: /s/.*Links: *//p'`
if [ "$l" -ne $x ]
@@ -35,8 +32,7 @@ do
fi
done
-for l in 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
-do
+for ((l = 20; l >= 1; l--)); do
x=`$here/src/lstat64 $TEST_DIR/tmp.1 | sed -n -e '/ Links: /s/.*Links: *//p'`
if [ "$l" -ne $x ]
then
@@ -47,5 +43,5 @@ do
rm -f $TEST_DIR/tmp.$l
done
-# success, all done
-exit
+echo "Silence is golden"
+exit $status
diff --git a/tests/generic/002.out b/tests/generic/002.out
index 11426b54..61705c7c 100644
--- a/tests/generic/002.out
+++ b/tests/generic/002.out
@@ -1,2 +1,2 @@
QA output created by 002
-Silence is goodness ...
+Silence is golden
--
2.43.0
next prev parent reply other threads:[~2026-07-20 16:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-20 16:42 [PATCH v2 xfstests resend 0/3] add generic/795 ChenXiaoSong
2026-07-20 16:42 ` [PATCH v2 xfstests resend 1/3] src: factor out common stat code ChenXiaoSong
2026-07-20 16:42 ` ChenXiaoSong [this message]
2026-07-20 16:42 ` [PATCH v2 xfstests resend 3/3] generic/795: check nlink returned by fstat() ChenXiaoSong
2026-07-28 3:28 ` [PATCH v2 xfstests resend 0/3] add generic/795 Christoph Hellwig
2026-07-28 3:35 ` ChenXiaoSong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260720164207.732522-3-chenxiaosong@chenxiaosong.com \
--to=chenxiaosong@chenxiaosong.com \
--cc=bharathsm@microsoft.com \
--cc=chenxiaosong@kylinos.cn \
--cc=dhowells@redhat.com \
--cc=fstests@vger.kernel.org \
--cc=linkinjeon@kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=lukas@herbolt.com \
--cc=metze@samba.org \
--cc=pc@manguebit.org \
--cc=ronniesahlberg@gmail.com \
--cc=senozhatsky@chromium.org \
--cc=smfrench@gmail.com \
--cc=sprasad@microsoft.com \
--cc=tom@talpey.com \
--cc=zlang@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox