X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=tests%2Fcli%2Ftest_convert_args;h=74c32252fe30daa7a6d6aa4fe475fc7f522723fd;hb=8b4cd08a4cc2e13235c20689d74790ed3ccc6a51;hp=475f9052a2c664e22c1975118381ff47f988a74b;hpb=505d91781221dcff6f5bd9a0cd0c4fd73797d1a1;p=babeltrace.git diff --git a/tests/cli/test_convert_args b/tests/cli/test_convert_args index 475f9052..74c32252 100755 --- a/tests/cli/test_convert_args +++ b/tests/cli/test_convert_args @@ -27,6 +27,7 @@ fi source "$UTILSSH" test_head_comment=0 +tmp_stderr=$(mktemp) test_bt_convert_run_args() { local what="$1" @@ -54,9 +55,10 @@ test_bt_convert_run_args() { 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=$? @@ -71,6 +73,16 @@ test_bt_convert_fails() { 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() { @@ -90,7 +102,7 @@ if [ "$BT_OS_TYPE" = "mingw" ]; then 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" @@ -164,3 +176,7 @@ test_bt_convert_fails 'no source' '-o text' 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}"