Skip to content

Commit a051961

Browse files
committed
check: print device names provided to test_device_array()
When a test case has test_device(), blktests prints the name of the test target device provided to test_device(). The commit 653ace8 ("check, new: introduce test_device_array()") introduced the support for test_device_array() which runs the test for multiple devices. However, when the test case has test_device_array(), blktests does not print the names of the test target devices. Modify the check script to print the test target device names. For that purpose, factor out two _output_status() calls into a new helper function _output_test_name(). In that function, print TEST_DEV_ARRAY elements which are provided to test_dev_array() as the test target. After this commit, md/003 run will look like as follows: md/003 => nvme1n1 nvme2n1 nvme3n1 nvme4n1 (test md atomic writes for NVMe drives) [passed] runtime 18.678s ... 18.446s Tested-by: John Garry <[email protected]> Signed-off-by: Shin'ichiro Kawasaki <[email protected]>
1 parent 8c610b5 commit a051961

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

check

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,25 @@ _output_notrun() {
252252
_output_skip_reasons
253253
}
254254

255-
_output_last_test_run() {
255+
_output_test_name() {
256+
local dev
257+
local -a devs
258+
local status="$1"
259+
256260
if [[ "${TEST_DEV:-}" ]]; then
257-
_output_status "$TEST_NAME => $(basename "$TEST_DEV")" ""
261+
_output_status "$TEST_NAME => $(basename "$TEST_DEV")" "$status"
262+
elif [[ "${TEST_DEV_ARRAY:-}" ]]; then
263+
for dev in "${TEST_DEV_ARRAY[@]}"; do
264+
devs+=("${dev##*/}")
265+
done
266+
_output_status "$TEST_NAME => ${devs[*]}" "$status"
258267
else
259-
_output_status "$TEST_NAME" ""
268+
_output_status "$TEST_NAME" "$status"
260269
fi
270+
}
271+
272+
_output_last_test_run() {
273+
_output_test_name ""
261274

262275
{
263276
local key
@@ -277,11 +290,7 @@ _output_test_run() {
277290
if [[ $status = pass || $status = fail ]]; then
278291
status+="ed"
279292
fi
280-
if [[ "${TEST_DEV:-}" ]]; then
281-
_output_status "$TEST_NAME => $(basename "$TEST_DEV")" "$status"
282-
else
283-
_output_status "$TEST_NAME" "$status"
284-
fi
293+
_output_test_name "$status"
285294

286295
{
287296
local key last_value value

0 commit comments

Comments
 (0)