diff options
author | Jan Stancek <jstancek@redhat.com> | 2020-07-07 16:07:14 +0200 |
---|---|---|
committer | Jan Stancek <jstancek@redhat.com> | 2020-07-09 13:11:21 +0200 |
commit | fec810aa86296cf230b672e290ec41c70fff4dd8 (patch) | |
tree | 06fa50ae345b93c80135bbfff6167122a13fe2a0 | |
parent | f780d9cdda69597bcc283ca6640bc884885f15b0 (diff) |
runltp: let each test acquire/release device
Problem with runltp creating and using single loop device for all tests
is that if one test fails/gets stuck or fails to umount loop device
for any reason, then all subsequent tests also fail, because
they try to use mounted device.
Don't force same loop device on all tests (unless it is chosen via
env. variable DEVICE) and let LTP library try to acquire first
usable loop device for each test.
Fixes #703
Signed-off-by: Jan Stancek <jstancek@redhat.com>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
-rwxr-xr-x | runltp | 38 |
1 files changed, 1 insertions, 37 deletions
@@ -935,45 +935,9 @@ EOF exit $VALUE } -create_block() -{ - #create a block device - dd if=/dev/zero of=${TMP}/test.img bs=1024 count=262144 >/dev/null 2>&1 - if [ $? -ne 0 ]; then - echo "Failed to create loopback device image, please check disk space and re-run" - return 1 - else - ##search for an unused loop dev - LOOP_DEV=$(losetup -f) - if [ $? -ne 0 ]; then - echo "no unused loop device is found" - return 1 - else - ##attach the created file to loop dev. - losetup $LOOP_DEV ${TMP}/test.img - if [ $? -ne 0 ]; then - echo "losetup failed to create block device" - return 1 - fi - DEVICE=$LOOP_DEV - return 0 - fi - fi -} - set_block_device() { - if [ -z "$DEVICE" ]; then - create_block - if [ $? -ne 0 ]; then - echo "no block device was specified on commandline." - echo "Block device could not be created using loopback device" - echo "Tests which require block device are disabled." - echo "You can specify it with option -b" - else - export LTP_DEV=$DEVICE - fi - else + if [ -n "$DEVICE" ]; then export LTP_DEV=$DEVICE fi } |