From: Simon Marchi Date: Thu, 3 Oct 2024 15:20:21 +0000 (-0400) Subject: tests/cli/test-intersection.sh: rewrite test to avoid shellcheck warning X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=d0d7a6c0f585deb7e1a046309f58ac091a5a0789;p=babeltrace.git tests/cli/test-intersection.sh: rewrite test to avoid shellcheck warning Shellcheck 0.10.0 shows: $ shellcheck -x test-intersection.sh In test-intersection.sh line 36: ok $? "$totalevents events in the whole trace" ^-- SC2319 (warning): This $? refers to a condition, not a command. Assign to a variable to avoid it being overwritten. For more information: https://www.shellcheck.net/wiki/SC2319 -- This $? refers to a condition, no... I think that Shellcheck is confused with what we're trying to do and that the code is actually correct. Nevertheless, change the code to circumvent this by using `is`, which looks nicer anyway. This is not seen on the CI, since it currently runs Shellcheck 0.9.0. Change-Id: I7bb861b478046ab327c5950c9deefa52953bc854 Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/13316 Reviewed-by: Philippe Proulx --- diff --git a/tests/cli/test-intersection.sh b/tests/cli/test-intersection.sh index ff1193dc..13e3b71a 100755 --- a/tests/cli/test-intersection.sh +++ b/tests/cli/test-intersection.sh @@ -32,15 +32,13 @@ test_intersect() { ok $? "run without --stream-intersection" cnt=$(wc -l < "${stdout}") - test "${cnt// /}" = "$totalevents" - ok $? "$totalevents events in the whole trace" + is "${cnt// /}" "$totalevents" "$totalevents events in the whole trace" bt_cli "${stdout}" "/dev/null" --stream-intersection "${trace}" ok $? "run with --stream-intersection" cnt=$(wc -l < "${stdout}") - test "${cnt// /}" = "$intersect" - ok $? "$intersect events in streams intersecting" + is "${cnt// /}" "$intersect" "$intersect events in streams intersecting" } test_intersect_fails() {