[LTP] [PATCH v1] du01.sh: Read the actual filesystem blocksize instead of pagesize

Wei Gao wegao@suse.com
Thu Jul 3 20:01:59 CEST 2025


On PPC systems, the page size doesn't always equal the size of a symlink.
Therefore, we need to update the test to read the actual filesystem blocksize
instead of assuming it's equal to the page size.

Signed-off-by: Wei Gao <wegao@suse.com>
---
 testcases/commands/du/du01.sh | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/testcases/commands/du/du01.sh b/testcases/commands/du/du01.sh
index 7977fd461..68099de9e 100755
--- a/testcases/commands/du/du01.sh
+++ b/testcases/commands/du/du01.sh
@@ -60,18 +60,16 @@ du_test()
 }
 
 block_size=512
-page_size=$(tst_getconf PAGESIZE)
-if [ "$page_size" -lt 1024 ]; then
-	tst_brk TBROK "Page size < 1024"
-fi
-page_size=$((page_size / 1024))
+
+FS_BLOCK_SIZE_BYTES=$(stat -f --format="%s" .)
+FS_BLOCK_SIZE_KB=$((FS_BLOCK_SIZE_BYTES / 1024))
 
 # The output could be different in some systems, if we use du to
 # estimate file space usage with the same filesystem and the same size.
 # So we use the approximate value to check.
 check1="^10[2-3][0-9][0-9][[:space:]]\."
 check2="^10[2-3][0-9][0-9][[:space:]]testfile"
-check3="^\(0\|${page_size}\)[[:space:]]\.\/testdir\/testsymlink"
+check3="^\(0\|${FS_BLOCK_SIZE_KB}\)[[:space:]]\.\/testdir\/testsymlink"
 check5="^20[4-6][0-9][0-9][[:space:]]\."
 check7="^10[4-5][0-9][0-9]\{4\}[[:space:]]\."
 check9="^10[2-3][0-9][0-9][[:space:]]total"
-- 
2.49.0



More information about the ltp mailing list