From b3dd06bbd9fd4e2a156cb5eb75ab9d29df05e726 Mon Sep 17 00:00:00 2001 From: Yi Zhang Date: Mon, 30 Mar 2026 23:07:03 -0400 Subject: [PATCH] common/rc: introduce _page_size_equals helper to skip incompatible tests Introduce a new helper function `_get_page_size` to get system page size, and `_page_size_equals()` to check the whether system page size equal one value. Update `scsi/011` and `zbd/010` to use this helper and gracefully skip the tests if the page size is not 4096 bytes. This prevents test failures on non-4K page architectures. Fixes: https://github.com/linux-blktests/blktests/issues/234 Suggested-by: Bart Van Assche Signed-off-by: Yi Zhang --- common/rc | 25 +++++++++++++++++++++++++ tests/scsi/011 | 1 + tests/zbd/010 | 1 + 3 files changed, 27 insertions(+) diff --git a/common/rc b/common/rc index 0a8caca0..5350057b 100644 --- a/common/rc +++ b/common/rc @@ -552,6 +552,31 @@ _have_systemctl_unit() { return 0 } +# Get system page size from kernel conguration +_get_page_size() { + local page_shift + + page_shift=$(_get_kernel_option PAGE_SHIFT) + + echo $((1<< page_shift)) +} + +# Check if the system page size matches the required size (in bytes). +# Example: _page_size_equals 4096 +_page_size_equals() { + local required_size="$1" + local current_size + + current_size=$(_get_page_size) + + if [ "$current_size" -ne "$required_size" ]; then + SKIP_REASONS+=("This test requires ${required_size} bytes page size, but system has ${current_size} bytes") + return 1 + fi + + return 0 +} + _systemctl_start() { local unit="$1" diff --git a/tests/scsi/011 b/tests/scsi/011 index a96b7e68..267c8a0d 100755 --- a/tests/scsi/011 +++ b/tests/scsi/011 @@ -17,6 +17,7 @@ requires() { _have_kver 6 10 _have_program mkfs.f2fs _have_scsi_debug_group_number_stats + _page_size_equals 4096 } run_test() { diff --git a/tests/zbd/010 b/tests/zbd/010 index c5cb76a0..6b92c346 100755 --- a/tests/zbd/010 +++ b/tests/zbd/010 @@ -16,6 +16,7 @@ requires() { _have_module_param scsi_debug zone_cap_mb _have_program mkfs.f2fs _have_module scsi_debug + _page_size_equals 4096 } test() {