1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

tests: support zero_dev

When the test would need to try to write some large amount of data
we can give it 'zero' segments - for obvious reason such written data
can't be verified but in some test cases it doesn't really matter.

Usage follows  'error_dev' style.

For now test suite is not supporting any combination of
error/delay/zero segments so only 1 type could be used per PV.
This commit is contained in:
Zdenek Kabelac 2017-02-22 15:16:20 +01:00
parent f44e69f9fc
commit aa72caca5a

View File

@ -866,7 +866,7 @@ common_dev_() {
else else
test -z "${offsets[@]}" && offsets="0:" test -z "${offsets[@]}" && offsets="0:"
fi ;; fi ;;
error) offsets=${@:3} error|zero) offsets=${@:3}
test -z "${offsets[@]}" && offsets="0:" ;; test -z "${offsets[@]}" && offsets="0:" ;;
esac esac
@ -893,8 +893,8 @@ common_dev_() {
case "$tgtype" in case "$tgtype" in
delay) delay)
echo "$from $len delay $pvdev $(($pos + $offset)) $read_ms $pvdev $(($pos + $offset)) $write_ms" ;; echo "$from $len delay $pvdev $(($pos + $offset)) $read_ms $pvdev $(($pos + $offset)) $write_ms" ;;
error) error|zero)
echo "$from $len error" ;; echo "$from $len $tgtype" ;;
esac esac
pos=$(($pos + $len)) pos=$(($pos + $len))
done > "$name.devtable" done > "$name.devtable"
@ -1013,12 +1013,23 @@ restore_from_devtable() {
# #
# Convert device to device with errors # Convert device to device with errors
# Takes the list of pairs of error segment from:len # Takes the list of pairs of error segment from:len
# Original device table is replace with multiple lines # Combination with zero or delay is unsupported
# Original device table is replaced with multiple lines
# i.e. error_dev "$dev1" 8:32 96:8 # i.e. error_dev "$dev1" 8:32 96:8
error_dev() { error_dev() {
common_dev_ error "$@" common_dev_ error "$@"
} }
#
# Convert existing device to a device with zero segments
# Takes the list of pairs of zero segment from:len
# Combination with error or delay is unsupported
# Original device table is replaced with multiple lines
# i.e. zero_dev "$dev1" 8:32 96:8
zero_dev() {
common_dev_ zero "$@"
}
backup_dev() { backup_dev() {
local dev local dev