From ffa209addac22ab2fddcd18f42bafaa0410068e4 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Tue, 2 Aug 2022 15:36:44 -0400 Subject: [PATCH] tests: fix shellcheck errors in plugins/sink.text.pretty/test_enum Fix: In test_enum line 22: temp_stderr_expected="/dev/null" ^------------------^ SC2034 (warning): temp_stderr_expected appears unused. Verify use (or export if used externally). In test_enum line 40: "$(cat $expected_file)" "$(cat $actual_file)" ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: "$(cat "$expected_file")" "$(cat "$actual_file")" In test_enum line 49: local test_text= ^-------^ SC2034 (warning): test_text appears unused. Verify use (or export if used externally). In test_enum line 80: if (($expected_to_fail)); then ^---------------^ SC2004 (style): $/${} is unnecessary on arithmetic variables. Change-Id: I1956a395dd8638b5e7ee9d4a91301243a6ad76ee Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/8636 Reviewed-by: Michael Jeanson --- tests/plugins/sink.text.pretty/test_enum | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/plugins/sink.text.pretty/test_enum b/tests/plugins/sink.text.pretty/test_enum index 723448b7..1d6b723d 100755 --- a/tests/plugins/sink.text.pretty/test_enum +++ b/tests/plugins/sink.text.pretty/test_enum @@ -19,7 +19,6 @@ source "$UTILSSH" data_dir="$BT_TESTS_DATADIR/plugins/sink.text.pretty" temp_stdout_expected_file=$(mktemp -t test_pretty_expected_stdout.XXXXXX) -temp_stderr_expected="/dev/null" plan_tests 31 @@ -37,7 +36,7 @@ function compare_enum_sorted # since Python 3.7). run_python_bt2 "${BT_TESTS_PYTHON_BIN}" "${BT_TESTS_SRCDIR}/utils/python/split_sort_compare.py" \ - "$(cat $expected_file)" "$(cat $actual_file)" + "$(cat "$expected_file")" "$(cat "$actual_file")" } function run_test @@ -46,7 +45,6 @@ function run_test local expected_to_fail="$2" local value="$3" local expected_stdout_file="$4" - local test_text= local actual_stdout_file local actual_stderr_file local ret=0 @@ -77,7 +75,7 @@ function run_test rm -f "$actual_stdout_file" "$actual_stderr_file" - if (($expected_to_fail)); then + if [ "$expected_to_fail" = "1" ]; then isnt $ret 0 "$test_name signed=$enum_signed with value=$value doesn't match as expected" else ok $ret "$test_name signed=$enum_signed with value=$value matches" @@ -266,6 +264,4 @@ test_normal_enum_negative test_bit_flag_enum test_mixed_enum -# Do not `rm` $temp_stderr_expected because it's set to `/dev/null` right now -# and that would print an error. rm -f "$temp_stdout_expected_file" -- 2.34.1