source "$UTILSSH"
test_head_comment=0
+tmp_stderr=$(mktemp)
test_bt_convert_run_args() {
local what="$1"
test_bt_convert_fails() {
local what="$1"
local convert_args="$2"
+ local expected_error_str="${3:-}"
# execute convert command
- "$BT_TESTS_BT2_BIN" convert --run-args $convert_args >/dev/null 2>&1
+ "$BT_TESTS_BT2_BIN" convert --run-args $convert_args >/dev/null 2>"${tmp_stderr}"
local status=$?
else
pass "FAILS: $what"
fi
+
+ if [ -n "${expected_error_str}" ]; then
+ grep --quiet "$expected_error_str" "$tmp_stderr"
+ status=$?
+ ok "$status" "FAILS: $what, error message"
+ if [ "$status" -ne 0 ]; then
+ diag "Expected error string '${expected_error_str}' not found in stderr:"
+ diag "$(cat ${tmp_stderr})"
+ fi
+ fi
}
comment() {
output_path=$(cygpath -m "$output_path")
fi
-plan_tests 71
+plan_tests 75
test_bt_convert_run_args 'path leftover' "$path_to_trace" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
test_bt_convert_run_args 'path leftovers' "$path_to_trace $path_to_trace2" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\", \"${path_to_trace2}\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
test_bt_convert_fails '-o ctf without --output' 'my-trace -o ctf'
test_bt_convert_fails '-o ctf + --output with implicit sink.text.pretty' "my-trace -o ctf --output $output_path --no-delta"
test_bt_convert_fails '--stream-intersection' "$path_to_trace --stream-intersection"
+test_bt_convert_fails '--params after leftover' "--component src.ctf.fs $path_to_trace --params=a=2" 'No current component (--component option) of which to set parameters'
+test_bt_convert_fails '--log-level after leftover' "--component src.ctf.fs $path_to_trace --log-level=W" 'No current component (--component option) to assign a log level to'
+
+rm -f "${tmp_stderr}"