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 <jonathan.rajotte-julien@efficios.com>
Change-Id: I107c5487bf3aa0f5cbd1fdfd1e948ee93f830d2f
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1521
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
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