nvme/035 has minimum TEST_DEV size requirement, add a helper function to check it Signed-off-by: Yi Zhang <yi.zhang@xxxxxxxxxx> --- common/rc | 10 ++++++++++ tests/nvme/035 | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/common/rc b/common/rc index e490041..7987ac3 100644 --- a/common/rc +++ b/common/rc @@ -324,6 +324,16 @@ _get_pci_parent_from_blkdev() { tail -2 | head -1 } +_require_test_dev_size_mb() { + local require_sz_mb=$1 + local test_dev_sz_mb=$(($(blockdev --getsize64 "$TEST_DEV")/1024/1024)) + + if (( "$test_dev_sz_mb" < "$require_sz_mb" )); then + SKIP_REASONS+=("${TEST_DEV} required at least ${require_sz_mb}m") + return 1 + fi +} + _require_test_dev_in_hotplug_slot() { local parent parent="$(_get_pci_parent_from_blkdev)" diff --git a/tests/nvme/035 b/tests/nvme/035 index ee78a75..e8581ef 100755 --- a/tests/nvme/035 +++ b/tests/nvme/035 @@ -16,6 +16,10 @@ requires() { _have_fio } +device_requires() { + _require_test_dev_size_mb 1024 +} + test_device() { local subsys="blktests-subsystem-1" local ctrldev -- 2.34.1