# This test validates that a `src.ctf.fs` component successfully reads
# specific CTF traces and creates the expected messages.
#
-# Such CTF traces to open either exist (in `tests/ctf-traces/succeed`)
+# Such CTF traces to open either exist (in `tests/ctf-traces/`)
# or are generated by this test using local trace generators.
SH_TAP=1
this_dir_relative="plugins/src.ctf.lttng-live"
test_data_dir="$BT_TESTS_DATADIR/$this_dir_relative"
-trace_dir="$BT_CTF_TRACES_PATH/succeed"
+trace_dir="$BT_CTF_TRACES_PATH"
if [ "$BT_OS_TYPE" = "mingw" ]; then
# Same as the above, but in Windows form (C:\foo\bar) instead of Unix form
local server_script="$test_data_dir/lttng_live_server.py"
# start server
- echo "$server_args" | xargs "$BT_TESTS_PYTHON_BIN" "$server_script" --port-file "$port_file" &
+ echo "$server_args" | xargs "$BT_TESTS_PYTHON_BIN" "$server_script" \
+ --port-file "$port_file" \
+ --trace-path-prefix "$trace_dir_native" &
# write PID to file
echo $! > "$pid_file"
get_cli_output_with_lttng_live_server() {
local cli_args_template="$1"
- local server_args="$2"
+ local sessions_file="$2"
local cli_stdout_file="$3"
local cli_stderr_file="$4"
local port_file="$5"
# lttng_live_server() writes its return code to the
# `$server_retcode_file` file.
lttng_live_server "$port_file" "$server_pid_file" \
- "$server_retcode_file" "$server_args" &
+ "$server_retcode_file" "$sessions_file" &
# Get port number
i=0
local test_text="CLI prints the expected session list"
local cli_args_template="-i lttng-live net://localhost:@PORT@"
- local server_args="'multi-domains,0,hostname,1,0,${trace_dir_native}/multi-domains/ust/' 'multi-domains,1,hostname,1,0,${trace_dir_native}/multi-domains/kernel/' 'trace-with-index,2,hostname,1,0,${trace_dir_native}/trace-with-index/' "
+ local sessions_file="$test_data_dir/list_sessions.json"
+ local server_args="--sessions-filename '$sessions_file'"
template_expected=$(<"$test_data_dir/cli-list-sessions.expect")
cli_stderr="$(mktemp -t test_live_list_sessions_stderr.XXXXXX)"
# discarded events.
local test_text="CLI attach and fetch from single-domains session - no discarded events"
local cli_args_template="-i lttng-live net://localhost:@PORT@/host/hostname/trace-with-index -c sink.text.details"
- local server_args="'trace-with-index,0,hostname,1,0,${trace_dir_native}/trace-with-index/'"
+ local sessions_file="$test_data_dir/base.json"
+ local server_args="--sessions-filename '$sessions_file'"
local expected_stdout="${test_data_dir}/cli-base.expect"
local expected_stderr
# events.
local test_text="CLI attach and fetch from multi-domains session - discarded events"
local cli_args_template="-i lttng-live net://localhost:@PORT@/host/hostname/multi-domains -c sink.text.details"
- local server_args="'multi-domains,0,hostname,1,0,${trace_dir_native}/multi-domains/kernel/,${trace_dir_native}/multi-domains/ust/'"
- local expected_stdout="${test_data_dir}/cli-multi-domains.expect"
+ local sessions_file="${test_data_dir}/multi_domains.json"
+ local server_args="--sessions-filename '$sessions_file'"
+ local expected_stdout="$test_data_dir/cli-multi-domains.expect"
local expected_stderr
# Empty file for stderr expected
# The packet size of the test trace is 4k. Limit requests to 1k.
local test_text="CLI many requests per packet"
local cli_args_template="-i lttng-live net://localhost:@PORT@/host/hostname/trace-with-index -c sink.text.details"
- local server_args="--max-query-data-response-size 1024 'trace-with-index,0,hostname,1,0,${trace_dir_native}/trace-with-index/'"
+ local sessions_file="$test_data_dir/rate_limited.json"
+ local server_args="--max-query-data-response-size 1024 --sessions-filename '$sessions_file'"
local expected_stdout="${test_data_dir}/cli-base.expect"
local expected_stderr
# that ordering is consistent between live and ctf fs.
local test_text="CLI src.ctf.fs vs src.ctf.lttng-live"
local cli_args_template="-i lttng-live net://localhost:@PORT@/host/hostname/multi-domains -c sink.text.details --params with-trace-name=false,with-stream-name=false"
- local server_args="'multi-domains,0,hostname,1,0,${trace_dir_native}/multi-domains/kernel/' 'multi-domains,1,hostname,1,0,${trace_dir_native}/multi-domains/ust/'"
- local server_args_inverse="'multi-domains,0,hostname,1,0,${trace_dir_native}/multi-domains/ust/' 'multi-domains,1,hostname,1,0,${trace_dir_native}/multi-domains/kernel/'"
+ local sessions_file="$test_data_dir/multi_domains.json"
+ local sessions_file_inverse="$test_data_dir/multi_domains_inverse.json"
+ local server_args="--sessions-filename '$sessions_file'"
+ local server_args_inverse="--sessions-filename '$sessions_file_inverse'"
local expected_stdout
local expected_stderr
expected_stdout="$(mktemp -t test_live_compare_stdout_expected.XXXXXX)"
expected_stderr="$(mktemp -t test_live_compare_stderr_expected.XXXXXX)"
- bt_cli "$expected_stdout" "$expected_stderr" "${trace_dir}/multi-domains" -c sink.text.details --params "with-trace-name=false,with-stream-name=false"
+ bt_cli "$expected_stdout" "$expected_stderr" "${trace_dir}/succeed/multi-domains" -c sink.text.details --params "with-trace-name=false,with-stream-name=false"
bt_remove_cr "${expected_stdout}"
bt_remove_cr "${expected_stderr}"
run_test "$test_text" "$cli_args_template" "$server_args" "$expected_stdout" "$expected_stderr"