diff mbox series

[babeltrace] Port: don't quote wc output in test scripts

Message ID 1504117766-13198-1-git-send-email-mjeanson@efficios.com
State Accepted, archived
Headers show
Series [babeltrace] Port: don't quote wc output in test scripts | expand

Commit Message

Michael Jeanson Aug. 30, 2017, 6:29 p.m. UTC
The 'wc' command on macOS prefixes the count it returns with spaces, if
we quote the output it won't be properly converted to integer for the
comparison.

Signed-off-by: Michael Jeanson <mjeanson at efficios.com>
---
 tests/cli/intersection/test_intersection.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jérémie Galarneau Aug. 31, 2017, 8:54 p.m. UTC | #1
Merged, thanks!

Jérémie

On 30 August 2017 at 14:29, Michael Jeanson <mjeanson at efficios.com> wrote:
> The 'wc' command on macOS prefixes the count it returns with spaces, if
> we quote the output it won't be properly converted to integer for the
> comparison.
>
> Signed-off-by: Michael Jeanson <mjeanson at efficios.com>
> ---
>  tests/cli/intersection/test_intersection.in | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tests/cli/intersection/test_intersection.in b/tests/cli/intersection/test_intersection.in
> index 07a267f..7cea9be 100644
> --- a/tests/cli/intersection/test_intersection.in
> +++ b/tests/cli/intersection/test_intersection.in
> @@ -26,9 +26,9 @@ test_intersect() {
>         totalevents="$2"
>         intersect="$3"
>
> -       test "$("${BT_BIN}" "$trace" | wc -l)" = "$totalevents"
> +       test $("${BT_BIN}" "$trace" | wc -l) = "$totalevents"
>         ok $? "$totalevents events in the whole trace"
> -       test "$("${BT_BIN}" --stream-intersection "$trace" 2>/dev/null| wc -l)" = "$intersect"
> +       test $("${BT_BIN}" --stream-intersection "$trace" 2>/dev/null| wc -l) = "$intersect"
>         ok $? "$intersect events in packets intersecting"
>  }
>
> --
> 2.7.4
>
diff mbox series

Patch

diff --git a/tests/cli/intersection/test_intersection.in b/tests/cli/intersection/test_intersection.in
index 07a267f..7cea9be 100644
--- a/tests/cli/intersection/test_intersection.in
+++ b/tests/cli/intersection/test_intersection.in
@@ -26,9 +26,9 @@  test_intersect() {
 	totalevents="$2"
 	intersect="$3"
 
-	test "$("${BT_BIN}" "$trace" | wc -l)" = "$totalevents"
+	test $("${BT_BIN}" "$trace" | wc -l) = "$totalevents"
 	ok $? "$totalevents events in the whole trace"
-	test "$("${BT_BIN}" --stream-intersection "$trace" 2>/dev/null| wc -l)" = "$intersect"
+	test $("${BT_BIN}" --stream-intersection "$trace" 2>/dev/null| wc -l) = "$intersect"
 	ok $? "$intersect events in packets intersecting"
 }