The '&&' operator should only be used when the second operand is dependent on the first. In the context of requires() functions, we prefer to evaluate all conditions independently to display all SKIP_REASONS at once. This change separates the conditions into individual lines to ensure each condition is evaluated regardless of the others. After this patch, there are a few '&&' remain $ git grep -wl 'requires()' | xargs -I {} sed -n '/^requires() *{/,/}/p' {} | grep '&&' _have_null_blk && _have_module_param null_blk blocking _have_null_blk && _have_module_param null_blk shared_tags _have_null_blk && _have_module_param null_blk timeout _have_null_blk && _have_module_param null_blk requeue _have_null_blk && _have_module_param null_blk shared_tags _have_null_blk && _have_module_param null_blk init_hctx _have_module nvme_tcp && _have_module_param nvme_tcp ddp_offload _have_program mkfs.btrfs && have_good_mkfs_btrfs Signed-off-by: Li Zhijian <lizhijian@xxxxxxxxxxx> --- V2: rebase and Even though '_have_null_blk && _have_module_param null_blk' can be simplify to '_have_module_param null_blk', I keep it as it's so that we are safe to have updates in _have_null_blk() in the future. --- tests/block/006 | 3 ++- tests/block/008 | 3 ++- tests/block/010 | 3 ++- tests/block/011 | 3 ++- tests/block/019 | 3 ++- tests/block/020 | 3 ++- tests/block/029 | 3 ++- tests/loop/002 | 4 +++- tests/nbd/001 | 4 +++- tests/nbd/002 | 3 ++- tests/nbd/003 | 3 ++- tests/nvme/005 | 3 ++- tests/nvme/010 | 3 ++- tests/nvme/039 | 4 ++-- tests/nvme/056 | 4 +++- tests/scsi/001 | 3 ++- tests/scsi/002 | 3 ++- 17 files changed, 37 insertions(+), 18 deletions(-) diff --git a/tests/block/006 b/tests/block/006 index 7d05b1113fb9..8601397f4bf8 100755 --- a/tests/block/006 +++ b/tests/block/006 @@ -15,7 +15,8 @@ TIMED=1 CAN_BE_ZONED=1 requires() { - _have_null_blk && _have_module_param null_blk blocking && _have_fio + _have_null_blk && _have_module_param null_blk blocking + _have_fio } test() { diff --git a/tests/block/008 b/tests/block/008 index cd0935259157..859c0fe7d85e 100755 --- a/tests/block/008 +++ b/tests/block/008 @@ -12,7 +12,8 @@ TIMED=1 CAN_BE_ZONED=1 requires() { - _have_cpu_hotplug && _have_fio + _have_cpu_hotplug + _have_fio } test_device() { diff --git a/tests/block/010 b/tests/block/010 index ed5613525255..5b52fdb948c7 100755 --- a/tests/block/010 +++ b/tests/block/010 @@ -15,7 +15,8 @@ TIMED=1 CAN_BE_ZONED=1 requires() { - _have_null_blk && _have_module_param null_blk shared_tags && _have_fio + _have_null_blk && _have_module_param null_blk shared_tags + _have_fio } run_fio_job() { diff --git a/tests/block/011 b/tests/block/011 index 63212122a736..662f41c301ce 100755 --- a/tests/block/011 +++ b/tests/block/011 @@ -24,7 +24,8 @@ pci_dev_mounted() { } requires() { - _have_fio && _have_program setpci + _have_fio + _have_program setpci } device_requires() { diff --git a/tests/block/019 b/tests/block/019 index 58aca4cc1020..723eb61350f9 100755 --- a/tests/block/019 +++ b/tests/block/019 @@ -11,7 +11,8 @@ QUICK=1 CAN_BE_ZONED=1 requires() { - _have_fio && _have_program setpci + _have_fio + _have_program setpci } device_requires() { diff --git a/tests/block/020 b/tests/block/020 index 5ffa23248804..66f380edfc61 100755 --- a/tests/block/020 +++ b/tests/block/020 @@ -14,7 +14,8 @@ QUICK=1 CAN_BE_ZONED=1 requires() { - _have_null_blk && _have_fio + _have_null_blk + _have_fio } test() { diff --git a/tests/block/029 b/tests/block/029 index b9a897dbf830..c00bdeba28e1 100755 --- a/tests/block/029 +++ b/tests/block/029 @@ -11,7 +11,8 @@ DESCRIPTION="trigger blk_mq_update_nr_hw_queues()" QUICK=1 requires() { - _have_fio && _have_null_blk + _have_fio + _have_null_blk } modify_nr_hw_queues() { diff --git a/tests/loop/002 b/tests/loop/002 index d0ef964989e6..07b9c6c53c9c 100755 --- a/tests/loop/002 +++ b/tests/loop/002 @@ -15,7 +15,9 @@ DESCRIPTION="try various loop device block sizes" QUICK=1 requires() { - _have_program xfs_io && _have_src_program loblksize && _have_loop_set_block_size + _have_program xfs_io + _have_src_program loblksize + _have_loop_set_block_size } test() { diff --git a/tests/nbd/001 b/tests/nbd/001 index 0975af0543e2..cc083e3ce6ed 100755 --- a/tests/nbd/001 +++ b/tests/nbd/001 @@ -11,7 +11,9 @@ DESCRIPTION="resize a connected nbd device" QUICK=1 requires() { - _have_nbd && _have_program parted && _have_src_program nbdsetsize + _have_nbd + _have_program parted + _have_src_program nbdsetsize } test() { diff --git a/tests/nbd/002 b/tests/nbd/002 index 8e4e062eba66..00701b11236d 100755 --- a/tests/nbd/002 +++ b/tests/nbd/002 @@ -17,7 +17,8 @@ DESCRIPTION="tests on partition handling for an nbd device" QUICK=1 requires() { - _have_nbd_netlink && _have_program parted + _have_nbd_netlink + _have_program parted } test() { diff --git a/tests/nbd/003 b/tests/nbd/003 index 57fb63a9e70f..4fabdebc8f6a 100755 --- a/tests/nbd/003 +++ b/tests/nbd/003 @@ -11,7 +11,8 @@ DESCRIPTION="mount/unmount concurrently with NBD_CLEAR_SOCK" QUICK=1 requires() { - _have_nbd && _have_src_program mount_clear_sock + _have_nbd + _have_src_program mount_clear_sock } test() { diff --git a/tests/nvme/005 b/tests/nvme/005 index 66c12fdb7d8d..8fc1f574ce3d 100755 --- a/tests/nvme/005 +++ b/tests/nvme/005 @@ -12,7 +12,8 @@ QUICK=1 requires() { _nvme_requires - _have_loop && _have_module_param_value nvme_core multipath Y + _have_loop + _have_module_param_value nvme_core multipath Y _require_nvme_trtype_is_fabrics } diff --git a/tests/nvme/010 b/tests/nvme/010 index a5ddf581ecc9..58c8693b1373 100755 --- a/tests/nvme/010 +++ b/tests/nvme/010 @@ -11,7 +11,8 @@ TIMED=1 requires() { _nvme_requires - _have_fio && _have_loop + _have_fio + _have_loop _require_nvme_trtype_is_fabrics } diff --git a/tests/nvme/039 b/tests/nvme/039 index eca8ba35475e..ab58f3b91c7d 100755 --- a/tests/nvme/039 +++ b/tests/nvme/039 @@ -14,8 +14,8 @@ QUICK=1 requires() { _have_program nvme - _have_kernel_option FAULT_INJECTION && \ - _have_kernel_option FAULT_INJECTION_DEBUG_FS + _have_kernel_option FAULT_INJECTION + _have_kernel_option FAULT_INJECTION_DEBUG_FS } device_requires() { diff --git a/tests/nvme/056 b/tests/nvme/056 index d4dda2d98b91..958c2e31165c 100755 --- a/tests/nvme/056 +++ b/tests/nvme/056 @@ -30,7 +30,9 @@ requires() { _have_fio _have_program ip _have_program ethtool - _have_kernel_source && _have_program python3 && have_netlink_cli + _have_kernel_source + _have_program python3 + have_netlink_cli have_iface } diff --git a/tests/scsi/001 b/tests/scsi/001 index 54ca58227659..9e43c8dfbd11 100755 --- a/tests/scsi/001 +++ b/tests/scsi/001 @@ -11,7 +11,8 @@ DESCRIPTION="try triggering a kernel GPF with 0 byte SG reads" QUICK=1 requires() { - _have_scsi_generic && _have_src_program sg/syzkaller1 + _have_scsi_generic + _have_src_program sg/syzkaller1 } test_device() { diff --git a/tests/scsi/002 b/tests/scsi/002 index b38706447f83..82e9d8a554ca 100755 --- a/tests/scsi/002 +++ b/tests/scsi/002 @@ -11,7 +11,8 @@ DESCRIPTION="perform a SG_DXFER_FROM_DEV from the /dev/sg read-write interface" QUICK=1 requires() { - _have_scsi_generic && _have_src_program sg/dxfer-from-dev + _have_scsi_generic + _have_src_program sg/dxfer-from-dev } test_device() { -- 2.47.0