X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=tests%2Futils%2Futils.sh;h=6c87f309df9efdbb6ac66437fab9727e89d1e358;hb=90a8a0f23a364a3e1e3b7702c57b9c22473500a3;hp=04b45203a69b411047fef6af868c40144da8623b;hpb=e8cafc6e00a1de000a844a63091b42a0447cb21c;p=babeltrace.git diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index 04b45203..6c87f309 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -134,6 +134,12 @@ export BT_TESTS_SED_BIN BT_TESTS_DATADIR="${BT_TESTS_SRCDIR}/data" BT_CTF_TRACES_PATH="${BT_TESTS_DATADIR}/ctf-traces" +# Remove CR characters in file "$1". + +bt_remove_cr() { + "$BT_TESTS_SED_BIN" -i 's/\r//g' "$1" +} + # Run the Babeltrace CLI, redirecting stdout and stderr to specified files. # # $1: file to redirect stdout to @@ -173,7 +179,7 @@ bt_diff() { # Strip any \r present due to Windows (\n -> \r\n). # "diff --string-trailing-cr" is not used since it is not present on # Solaris. - "$BT_TESTS_SED_BIN" -i 's/\r//g' "$actual_file" + bt_remove_cr "$actual_file" diff -u "$expected_file" "$actual_file" 1>&2 @@ -241,7 +247,8 @@ bt_diff_details_ctf_single() { expected_stderr_file="/dev/null" # Compare using the CLI with `sink.text.details` - bt_diff_cli "$expected_stdout_file" "$expected_stderr_file" "$trace_dir" "-c" "sink.text.details" "${extra_details_args[@]}" + bt_diff_cli "$expected_stdout_file" "$expected_stderr_file" "$trace_dir" \ + "-c" "sink.text.details" "${extra_details_args[@]+${extra_details_args[@]}}" } # Calls bt_diff_details_ctf_single(), except that "$1" is the path to a @@ -267,7 +274,8 @@ bt_diff_details_ctf_gen_single() { fi # Compare using the CLI with `sink.text.details` - bt_diff_details_ctf_single "$expected_stdout_file" "$temp_trace_dir" "${extra_details_args[@]}" + bt_diff_details_ctf_single "$expected_stdout_file" "$temp_trace_dir" \ + "${extra_details_args[@]+${extra_details_args[@]}}" ret=$? rm -rf "$temp_trace_dir" return $ret