fix: test_trimmer on macOs and Solaris
authorMichael Jeanson <mjeanson@efficios.com>
Mon, 17 Jun 2019 16:10:34 +0000 (12:10 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 20 Jun 2019 18:49:17 +0000 (14:49 -0400)
The 'wc' tool on BSD based system adds leading spaces to it's output,
which breaks the quoted compare. Use bash parameter expansion to trim all
spaces from the 'num_events' variable.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I15aef8c6987e40bcb018f32c7c094eabbc3d83c3
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1476
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
tests/cli/test_trimmer.in

index 6918cdad10c33b32cee8c2482a8c29b2f8ab2dbc..8c853aeaa0a7a12f5f089aec45d355a54eabb227 100644 (file)
@@ -44,7 +44,8 @@ function expect_success()
        "${BT_BIN}" "${TRACE_PATH}" "$@" 2>/dev/null > "${tmp_out}"
        ok $? "trimmer: ${msg}: exit status"
        num_events=$(wc -l < "${tmp_out}")
-       is "${num_events}" "${expected_num_events}" "trimmer: ${msg}: number of events (${expected_num_events})"
+       # Use bash parameter expansion to strip spaces added by BSD 'wc' on macOs and Solaris
+       is "${num_events// /}" "${expected_num_events}" "trimmer: ${msg}: number of events (${expected_num_events})"
 }
 
 expect_success 18 "--begin, GMT relative timestamps" \
This page took 0.024358 seconds and 4 git commands to generate.