In some cases we may need to check multiple sysfs values for tests. If this happens, create the ability to pass in multiple arguments to _require_test_dev_sysfs() instead of having to call the function multiple times. Signed-off-by: John Pittman --- common/rc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/common/rc b/common/rc index b76a856..e4b5196 100644 --- a/common/rc +++ b/common/rc @@ -326,11 +326,14 @@ _test_dev_is_rotational() { } _require_test_dev_sysfs() { - if [[ ! -e "${TEST_DEV_SYSFS}/$1" ]]; then - SKIP_REASONS+=("${TEST_DEV} does not have sysfs attribute $1") - return 1 - fi - return 0 + local ret=0 + for attr in "$@"; do + if [[ ! -e "${TEST_DEV_SYSFS}/$attr" ]]; then + SKIP_REASONS+=("${TEST_DEV} does not have sysfs attribute $attr") + ret=1 + fi + done + return $ret } _require_test_dev_is_rotational() { -- 2.51.1 In testing some older kernels recently, block/042 has failed due to dma_alignment and virt_boundary_mask not being present. Running block/042 +cat: '.../queue/dma_alignment': No such file or directory +cat: '.../queue/virt_boundary_mask': No such file or directory +dio-offsets: test_dma_aligned: failed to write buf: Invalid argument To ensure we skip if this is the case, check all sysfs values prior to run. Signed-off-by: John Pittman --- tests/block/042 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/block/042 b/tests/block/042 index 28ac4a2..bbf13fd 100644 --- a/tests/block/042 +++ b/tests/block/042 @@ -11,7 +11,9 @@ DESCRIPTION="Test unusual direct-io offsets" QUICK=1 device_requires() { - _require_test_dev_sysfs + _require_test_dev_sysfs "" "queue/max_segments" "queue/dma_alignment" \ + "queue/virt_boundary_mask" "queue/logical_block_size" \ + "queue/max_sectors_kb" } test_device() { -- 2.51.1