From 4656d91f23f6d9bdfcbf1cfed580c75d6b31e84c Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Wed, 20 Nov 2019 11:20:29 -0500 Subject: [PATCH] tests: silence "variable/expression in single quote" shellcheck warnings 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 Reviewed-on: https://review.lttng.org/c/babeltrace/+/2418 Tested-by: jenkins --- tests/cli/convert/test_auto_source_discovery_grouping | 1 + tests/cli/test_trace_copy | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/cli/convert/test_auto_source_discovery_grouping b/tests/cli/convert/test_auto_source_discovery_grouping index 53b932a4..8378e625 100755 --- a/tests/cli/convert/test_auto_source_discovery_grouping +++ b/tests/cli/convert/test_auto_source_discovery_grouping @@ -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" diff --git a/tests/cli/test_trace_copy b/tests/cli/test_trace_copy index 5f902e17..5147e8ec 100755 --- a/tests/cli/test_trace_copy +++ b/tests/cli/test_trace_copy @@ -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 -- 2.34.1