mirror of
https://git.proxmox.com/git/mirror_zfs
synced 2025-04-29 15:20:28 +00:00
ZTS: Fix zpool dry run
tests depending on output format
Signed-off-by: Attila Fülöp <attila@fueloep.org>
This commit is contained in:
parent
047803e906
commit
029c4ae03a
@ -155,9 +155,11 @@ for (( i=0; i < ${#tests[@]}; i+=1 )); do
|
|||||||
|
|
||||||
log_must eval zpool create "$TESTPOOL" $tree
|
log_must eval zpool create "$TESTPOOL" $tree
|
||||||
log_must poolexists "$TESTPOOL"
|
log_must poolexists "$TESTPOOL"
|
||||||
typeset out="$(log_must eval "zpool add -n '$TESTPOOL' $add" | \
|
typeset out
|
||||||
sed /^SUCCESS/d)"
|
out="$(eval zpool add -n '$TESTPOOL' $add)"
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
log_fail eval "zpool add -n '$TESTPOOL' $add"
|
||||||
|
fi
|
||||||
if [[ "$out" != "$want" ]]; then
|
if [[ "$out" != "$want" ]]; then
|
||||||
log_fail "Got:\n" "$out" "\nbut expected:\n" "$want"
|
log_fail "Got:\n" "$out" "\nbut expected:\n" "$want"
|
||||||
fi
|
fi
|
||||||
@ -170,7 +172,11 @@ log_must eval "zpool create '$TESTPOOL' '${dev[0]}' log '${dev[1]}' \
|
|||||||
|
|
||||||
# Create a hole vdev.
|
# Create a hole vdev.
|
||||||
log_must eval "zpool remove '$TESTPOOL' '${dev[1]}'"
|
log_must eval "zpool remove '$TESTPOOL' '${dev[1]}'"
|
||||||
log_mustnot eval "zpool add -n '$TESTPOOL' '${dev[1]}' | \
|
typeset out
|
||||||
grep -qE '[[:space:]]+hole'"
|
out="$(eval zpool add -n '$TESTPOOL' '${dev[1]}')"
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
log_fail eval "zpool add -n '$TESTPOOL' '${dev[1]}'"
|
||||||
|
fi
|
||||||
|
log_mustnot grep -qE '[[:space:]]+hole' <<<"$out"
|
||||||
|
|
||||||
log_pass "'zpool add -n <pool> <vdev> ...' displays config correctly."
|
log_pass "'zpool add -n <pool> <vdev> ...' displays config correctly."
|
||||||
|
@ -127,10 +127,11 @@ done
|
|||||||
for (( i=0; i < ${#tests[@]}; i+=1 )); do
|
for (( i=0; i < ${#tests[@]}; i+=1 )); do
|
||||||
tree="${tests[$i].tree}"
|
tree="${tests[$i].tree}"
|
||||||
want="${tests[$i].want}"
|
want="${tests[$i].want}"
|
||||||
|
typeset out
|
||||||
typeset out="$(log_must eval "zpool create -n '$TESTPOOL' $tree" | \
|
out="$(eval zpool create -n '$TESTPOOL' $tree)"
|
||||||
sed /^SUCCESS/d)"
|
if [[ $? -ne 0 ]]; then
|
||||||
|
log_fail eval "zpool create -n '$TESTPOOL' $tree"
|
||||||
|
fi
|
||||||
if [[ "$out" != "$want" ]]; then
|
if [[ "$out" != "$want" ]]; then
|
||||||
log_fail "Got:\n" "$out" "\nbut expected:\n" "$want"
|
log_fail "Got:\n" "$out" "\nbut expected:\n" "$want"
|
||||||
fi
|
fi
|
||||||
|
@ -140,9 +140,11 @@ for (( i=0; i < ${#tests[@]}; i+=1 )); do
|
|||||||
|
|
||||||
log_must eval zpool create "$TESTPOOL" $tree
|
log_must eval zpool create "$TESTPOOL" $tree
|
||||||
log_must poolexists "$TESTPOOL"
|
log_must poolexists "$TESTPOOL"
|
||||||
typeset out="$(log_must eval "zpool split -n \
|
typeset out
|
||||||
'$TESTPOOL' '$NEWPOOL' $devs" | sed /^SUCCESS/d)"
|
out="$(eval zpool split -n '$TESTPOOL' '$NEWPOOL' $devs)"
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
log_fail eval "zpool split -n '$TESTPOOL' '$NEWPOOL' $devs"
|
||||||
|
fi
|
||||||
if [[ "$out" != "$want" ]]; then
|
if [[ "$out" != "$want" ]]; then
|
||||||
log_fail "Got:\n" "$out" "\nbut expected:\n" "$want"
|
log_fail "Got:\n" "$out" "\nbut expected:\n" "$want"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user