Skip to content

Commit 27dbdcf

Browse files
committed
common/rc: introduce _have_page_size helper to skip incompatible tests
Introduce a new helper function `_have_page_size()` in `common/rc` to check the system's memory page size using `getconf`. 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: #234 Suggested-by: Bart Van Assche <[email protected]> Signed-off-by: Yi Zhang <[email protected]>
1 parent 078a7ac commit 27dbdcf

3 files changed

Lines changed: 18 additions & 0 deletions

File tree

common/rc

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

555+
# Check if the system page size matches the required size (in bytes).
556+
# Example: _have_page_size 4096
557+
_have_page_size() {
558+
local required_size="$1"
559+
local current_size
560+
561+
current_size=$(getconf PAGESIZE)
562+
563+
if [ "$current_size" -ne "$required_size" ]; then
564+
SKIP_REASONS+=("This test requires ${required_size} bytes page size, but system has ${current_size} bytes")
565+
return 1
566+
fi
567+
568+
return 0
569+
}
570+
555571
_systemctl_start() {
556572
local unit="$1"
557573

tests/scsi/011

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ requires() {
1717
_have_kver 6 10
1818
_have_program mkfs.f2fs
1919
_have_scsi_debug_group_number_stats
20+
_have_page_size 4096
2021
}
2122

2223
run_test() {

tests/zbd/010

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ requires() {
1616
_have_module_param scsi_debug zone_cap_mb
1717
_have_program mkfs.f2fs
1818
_have_module scsi_debug
19+
_have_page_size 4096
1920
}
2021

2122
test() {

0 commit comments

Comments
 (0)