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() {