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
|
||||
|
||||
log_mustnot_checkerror_program "not in the target pool" \
|
||||
$TESTPOOL - <<-EOF
|
||||
return zfs.exists('rpool')
|
||||
EOF
|
||||
$TESTPOOL - <<<"return zfs.exists('rpool')"
|
||||
|
||||
log_pass "zfs.exists() gives correct results"
|
||||
|
|
|
@ -32,9 +32,7 @@ set -A args "1.0" \
|
|||
|
||||
typeset -i i=0
|
||||
while (( i < ${#args[*]} )); do
|
||||
log_mustnot_checkerror_program "malformed number" $TESTPOOL - <<-EOF
|
||||
return ${args[i]}
|
||||
EOF
|
||||
log_mustnot_checkerror_program "malformed number" $TESTPOOL - <<<"return ${args[i]}"
|
||||
((i = i + 1))
|
||||
done
|
||||
|
||||
|
|
|
@ -25,8 +25,6 @@ verify_runnable "global"
|
|||
|
||||
log_assert "overflowing a 64-bit integer should wrap around"
|
||||
|
||||
log_must_program $TESTPOOL - <<-EOF
|
||||
assert(18446744073709551615 + 1 == (-18446744073709551616))
|
||||
EOF
|
||||
log_must_program $TESTPOOL - <<<"assert(18446744073709551615 + 1 == (-18446744073709551616))"
|
||||
|
||||
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
|
||||
while (( i < ${#args[*]} )); do
|
||||
log_mustnot_checkerror_program "execution failed" $TESTPOOL - <<-EOF
|
||||
${args[i]}
|
||||
EOF
|
||||
log_mustnot_checkerror_program "execution failed" $TESTPOOL - <<<"${args[i]}"
|
||||
((i = i + 1))
|
||||
done
|
||||
|
||||
|
|
|
@ -33,9 +33,7 @@ log_assert "Simple lua scripts pass."
|
|||
|
||||
typeset -i i=0
|
||||
while (( i < ${#args[*]} )); do
|
||||
log_must_program $TESTPOOL - <<-EOF
|
||||
${args[i]}
|
||||
EOF
|
||||
log_must_program $TESTPOOL - <<<"${args[i]}"
|
||||
((i = i + 1))
|
||||
done
|
||||
|
||||
|
|
|
@ -41,8 +41,7 @@ log_must zfs create $fs
|
|||
output_lines=$(log_must zfs program $TESTPOOL \
|
||||
$ZCP_ROOT/lua_core/tst.return_large.zcp | wc -l)
|
||||
|
||||
[[ $output_lines -lt 5000 ]] &&
|
||||
log_fail "Expected return of full list but only got $output_lines lines"
|
||||
log_must [ $output_lines -ge 5000 ]
|
||||
|
||||
#
|
||||
# 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))
|
||||
for i in $(seq 0 $last_index); do
|
||||
log_note "running program: ${args[i]}"
|
||||
log_mustnot_checkerror_program "execution failed" $TESTPOOL - <<-EOF
|
||||
return ${args[i]}
|
||||
EOF
|
||||
log_mustnot_checkerror_program "execution failed" $TESTPOOL - <<<"return ${args[i]}"
|
||||
((i = i + 1))
|
||||
done
|
||||
|
||||
for i in $(seq 0 $last_index); do
|
||||
log_note "running program: ${args[i]}"
|
||||
log_mustnot_checkerror_program "execution failed" $TESTPOOL - <<-EOF
|
||||
error(${args[i]})
|
||||
EOF
|
||||
log_mustnot_checkerror_program "execution failed" $TESTPOOL - <<<"error(${args[i]})"
|
||||
((i = i + 1))
|
||||
done
|
||||
|
||||
|
|
|
@ -39,18 +39,14 @@ log_assert "Returning valid lua constructs works."
|
|||
typeset -i i=0
|
||||
while (( i < ${#args[*]} )); do
|
||||
log_note "running program: return ${args[i]}"
|
||||
log_must_program $TESTPOOL - <<-EOF
|
||||
return ${args[i]}
|
||||
EOF
|
||||
log_must_program $TESTPOOL - <<<"return ${args[i]}"
|
||||
((i = i + 1))
|
||||
done
|
||||
|
||||
typeset -i i=0
|
||||
while (( i < ${#args[*]} )); do
|
||||
log_note "running program: error(${args[i]})"
|
||||
log_mustnot_checkerror_program "in function 'error'" $TESTPOOL - <<-EOF
|
||||
error(${args[i]})
|
||||
EOF
|
||||
log_mustnot_checkerror_program "in function 'error'" $TESTPOOL - <<<"error(${args[i]})"
|
||||
((i = i + 1))
|
||||
done
|
||||
|
||||
|
|
Loading…
Reference in New Issue