tests: fix shellcheck errors in plugins/sink.text.pretty/test_enum
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 2 Aug 2022 19:36:44 +0000 (15:36 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Tue, 16 Aug 2022 19:50:31 +0000 (15:50 -0400)
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 <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8636
Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
tests/plugins/sink.text.pretty/test_enum

index 723448b72ea85768ed828866f5a7704892869c29..1d6b723de1c87eba14d60e1c4182ff5ff50c9fbd 100755 (executable)
@@ -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"
This page took 0.025189 seconds and 4 git commands to generate.