tests: lua_core: use herewords for single-line programs
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: John Kennedy <john.kennedy@delphix.com> Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #13259
This commit is contained in:
parent
598fed7ecd
commit
b1b5843ae4
|
@ -38,8 +38,6 @@ log_must_program $TESTPOOL $ZCP_ROOT/lua_core/tst.exists.zcp \
|
||||||
$TESTPOOL/$TESTCLONE
|
$TESTPOOL/$TESTCLONE
|
||||||
|
|
||||||
log_mustnot_checkerror_program "not in the target pool" \
|
log_mustnot_checkerror_program "not in the target pool" \
|
||||||
$TESTPOOL - <<-EOF
|
$TESTPOOL - <<<"return zfs.exists('rpool')"
|
||||||
return zfs.exists('rpool')
|
|
||||||
EOF
|
|
||||||
|
|
||||||
log_pass "zfs.exists() gives correct results"
|
log_pass "zfs.exists() gives correct results"
|
||||||
|
|
|
@ -32,9 +32,7 @@ set -A args "1.0" \
|
||||||
|
|
||||||
typeset -i i=0
|
typeset -i i=0
|
||||||
while (( i < ${#args[*]} )); do
|
while (( i < ${#args[*]} )); do
|
||||||
log_mustnot_checkerror_program "malformed number" $TESTPOOL - <<-EOF
|
log_mustnot_checkerror_program "malformed number" $TESTPOOL - <<<"return ${args[i]}"
|
||||||
return ${args[i]}
|
|
||||||
EOF
|
|
||||||
((i = i + 1))
|
((i = i + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,6 @@ verify_runnable "global"
|
||||||
|
|
||||||
log_assert "overflowing a 64-bit integer should wrap around"
|
log_assert "overflowing a 64-bit integer should wrap around"
|
||||||
|
|
||||||
log_must_program $TESTPOOL - <<-EOF
|
log_must_program $TESTPOOL - <<<"assert(18446744073709551615 + 1 == (-18446744073709551616))"
|
||||||
assert(18446744073709551615 + 1 == (-18446744073709551616))
|
|
||||||
EOF
|
|
||||||
|
|
||||||
log_pass "overflowing a 64-bit integer should wrap around"
|
log_pass "overflowing a 64-bit integer should wrap around"
|
||||||
|
|
|
@ -43,9 +43,7 @@ log_assert "Runtime errors in lua scripts fail as expected."
|
||||||
|
|
||||||
typeset -i i=0
|
typeset -i i=0
|
||||||
while (( i < ${#args[*]} )); do
|
while (( i < ${#args[*]} )); do
|
||||||
log_mustnot_checkerror_program "execution failed" $TESTPOOL - <<-EOF
|
log_mustnot_checkerror_program "execution failed" $TESTPOOL - <<<"${args[i]}"
|
||||||
${args[i]}
|
|
||||||
EOF
|
|
||||||
((i = i + 1))
|
((i = i + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -33,9 +33,7 @@ log_assert "Simple lua scripts pass."
|
||||||
|
|
||||||
typeset -i i=0
|
typeset -i i=0
|
||||||
while (( i < ${#args[*]} )); do
|
while (( i < ${#args[*]} )); do
|
||||||
log_must_program $TESTPOOL - <<-EOF
|
log_must_program $TESTPOOL - <<<"${args[i]}"
|
||||||
${args[i]}
|
|
||||||
EOF
|
|
||||||
((i = i + 1))
|
((i = i + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,7 @@ log_must zfs create $fs
|
||||||
output_lines=$(log_must zfs program $TESTPOOL \
|
output_lines=$(log_must zfs program $TESTPOOL \
|
||||||
$ZCP_ROOT/lua_core/tst.return_large.zcp | wc -l)
|
$ZCP_ROOT/lua_core/tst.return_large.zcp | wc -l)
|
||||||
|
|
||||||
[[ $output_lines -lt 5000 ]] &&
|
log_must [ $output_lines -ge 5000 ]
|
||||||
log_fail "Expected return of full list but only got $output_lines lines"
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Make sure we fail if the return is over the memory limit
|
# Make sure we fail if the return is over the memory limit
|
||||||
|
|
|
@ -45,17 +45,13 @@ set -A args 'function() return 1 end' \
|
||||||
typeset -i last_index=$((${#args[*]} - 1))
|
typeset -i last_index=$((${#args[*]} - 1))
|
||||||
for i in $(seq 0 $last_index); do
|
for i in $(seq 0 $last_index); do
|
||||||
log_note "running program: ${args[i]}"
|
log_note "running program: ${args[i]}"
|
||||||
log_mustnot_checkerror_program "execution failed" $TESTPOOL - <<-EOF
|
log_mustnot_checkerror_program "execution failed" $TESTPOOL - <<<"return ${args[i]}"
|
||||||
return ${args[i]}
|
|
||||||
EOF
|
|
||||||
((i = i + 1))
|
((i = i + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
for i in $(seq 0 $last_index); do
|
for i in $(seq 0 $last_index); do
|
||||||
log_note "running program: ${args[i]}"
|
log_note "running program: ${args[i]}"
|
||||||
log_mustnot_checkerror_program "execution failed" $TESTPOOL - <<-EOF
|
log_mustnot_checkerror_program "execution failed" $TESTPOOL - <<<"error(${args[i]})"
|
||||||
error(${args[i]})
|
|
||||||
EOF
|
|
||||||
((i = i + 1))
|
((i = i + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -39,18 +39,14 @@ log_assert "Returning valid lua constructs works."
|
||||||
typeset -i i=0
|
typeset -i i=0
|
||||||
while (( i < ${#args[*]} )); do
|
while (( i < ${#args[*]} )); do
|
||||||
log_note "running program: return ${args[i]}"
|
log_note "running program: return ${args[i]}"
|
||||||
log_must_program $TESTPOOL - <<-EOF
|
log_must_program $TESTPOOL - <<<"return ${args[i]}"
|
||||||
return ${args[i]}
|
|
||||||
EOF
|
|
||||||
((i = i + 1))
|
((i = i + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
typeset -i i=0
|
typeset -i i=0
|
||||||
while (( i < ${#args[*]} )); do
|
while (( i < ${#args[*]} )); do
|
||||||
log_note "running program: error(${args[i]})"
|
log_note "running program: error(${args[i]})"
|
||||||
log_mustnot_checkerror_program "in function 'error'" $TESTPOOL - <<-EOF
|
log_mustnot_checkerror_program "in function 'error'" $TESTPOOL - <<<"error(${args[i]})"
|
||||||
error(${args[i]})
|
|
||||||
EOF
|
|
||||||
((i = i + 1))
|
((i = i + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue