From b1b5843ae4c8298a11791257d95b220ed8993b39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Wed, 23 Mar 2022 20:45:25 +0100 Subject: [PATCH] tests: lua_core: use herewords for single-line programs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Reviewed-by: John Kennedy Reviewed-by: Ryan Moeller Signed-off-by: Ahelenia ZiemiaƄska Closes #13259 --- .../functional/channel_program/lua_core/tst.exists.ksh | 4 +--- .../channel_program/lua_core/tst.integer_illegal.ksh | 4 +--- .../channel_program/lua_core/tst.integer_overflow.ksh | 4 +--- .../lua_core/tst.language_functions_neg.ksh | 4 +--- .../lua_core/tst.language_functions_pos.ksh | 4 +--- .../channel_program/lua_core/tst.return_large.ksh | 3 +-- .../channel_program/lua_core/tst.return_nvlist_neg.ksh | 8 ++------ .../channel_program/lua_core/tst.return_nvlist_pos.ksh | 8 ++------ 8 files changed, 10 insertions(+), 29 deletions(-) diff --git a/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.exists.ksh b/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.exists.ksh index eba01b17c8..34f29d9c03 100755 --- a/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.exists.ksh +++ b/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.exists.ksh @@ -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" diff --git a/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.integer_illegal.ksh b/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.integer_illegal.ksh index c34f2afd9e..1c70bc8592 100755 --- a/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.integer_illegal.ksh +++ b/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.integer_illegal.ksh @@ -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 diff --git a/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.integer_overflow.ksh b/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.integer_overflow.ksh index c129bae51b..be21297924 100755 --- a/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.integer_overflow.ksh +++ b/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.integer_overflow.ksh @@ -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" diff --git a/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.language_functions_neg.ksh b/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.language_functions_neg.ksh index 0125d76c70..3f91db2be9 100755 --- a/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.language_functions_neg.ksh +++ b/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.language_functions_neg.ksh @@ -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 diff --git a/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.language_functions_pos.ksh b/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.language_functions_pos.ksh index 924d8e2c69..019622cf84 100755 --- a/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.language_functions_pos.ksh +++ b/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.language_functions_pos.ksh @@ -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 diff --git a/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.return_large.ksh b/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.return_large.ksh index bbaeb54f59..ae42665cd9 100755 --- a/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.return_large.ksh +++ b/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.return_large.ksh @@ -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 diff --git a/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.return_nvlist_neg.ksh b/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.return_nvlist_neg.ksh index 10afa67278..a8d4dd31d8 100755 --- a/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.return_nvlist_neg.ksh +++ b/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.return_nvlist_neg.ksh @@ -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 diff --git a/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.return_nvlist_pos.ksh b/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.return_nvlist_pos.ksh index 8b4ef6e760..75ade2b45d 100755 --- a/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.return_nvlist_pos.ksh +++ b/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.return_nvlist_pos.ksh @@ -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