Skip to content

Commit 8eca9fa

Browse files
yizhanglinuxkawasaki
authored andcommitted
common/rc, scsi/011, zbd/010: introduce _page_size_equals() helper
Introduce new helper functions `_get_page_size` to get system page size, and `_page_size_equals()` to check whether the system page size equals to the value specified. Update `scsi/011` and `zbd/010` to use the helpers and gracefully skip the tests if the page size is not 4096 bytes. This prevents test failures on 64K page architectures. The failure is expected since F2FS does not support 64K page size. According to the discussion at the Fixes tag link, it is expected the test cases work well with 16K page size. However, this commit makes the test cases skipped on systems with 16K page size. It is the left work to enable the test cases under 16K page size condition. Fixes: #234 Suggested-by: Bart Van Assche <[email protected]> Signed-off-by: Yi Zhang <[email protected]> [Shin'ichiro: amended commit message] Signed-off-by: Shin'ichiro Kawasaki <[email protected]>
1 parent af0b85f commit 8eca9fa

3 files changed

Lines changed: 27 additions & 0 deletions

File tree

common/rc

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,31 @@ _have_systemctl_unit() {
552552
return 0
553553
}
554554

555+
# Get system page size from kernel conguration
556+
_get_page_size() {
557+
local page_shift
558+
559+
page_shift=$(_get_kernel_option PAGE_SHIFT)
560+
561+
echo $((1<< page_shift))
562+
}
563+
564+
# Check if the system page size matches the required size (in bytes).
565+
# Example: _page_size_equals 4096
566+
_page_size_equals() {
567+
local required_size="$1"
568+
local current_size
569+
570+
current_size=$(_get_page_size)
571+
572+
if [ "$current_size" -ne "$required_size" ]; then
573+
SKIP_REASONS+=("This test requires ${required_size} bytes page size, but system has ${current_size} bytes")
574+
return 1
575+
fi
576+
577+
return 0
578+
}
579+
555580
_systemctl_start() {
556581
local unit="$1"
557582

tests/scsi/011

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ QUICK=1
1212
requires() {
1313
_have_fio
1414
_have_driver f2fs
15+
_page_size_equals 4096
1516
# See also commit 7643f3fe2772 ("f2fs: assign the write hint per stream
1617
# by default"; v6.10).
1718
_have_kver 6 10

tests/zbd/010

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ QUICK=1
1212
requires() {
1313
_have_fio
1414
_have_driver f2fs
15+
_page_size_equals 4096
1516
_have_module null_blk
1617
_have_module_param scsi_debug zone_cap_mb
1718
_have_program mkfs.f2fs

0 commit comments

Comments
 (0)