xfs/513: fix allocsize on archs with pagesize larger than blocksize
authorAnthony Iliopoulos <ailiopoulos@suse.com>
Sat, 7 Mar 2020 10:54:57 +0000 (11:54 +0100)
committerEryu Guan <guaneryu@gmail.com>
Sun, 8 Mar 2020 15:47:56 +0000 (23:47 +0800)
The minimum accepted allocsize mount option value is page size, which
causes the particular test to fail in architectures where page size >
block size. Fix it by basing the value on the platform page size rather
than the block size as obtained from mkfs. In addition add a filter so
that different values can be used without breaking the golden output.

Signed-off-by: Anthony Iliopoulos <ailiopoulos@suse.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/xfs/513
tests/xfs/513.out

index 70bc2f1cd9de65160b8dcf510fce42b00677332e..094d0c6cd740cca00c1271a492007fe1fe93ea72 100755 (executable)
@@ -68,6 +68,11 @@ filter_loop()
            -e "s,\B$LOOP_SPARE_DEV,LOOP_SPARE_DEV,g"
 }
 
+filter_xfs_opt()
+{
+       sed -e "s,allocsize=$pagesz,allocsize=PAGESIZE,g"
+}
+
 # avoid the effection from MKFS_OPTIONS
 MKFS_OPTIONS=""
 do_mkfs()
@@ -165,7 +170,7 @@ do_test()
        # Print each argument, include nil ones
        echo -n "TEST:" | tee -a $seqres.full
        for i in "$@";do
-               echo -n " \"$i\"" | filter_loop | tee -a $seqres.full
+               echo -n " \"$i\"" | filter_loop | filter_xfs_opt | tee -a $seqres.full
        done
        echo | tee -a $seqres.full
 
@@ -180,11 +185,12 @@ echo "** start xfs mount testing ..."
 # Test allocsize=size
 # Valid values for this option are page size (typically 4KiB) through to 1GiB
 do_mkfs
-if [ $dbsize -ge 1024 ];then
-       blsize="$((dbsize / 1024))k"
+pagesz=$(get_page_size)
+if [ $pagesz -ge 1024 ];then
+       pagesz="$((pagesz / 1024))k"
 fi
 do_test "" pass "allocsize" "false"
-do_test "-o allocsize=$blsize" pass "allocsize=$blsize" "true"
+do_test "-o allocsize=$pagesz" pass "allocsize=$pagesz" "true"
 do_test "-o allocsize=1048576k" pass "allocsize=1048576k" "true"
 do_test "-o allocsize=$((dbsize / 2))" fail
 do_test "-o allocsize=2g" fail
index 9be18dd86bca78ae2a1bc549b65374b7c77ae576..6681a7e8255be4d10b6731ed47b10ff4f203528a 100644 (file)
@@ -5,7 +5,7 @@ QA output created by 513
 ** start xfs mount testing ...
 FORMAT: 
 TEST: "" "pass" "allocsize" "false"
-TEST: "-o allocsize=4k" "pass" "allocsize=4k" "true"
+TEST: "-o allocsize=PAGESIZE" "pass" "allocsize=PAGESIZE" "true"
 TEST: "-o allocsize=1048576k" "pass" "allocsize=1048576k" "true"
 TEST: "-o allocsize=2048" "fail"
 TEST: "-o allocsize=2g" "fail"