fix: test_trimmer on macOs and Solaris
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Mon, 8 Jul 2019 19:47:21 +0000 (15:47 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Tue, 9 Jul 2019 16:28:29 +0000 (12:28 -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: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Change-Id: I884f59cf1fcdcb33419dd02c69886715ce4db71b
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1654
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
tests/cli/test_trimmer

index a3246b2cbeb5436e975ce480e01f2e7ea77c5943..9ef8980c812dd075c1b31778da22f0ebf8990989 100755 (executable)
@@ -80,7 +80,8 @@ function expect_failure()
        isnt $? 0 "trimmer: ${msg}: exit status"
 
        num_events=$(wc -l < "${tmp_out}")
-       is "${num_events}" 0 "trimmer: ${msg}: number of events (0)"
+       # Use bash parameter expansion to strip spaces added by BSD 'wc' on macOs and Solaris
+       is "${num_events// /}" 0 "trimmer: ${msg}: number of events (0)"
 
        stderr="$(cat "${tmp_err}")"
        # "like" doesn't like when the passed text is empty.
This page took 0.025252 seconds and 4 git commands to generate.