tests: silence "variable/expression in single quote" shellcheck warnings
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 20 Nov 2019 16:20:29 +0000 (11:20 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 26 Nov 2019 19:24:17 +0000 (14:24 -0500)
shellcheck complains that we use a variable in single quotes:

    In test_trace_copy line 63:
                    uniq_ts_cnt="$("${BT_TESTS_AWK_BIN}" '{ print $1 }' < "${text_output1}" | sort | uniq | wc -l)"
                                                         ^------------^ SC2016: Expressions don't expand in single quotes, use double quotes for that.

In other cases, it's because of backticks (`) in a single quote string.

Silence these warnings locally by putting the appropriate comment:

    # shellcheck disable=SC2016

Reported-by: shellcheck
Change-Id: Ib2cfa73f84ba8746d3793e49721ead171c24dd99
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2418
Tested-by: jenkins <jenkins@lttng.org>
tests/cli/convert/test_auto_source_discovery_grouping
tests/cli/test_trace_copy

index 53b932a4034fc82aa2d32af24663a91b255b72b9..8378e625a70ffa8068978efb6e4872fa5d680fe9 100755 (executable)
@@ -58,6 +58,7 @@ bt_diff "$stdout_expected_file" "$stdout_actual_file"
 ok "$?" "expected components are instantiated with expected inputs"
 
 # Check that expected warning is printed.
+# shellcheck disable=SC2016
 grep -q 'No trace was found based on input `some_other_non_opt`' "$stderr_actual_file"
 ok "$?" "warning is printed"
 
index 5f902e17848d088a5f392d3ef9e16d170e11c3df..5147e8eccff7a5dae5aee3b50d5f030ebf92dac5 100755 (executable)
@@ -60,6 +60,7 @@ for path in "${SUCCESS_TRACES[@]}"; do
        # always the same.
        head -1 "${text_output1}" | "${BT_TESTS_GREP_BIN}" "^\[" >/dev/null
        if test $? = 0; then
+               # shellcheck disable=SC2016
                uniq_ts_cnt="$("${BT_TESTS_AWK_BIN}" '{ print $1 }' < "${text_output1}" | sort | uniq | wc -l)"
                # Extract only the timestamp columns and compare the number of
                # unique lines with the total number of lines to see if there
This page took 0.025941 seconds and 4 git commands to generate.