From dc5c6472de97d256ef93359964f24ef2bf3ea034 Mon Sep 17 00:00:00 2001 From: Jonathan Rajotte Date: Wed, 19 Jun 2019 13:27:34 -0400 Subject: [PATCH] tests: remove carriage return when using diff Carriage return are a problem when running tests on cross execution platform such as Windows. This only happen when diffing text generated on Windows and text from a linux file. The removal of mid-sentence '\r' is not a problem here since we do not expect bt to generate this kind of string. Signed-off-by: Jonathan Rajotte Change-Id: I107c5487bf3aa0f5cbd1fdfd1e948ee93f830d2f Reviewed-on: https://review.lttng.org/c/babeltrace/+/1521 Reviewed-by: Philippe Proulx Tested-by: jenkins --- tests/utils/diff.sh.in | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/utils/diff.sh.in b/tests/utils/diff.sh.in index 57f88e18..7a38c7a4 100644 --- a/tests/utils/diff.sh.in +++ b/tests/utils/diff.sh.in @@ -32,8 +32,10 @@ bt_diff_cli() { temp_output_file="$(mktemp)" temp_diff="$(mktemp)" - # Run the CLI to get a detailed file - echo "$args" | xargs "$BT_BIN" 2>/dev/null >"$temp_output_file" + # Run the CLI to get a detailed file. Strip any \r present due to + # Windows (\n -> \r\n). "diff --string-trailing-cr" is not used since it + # is not present on Solaris. + echo "$args" | xargs "$BT_BIN" 2>/dev/null | tr -d "\r" > "$temp_output_file" # Compare output with expected output if ! diff "$temp_output_file" "$expected_file" 2>/dev/null >"$temp_diff"; then -- 2.34.1