From 6f176edfcfde583f1df4d3a06ef56bcf08c98d6c Mon Sep 17 00:00:00 2001 From: Xiao Liang Date: Fri, 9 Oct 2020 21:55:37 +0800 Subject: [PATCH] block/022: skip test when only 1 cpu available Below is fail log in single cpu node. block/022 (Test hang caused by freeze/unfreeze sequence) [failed] runtime ... 30.138s --- tests/block/022.out 2020-10-09 12:43:48.000000000 +0000 +++ /usr/local/blktests/results/nodev/block/022.out.bad 2020-10-09 13:45:18.594417401 +0000 @@ -1,2 +1,3 @@ Running block/022 +taskset: failed to set pid 13212's affinity: Invalid argument Test complete Signed-off-by: Xiao Liang [Shin'ichiro: fixed commit message typo and resolved merge conflict] Signed-off-by: Shin'ichiro Kawasaki --- common/rc | 8 ++++++++ tests/block/022 | 1 + 2 files changed, 9 insertions(+) diff --git a/common/rc b/common/rc index 0528ce8..5e35e21 100644 --- a/common/rc +++ b/common/rc @@ -189,6 +189,14 @@ _have_fs() { fi } +_require_min_cpus() { + if [[ $(nproc) -ge $1 ]]; then + return 0 + fi + SKIP_REASON="minimum $1 cpus required" + return 1 +} + _test_dev_is_rotational() { [[ $(cat "${TEST_DEV_SYSFS}/queue/rotational") -ne 0 ]] } diff --git a/tests/block/022 b/tests/block/022 index b2c53e2..30b2a68 100755 --- a/tests/block/022 +++ b/tests/block/022 @@ -13,6 +13,7 @@ TIMED=1 requires() { _have_null_blk && _have_module_param null_blk shared_tags + _require_min_cpus 2 } hotplug_test() { -- 2.49.0