3 # SPDX-License-Identifier: GPL-2.0-only
5 # Copyright (C) 2019 Philippe Proulx <pproulx@efficios.com>
6 # Copyright (C) 2019 Francis Deslauriers <francis.deslauriers@efficios.com>
9 # This test validates that a `src.ctf.fs` component successfully reads
10 # specific CTF traces and creates the expected messages.
12 # Such CTF traces to open either exist (in `tests/ctf-traces/succeed`)
13 # or are generated by this test using local trace generators.
17 if [ "x${BT_TESTS_SRCDIR:-}" != "x" ]; then
18 UTILSSH
="$BT_TESTS_SRCDIR/utils/utils.sh"
20 UTILSSH
="$(dirname "$0")/../../utils/utils.sh"
23 # shellcheck source=../../utils/utils.sh
26 this_dir_relative
="plugins/flt.lttng-utils.debug-info"
27 succeed_trace_dir
="$BT_CTF_TRACES_PATH/succeed"
28 expect_dir
="$BT_TESTS_DATADIR/$this_dir_relative"
29 binary_artefact_dir
="$BT_TESTS_DATADIR/$this_dir_relative"
30 data_dir
="$BT_TESTS_DATADIR/$this_dir_relative"
35 "-c" "flt.lttng-utils.debug-info"
36 "-p" "target-prefix=\"$binary_artefact_dir/x86_64-linux-gnu/dwarf_full\""
37 "-c" "sink.text.details"
38 "-p" "with-trace-name=no,with-stream-name=no"
41 bt_diff_cli
"$expect_dir/trace-$name.expect" "/dev/null" \
42 "$succeed_trace_dir/$name" "${local_args[@]}"
43 ok $?
"Trace '$name' gives the expected output"
46 test_compare_to_ctf_fs
() {
47 # Compare the `sink.text.details` output of a graph with and without a
48 # `flt.lttng-utils.debug-info` component. Both should be identical for
49 # traces without LTTng debugging fields.
53 local debug_info_cli_args
=("-c" "flt.lttng-utils.debug-info")
54 local details_cli_args
=(
55 "-c" "sink.text.details"
56 "--params" "with-trace-name=false,with-stream-name=false,with-uuid=false"
64 actual_stdout
=$
(mktemp
-t test_debug_info_stdout_actual.XXXXXX
)
65 actual_stderr
=$
(mktemp
-t test_debug_info_stderr_actual.XXXXXX
)
66 expected_stdout
=$
(mktemp
-t test_debug_info_stdout_expected.XXXXXX
)
67 expected_stderr
=$
(mktemp
-t test_debug_info_stderr_expected.XXXXXX
)
69 # Create expected files using a graph without a `debug-info` component.
70 bt_cli
"$expected_stdout" "$expected_stderr" "${cli_args[@]}" \
71 "${details_cli_args[@]}"
73 # Read the same trace with a `debug-info` component in the graph.
74 bt_cli
"$actual_stdout" "$actual_stderr" "${cli_args[@]}" \
75 "${details_cli_args[@]}" "${debug_info_cli_args[@]}"
77 bt_diff
"$expected_stdout" "$actual_stdout"
78 ok $?
"Input '$test_name' gives the expected stdout"
80 bt_diff
"$expected_stderr" "$actual_stderr"
81 ok $?
"Input '$test_name' gives the expected stderr"
83 rm -f "$actual_stdout"
84 rm -f "$actual_stderr"
85 rm -f "$expected_stdout"
86 rm -f "$expected_stderr"
89 test_compare_ctf_src_trace
() {
91 local trace_path
="$succeed_trace_dir/$trace_name"
92 local cli_args
=("$trace_path")
94 diag
"Comparing output with and without 'flt.lttng-utils.debug-info' on '$trace_name'"
95 test_compare_to_ctf_fs
"src.ctf.fs with $trace_name trace" "${cli_args[@]}"
98 test_compare_complete_src_trace
() {
100 local source_name
="src.test_debug_info.CompleteSrc"
101 local cli_args
=("--plugin-path=$data_dir" "-c" "$source_name")
102 test_compare_to_ctf_fs
"$source_name" "${cli_args[@]}"
107 test_debug_info debug-info
109 test_compare_ctf_src_trace smalltrace
110 test_compare_ctf_src_trace
2packets
111 test_compare_ctf_src_trace session-rotation
113 test_compare_complete_src_trace