X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=tests%2Fplugins%2Fsrc.ctf.lttng-live%2Ftest_live;h=20da1ae96edd0c689734f08aaa8923aed7fd97bb;hb=f5e4e7f6e9ade2e1b9e2ef6b7e6d55d19f16a85c;hp=41ed24a29266a0e0c657254fc69cd60f6d961b07;hpb=0198f2fb08c3aab7f50f9aab5ce3425c0c8b6789;p=babeltrace.git diff --git a/tests/plugins/src.ctf.lttng-live/test_live b/tests/plugins/src.ctf.lttng-live/test_live index 41ed24a2..20da1ae9 100755 --- a/tests/plugins/src.ctf.lttng-live/test_live +++ b/tests/plugins/src.ctf.lttng-live/test_live @@ -49,6 +49,14 @@ this_dir_relative="plugins/src.ctf.lttng-live" test_data_dir="$BT_TESTS_DATADIR/$this_dir_relative" trace_dir="$BT_CTF_TRACES_PATH/succeed" +if [ "$BT_OS_TYPE" = "mingw" ]; then + # Same as the above, but in Windows form (C:\foo\bar) instead of Unix form + # (/c/foo/bar). + trace_dir_native=$(cygpath -w "${trace_dir}") +else + trace_dir_native="${trace_dir}" +fi + lttng_live_server() { local port_file="$1" local pid_file="$2" @@ -93,8 +101,8 @@ get_cli_output_with_lttng_live_server() { local server_pid_file local server_retcode_file - server_pid_file="$(mktemp)" - server_retcode_file="$(mktemp)" + server_pid_file="$(mktemp -t test_live_server_pid.XXXXXX)" + server_retcode_file="$(mktemp -t test_live_server_ret.XXXXX)" diag "Starting LTTng live server mockup" @@ -180,9 +188,9 @@ run_test() { local port_file local port - cli_stderr="$(mktemp)" - cli_stdout="$(mktemp)" - port_file="$(mktemp)" + cli_stderr="$(mktemp -t test_live_stderr.XXXXXX)" + cli_stdout="$(mktemp -t test_live_stdout.XXXXXX)" + port_file="$(mktemp -t test_live_server_port.XXXXXX)" get_cli_output_with_lttng_live_server "$cli_args_template" "$server_args" "$cli_stdout" "$cli_stderr" "$port_file" port=$(<"$port_file") @@ -210,14 +218,14 @@ test_list_sessions() { 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}/multi-domains/kernel/,${trace_dir}/multi-domains/ust/' 'trace-with-index,1,hostname,1,0,${trace_dir}/trace-with-index/'" + 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/' " template_expected=$(<"$test_data_dir/cli-list-sessions.expect") - cli_stderr="$(mktemp)" - cli_stdout="$(mktemp)" - empty_file="$(mktemp)" - port_file="$(mktemp)" - tmp_stdout_expected="$(mktemp)" + cli_stderr="$(mktemp -t test_live_list_sessions_stderr.XXXXXX)" + cli_stdout="$(mktemp -t test_live_list_sessions_stdout.XXXXXX)" + empty_file="$(mktemp -t test_live_list_sessions_empty.XXXXXX)" + port_file="$(mktemp -t test_live_list_sessions_server_port.XXXXXX)" + tmp_stdout_expected="$(mktemp -t test_live_list_sessions_stdout_expected.XXXXXX)" get_cli_output_with_lttng_live_server "$cli_args_template" "$server_args" "$cli_stdout" "$cli_stderr" "$port_file" port=$(<"$port_file") @@ -245,12 +253,12 @@ test_base() { # 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}/trace-with-index/'" + local server_args="'trace-with-index,0,hostname,1,0,${trace_dir_native}/trace-with-index/'" local expected_stdout="${test_data_dir}/cli-base.expect" local expected_stderr # Empty file for stderr expected - expected_stderr=$(mktemp) + expected_stderr="$(mktemp -t test_live_base_stderr_expected.XXXXXX)" run_test "$test_text" "$cli_args_template" "$server_args" "$expected_stdout" "$expected_stderr" @@ -262,12 +270,12 @@ test_multi_domains() { # 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}/multi-domains/kernel/,${trace_dir}/multi-domains/ust/'" + 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 expected_stderr # Empty file for stderr expected - expected_stderr=$(mktemp) + expected_stderr="$(mktemp -t test_live_multi_domains_stderr_expected.XXXXXX)" run_test "$test_text" "$cli_args_template" "$server_args" "$expected_stdout" "$expected_stderr" @@ -282,12 +290,12 @@ test_rate_limited() { # 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}/trace-with-index/'" + local server_args="--max-query-data-response-size 1024 'trace-with-index,0,hostname,1,0,${trace_dir_native}/trace-with-index/'" local expected_stdout="${test_data_dir}/cli-base.expect" local expected_stderr # Empty file for stderr expected - expected_stderr="$(mktemp)" + expected_stderr="$(mktemp -t test_live_rate_limited_stderr_expected.XXXXXX)" run_test "$test_text" "$cli_args_template" "$server_args" "$expected_stdout" "$expected_stderr" @@ -297,23 +305,28 @@ test_rate_limited() { test_compare_to_ctf_fs() { # Compare the details text sink or ctf.fs and ctf.lttng-live to ensure # that the trace is parsed the same way. + # Do the same with the session swapped on the relayd side. This validate + # 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/trace-with-index -c sink.text.details --params with-trace-name=false,with-stream-name=false" - local server_args="'trace-with-index,0,hostname,1,0,${trace_dir}/trace-with-index/'" + 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 expected_stdout local expected_stderr - expected_stdout=$(mktemp) - expected_stderr=$(mktemp) + 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}/trace-with-index/" -c sink.text.details --params "with-trace-name=false,with-stream-name=false" + bt_cli "$expected_stdout" "$expected_stderr" "${trace_dir}/multi-domains" -c sink.text.details --params "with-trace-name=false,with-stream-name=false" run_test "$test_text" "$cli_args_template" "$server_args" "$expected_stdout" "$expected_stderr" + diag "Inverse session order from lttng-relayd" + run_test "$test_text" "$cli_args_template" "$server_args_inverse" "$expected_stdout" "$expected_stderr" rm -f "$expected_stdout" rm -f "$expected_stderr" } -plan_tests 10 +plan_tests 12 test_list_sessions test_base