OSDN Git Service

tests: avoid a race condition in the scsi_debug-using tests
authorJim Meyering <meyering@redhat.com>
Fri, 8 Apr 2011 16:30:40 +0000 (18:30 +0200)
committerJim Meyering <meyering@redhat.com>
Thu, 14 Apr 2011 09:34:38 +0000 (11:34 +0200)
commitbbe50a93b9fdffe35a1ee5bcb2320d746156914a
tree2a6b6bdf1422eedbeaed3a06914a71cdceba822c
parent552805a03a79f7b6badaf26536d86db580360f98
tests: avoid a race condition in the scsi_debug-using tests

* tests/t-local.sh (new_sdX_): New function.
(scsi_debug_setup_): Use new_sdX_ to find the just-created device name,
rather relying on the list of file names in /sys/block/sd* changing.
Sometimes the list would not change, which would lead to tests failing
with I/O errors when run in parallel.  Thanks to Brian Lane for the
tip that /sys/block/sd*/device/model contains "scsi_debug" if there
is a device created by our "modprobe scsi_debug" command.
tests/t-local.sh