Skip to content

Commit 609282f

Browse files
nabijaczleweliandrewc12
authored andcommitted
tests: lua_core: use herewords for single-line programs
Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: John Kennedy <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes openzfs#13259
1 parent cfa30a4 commit 609282f

File tree

8 files changed

+10
-29
lines changed

8 files changed

+10
-29
lines changed

tests/zfs-tests/tests/functional/channel_program/lua_core/tst.exists.ksh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ log_must_program $TESTPOOL $ZCP_ROOT/lua_core/tst.exists.zcp \
3838
$TESTPOOL/$TESTCLONE
3939

4040
log_mustnot_checkerror_program "not in the target pool" \
41-
$TESTPOOL - <<-EOF
42-
return zfs.exists('rpool')
43-
EOF
41+
$TESTPOOL - <<<"return zfs.exists('rpool')"
4442

4543
log_pass "zfs.exists() gives correct results"

tests/zfs-tests/tests/functional/channel_program/lua_core/tst.integer_illegal.ksh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ set -A args "1.0" \
3232

3333
typeset -i i=0
3434
while (( i < ${#args[*]} )); do
35-
log_mustnot_checkerror_program "malformed number" $TESTPOOL - <<-EOF
36-
return ${args[i]}
37-
EOF
35+
log_mustnot_checkerror_program "malformed number" $TESTPOOL - <<<"return ${args[i]}"
3836
((i = i + 1))
3937
done
4038

tests/zfs-tests/tests/functional/channel_program/lua_core/tst.integer_overflow.ksh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ verify_runnable "global"
2525

2626
log_assert "overflowing a 64-bit integer should wrap around"
2727

28-
log_must_program $TESTPOOL - <<-EOF
29-
assert(18446744073709551615 + 1 == (-18446744073709551616))
30-
EOF
28+
log_must_program $TESTPOOL - <<<"assert(18446744073709551615 + 1 == (-18446744073709551616))"
3129

3230
log_pass "overflowing a 64-bit integer should wrap around"

tests/zfs-tests/tests/functional/channel_program/lua_core/tst.language_functions_neg.ksh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ log_assert "Runtime errors in lua scripts fail as expected."
4343

4444
typeset -i i=0
4545
while (( i < ${#args[*]} )); do
46-
log_mustnot_checkerror_program "execution failed" $TESTPOOL - <<-EOF
47-
${args[i]}
48-
EOF
46+
log_mustnot_checkerror_program "execution failed" $TESTPOOL - <<<"${args[i]}"
4947
((i = i + 1))
5048
done
5149

tests/zfs-tests/tests/functional/channel_program/lua_core/tst.language_functions_pos.ksh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ log_assert "Simple lua scripts pass."
3333

3434
typeset -i i=0
3535
while (( i < ${#args[*]} )); do
36-
log_must_program $TESTPOOL - <<-EOF
37-
${args[i]}
38-
EOF
36+
log_must_program $TESTPOOL - <<<"${args[i]}"
3937
((i = i + 1))
4038
done
4139

tests/zfs-tests/tests/functional/channel_program/lua_core/tst.return_large.ksh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ log_must zfs create $fs
4141
output_lines=$(log_must zfs program $TESTPOOL \
4242
$ZCP_ROOT/lua_core/tst.return_large.zcp | wc -l)
4343

44-
[[ $output_lines -lt 5000 ]] &&
45-
log_fail "Expected return of full list but only got $output_lines lines"
44+
log_must [ $output_lines -ge 5000 ]
4645

4746
#
4847
# Make sure we fail if the return is over the memory limit

tests/zfs-tests/tests/functional/channel_program/lua_core/tst.return_nvlist_neg.ksh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,13 @@ set -A args 'function() return 1 end' \
4545
typeset -i last_index=$((${#args[*]} - 1))
4646
for i in $(seq 0 $last_index); do
4747
log_note "running program: ${args[i]}"
48-
log_mustnot_checkerror_program "execution failed" $TESTPOOL - <<-EOF
49-
return ${args[i]}
50-
EOF
48+
log_mustnot_checkerror_program "execution failed" $TESTPOOL - <<<"return ${args[i]}"
5149
((i = i + 1))
5250
done
5351

5452
for i in $(seq 0 $last_index); do
5553
log_note "running program: ${args[i]}"
56-
log_mustnot_checkerror_program "execution failed" $TESTPOOL - <<-EOF
57-
error(${args[i]})
58-
EOF
54+
log_mustnot_checkerror_program "execution failed" $TESTPOOL - <<<"error(${args[i]})"
5955
((i = i + 1))
6056
done
6157

tests/zfs-tests/tests/functional/channel_program/lua_core/tst.return_nvlist_pos.ksh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,14 @@ log_assert "Returning valid lua constructs works."
3939
typeset -i i=0
4040
while (( i < ${#args[*]} )); do
4141
log_note "running program: return ${args[i]}"
42-
log_must_program $TESTPOOL - <<-EOF
43-
return ${args[i]}
44-
EOF
42+
log_must_program $TESTPOOL - <<<"return ${args[i]}"
4543
((i = i + 1))
4644
done
4745

4846
typeset -i i=0
4947
while (( i < ${#args[*]} )); do
5048
log_note "running program: error(${args[i]})"
51-
log_mustnot_checkerror_program "in function 'error'" $TESTPOOL - <<-EOF
52-
error(${args[i]})
53-
EOF
49+
log_mustnot_checkerror_program "in function 'error'" $TESTPOOL - <<<"error(${args[i]})"
5450
((i = i + 1))
5551
done
5652

0 commit comments

Comments
 (0)