Fix: tests: use run_python in gen_mctf_trace
[babeltrace.git] / tests / utils / utils.sh
index 9f5adf5aef66bb6d0c9f15dedbdba6143c2bc2f5..da389f38b34068253113faa3b1f24ba83b97c9ca 100644 (file)
@@ -153,7 +153,7 @@ fi
 # Remove CR characters in file "$1".
 
 bt_remove_cr() {
-       "$BT_TESTS_SED_BIN" -i 's/\r//g' "$1"
+       "$BT_TESTS_SED_BIN" -i'' -e 's/\r//g' "$1"
 }
 
 # Run the Babeltrace CLI, redirecting stdout and stderr to specified files.
@@ -228,8 +228,8 @@ bt_diff_cli() {
        local ret_stdout
        local ret_stderr
 
-       temp_stdout_output_file="$(mktemp -t actual_stdout.XXXXXX)"
-       temp_stderr_output_file="$(mktemp -t actual_stderr.XXXXXX)"
+       temp_stdout_output_file="$(mktemp -t actual-stdout.XXXXXX)"
+       temp_stderr_output_file="$(mktemp -t actual-stderr.XXXXXX)"
 
        # Run the CLI to get a detailed file.
        bt_cli "$temp_stdout_output_file" "$temp_stderr_output_file" "${args[@]}"
@@ -409,3 +409,16 @@ run_python_bt2_test() {
 
        return $ret
 }
+
+# Generate a CTF trace using `mctf.py`.
+#
+# $1: Input filename
+# $2: Base directory path for output files
+gen_mctf_trace() {
+       local input_file="$1"
+       local base_dir="$2"
+
+       diag "Running: ${BT_TESTS_PYTHON_BIN} ${BT_TESTS_SRCDIR}/utils/python/mctf.py --base-dir ${base_dir} ${input_file}"
+       run_python "${BT_TESTS_PYTHON_BIN}" "${BT_TESTS_SRCDIR}/utils/python/mctf.py" \
+               --base-dir "${base_dir}" "${input_file}"
+}
This page took 0.02427 seconds and 4 git commands to generate.