1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

tests: Fix common_dev_ argument handling

from[:[len]] arguments with missing colon assigned from to len, instead
of till_the_end_of_device.
This commit is contained in:
Marian Csontos 2017-11-28 12:03:35 +01:00
parent a9812ec9d3
commit b8caca4652

View File

@ -912,6 +912,10 @@ common_dev_() {
for fromlen in "${@-0:}"; do
from=${fromlen%%:*}
len=${fromlen##*:}
if test "$len" = "$fromlen"; then
# Missing the colon at the end: empty len
len=
fi
test -n "$len" || len=$(( size - from ))
diff=$(( from - pos ))
if test $diff -gt 0 ; then
@ -937,7 +941,7 @@ common_dev_() {
# Replace linear PV device with its 'delayed' version
# Could be used to more deterministicaly hit some problems.
# Parameters: {device path} [read delay ms] [write delay ms] [offset:size]...
# Parameters: {device path} [read delay ms] [write delay ms] [offset[:[size]]]...
# Original device is restored when both delay params are 0 (or missing).
# If the size is missing, the remaing portion of device is taken
# i.e. delay_dev "$dev1" 0 200 256: