X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=tests%2Fplugins%2Fsrc.ctf.lttng-live%2Ftest_live;h=f694d799e9a3697c0c4d2e8550d410e1805fc0c1;hb=f2958352b96ea9e50f6fbd5647b99d0be97188ec;hp=deee081a2f02fdfb5919f6feb476f52792bb13a7;hpb=a0baab4a979e830f7dc4698c20b71e84dea6ff9d;p=babeltrace.git diff --git a/tests/plugins/src.ctf.lttng-live/test_live b/tests/plugins/src.ctf.lttng-live/test_live index deee081a..f694d799 100755 --- a/tests/plugins/src.ctf.lttng-live/test_live +++ b/tests/plugins/src.ctf.lttng-live/test_live @@ -5,15 +5,16 @@ # Copyright (C) 2019 Philippe Proulx # -# This test validates that a `src.ctf.fs` component successfully reads -# specific CTF traces and creates the expected messages. +# This test validates that a `src.ctf.lttng-live` component successfully does +# various tasks that a `src.ctf.lttng-live` component is expected to do, like +# listing tracing sessions and receiving live traces / producing the expected +# messages out of it. # -# Such CTF traces to open either exist (in `tests/ctf-traces/`) -# or are generated by this test using local trace generators. +# A mock LTTng live server is used to feed data to the component. SH_TAP=1 -if [ "x${BT_TESTS_SRCDIR:-}" != "x" ]; then +if [ -n "${BT_TESTS_SRCDIR:-}" ]; then UTILSSH="$BT_TESTS_SRCDIR/utils/utils.sh" else UTILSSH="$(dirname "$0")/../../utils/utils.sh" @@ -54,7 +55,8 @@ lttng_live_server() { local server_script="$test_data_dir/lttng_live_server.py" # start server - echo "$server_args" | xargs "$BT_TESTS_PYTHON_BIN" "$server_script" \ + diag "$BT_TESTS_PYTHON_BIN $server_script --port-file $port_file --trace-path-prefix $trace_dir_native $server_args" + echo "$server_args" | run_python xargs "$BT_TESTS_PYTHON_BIN" "$server_script" \ --port-file "$port_file" \ --trace-path-prefix "$trace_dir_native" & @@ -367,7 +369,33 @@ test_inactivity_discarded_packet() { rm -f "$expected_stderr" } -plan_tests 14 +test_split_metadata() { + # Consume a metadata stream sent in two parts. This testcase tests the + # behaviour of Babeltrace when the tracing session was cleared (lttng + # clear) but the metadata is not yet available to the relay. In such + # cases, when asked for metadata, the relay will return the + # `LTTNG_VIEWER_METADATA_OK` status and a data length of 0. The viewer + # need to consider such case as a request to retry fetching metadata. + # + # This testcase emulates such behaviour by adding empty metadata + # packets. + + local test_text="CLI attach and fetch from single-domain session - Receive metadata in two sections separated by a empty section" + local cli_args_template="-i lttng-live net://localhost:@PORT@/host/hostname/split_metadata -c sink.text.details" + local sessions_file="$test_data_dir/split_metadata.json" + local server_args="--sessions-filename '$sessions_file'" + local expected_stdout="${test_data_dir}/split_metadata.expect" + local expected_stderr + + # Empty file for stderr expected + expected_stderr="$(mktemp -t test_live_split_metadata_stderr_expected.XXXXXX)" + + run_test "$test_text" "$cli_args_template" "$server_args" "$expected_stdout" "$expected_stderr" + + rm -f "$expected_stderr" +} + +plan_tests 16 test_list_sessions test_base @@ -375,3 +403,4 @@ test_multi_domains test_rate_limited test_compare_to_ctf_fs test_inactivity_discarded_packet +test_split_metadata