Skip to content

Commit 50af4ac

Browse files
zhijianli88kawasaki
authored andcommitted
tests: Remove unnecessary '&&' in requires() functions
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 <[email protected]> Signed-off-by: Shin'ichiro Kawasaki <[email protected]>
1 parent 5e517ef commit 50af4ac

File tree

17 files changed

+37
-18
lines changed

17 files changed

+37
-18
lines changed

tests/block/006

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ TIMED=1
1515
CAN_BE_ZONED=1
1616

1717
requires() {
18-
_have_null_blk && _have_module_param null_blk blocking && _have_fio
18+
_have_null_blk && _have_module_param null_blk blocking
19+
_have_fio
1920
}
2021

2122
test() {

tests/block/008

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ TIMED=1
1212
CAN_BE_ZONED=1
1313

1414
requires() {
15-
_have_cpu_hotplug && _have_fio
15+
_have_cpu_hotplug
16+
_have_fio
1617
}
1718

1819
test_device() {

tests/block/010

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ TIMED=1
1515
CAN_BE_ZONED=1
1616

1717
requires() {
18-
_have_null_blk && _have_module_param null_blk shared_tags && _have_fio
18+
_have_null_blk && _have_module_param null_blk shared_tags
19+
_have_fio
1920
}
2021

2122
run_fio_job() {

tests/block/011

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ pci_dev_mounted() {
2424
}
2525

2626
requires() {
27-
_have_fio && _have_program setpci
27+
_have_fio
28+
_have_program setpci
2829
}
2930

3031
device_requires() {

tests/block/019

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ QUICK=1
1111
CAN_BE_ZONED=1
1212

1313
requires() {
14-
_have_fio && _have_program setpci
14+
_have_fio
15+
_have_program setpci
1516
}
1617

1718
device_requires() {

tests/block/020

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ QUICK=1
1414
CAN_BE_ZONED=1
1515

1616
requires() {
17-
_have_null_blk && _have_fio
17+
_have_null_blk
18+
_have_fio
1819
}
1920

2021
test() {

tests/block/029

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ DESCRIPTION="trigger blk_mq_update_nr_hw_queues()"
1111
QUICK=1
1212

1313
requires() {
14-
_have_fio && _have_null_blk
14+
_have_fio
15+
_have_null_blk
1516
}
1617

1718
modify_nr_hw_queues() {

tests/loop/002

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ DESCRIPTION="try various loop device block sizes"
1515
QUICK=1
1616

1717
requires() {
18-
_have_program xfs_io && _have_src_program loblksize && _have_loop_set_block_size
18+
_have_program xfs_io
19+
_have_src_program loblksize
20+
_have_loop_set_block_size
1921
}
2022

2123
test() {

tests/nbd/001

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ DESCRIPTION="resize a connected nbd device"
1111
QUICK=1
1212

1313
requires() {
14-
_have_nbd && _have_program parted && _have_src_program nbdsetsize
14+
_have_nbd
15+
_have_program parted
16+
_have_src_program nbdsetsize
1517
}
1618

1719
test() {

tests/nbd/002

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ DESCRIPTION="tests on partition handling for an nbd device"
1717
QUICK=1
1818

1919
requires() {
20-
_have_nbd_netlink && _have_program parted
20+
_have_nbd_netlink
21+
_have_program parted
2122
}
2223

2324
test() {

0 commit comments

Comments
 (0)