7 import lttng_ivc
.utils
.ProjectFactory
as ProjectFactory
8 import lttng_ivc
.utils
.utils
as utils
9 import lttng_ivc
.utils
.runtime
as Run
10 import lttng_ivc
.settings
as Settings
15 BC: Feature of the smallest version number will works.
16 TU: Tracing unavailable
18 +------------------------------------------------------------------------------+
19 | LTTng UST control protocol compatibility matrix |
20 | (between applications and tools linked on LTTng UST and liblttng-ust-ctl) |
21 +--------------------------+------------+------------+------------+------------+
22 | LTTng UST / LTTng Tools | 2.7 (6.0) | 2.8 (6.1) | 2.9 (7.1) | 2.10 (7.2) |
23 +--------------------------+------------+------------+------------+------------+
24 | 2.7 (6.0) | FC | BC | TU | TU |
25 | 2.8 (6.1) | BC | FC | TU | TU |
26 | 2.9 (7.1) | TU | TU | FC | BC |
27 | 2.10 (7.2) | TU | TU | BC | FC |
28 +--------------------------+------------+------------+------------+------------+
30 Version number of this API is defined in include/lttng/ust-abi.h of lttng-ust project
35 First tuple member: lttng-ust label
36 Second tuple member: lttng-tool label
37 Third tuple member: expected scenario
40 test_matrix_tracing_available
= [
41 ("lttng-ust-2.7", "lttng-tools-2.7", True),
42 ("lttng-ust-2.7", "lttng-tools-2.8", True),
43 ("lttng-ust-2.7", "lttng-tools-2.9", False),
44 ("lttng-ust-2.7", "lttng-tools-2.10", False),
45 ("lttng-ust-2.8", "lttng-tools-2.7", True),
46 ("lttng-ust-2.8", "lttng-tools-2.8", True),
47 ("lttng-ust-2.8", "lttng-tools-2.9", False),
48 ("lttng-ust-2.8", "lttng-tools-2.10", False),
49 ("lttng-ust-2.9", "lttng-tools-2.7", False),
50 ("lttng-ust-2.9", "lttng-tools-2.8", False),
51 ("lttng-ust-2.9", "lttng-tools-2.9", True),
52 ("lttng-ust-2.9", "lttng-tools-2.10", True),
53 ("lttng-ust-2.10", "lttng-tools-2.7", False),
54 ("lttng-ust-2.10", "lttng-tools-2.8", False),
55 ("lttng-ust-2.10", "lttng-tools-2.9", True),
56 ("lttng-ust-2.10", "lttng-tools-2.10", True),
59 # Only consider test case for which tracing is valid
60 test_matrix_app_context
= [
61 ("lttng-ust-2.7", "lttng-tools-2.7", ""),
62 ("lttng-ust-2.7", "lttng-tools-2.8", ""),
63 ("lttng-ust-2.7", "lttng-tools-2.9", ""),
64 ("lttng-ust-2.7", "lttng-tools-2.10", ""),
65 ("lttng-ust-2.8", "lttng-tools-2.7", ""),
66 ("lttng-ust-2.8", "lttng-tools-2.8", ""),
67 ("lttng-ust-2.8", "lttng-tools-2.9", ""),
68 ("lttng-ust-2.8", "lttng-tools-2.10", ""),
69 ("lttng-ust-2.9", "lttng-tools-2.7", ""),
70 ("lttng-ust-2.9", "lttng-tools-2.8", ""),
71 ("lttng-ust-2.9", "lttng-tools-2.9", ""),
72 ("lttng-ust-2.9", "lttng-tools-2.10", ""),
73 ("lttng-ust-2.10", "lttng-tools-2.7", ""),
74 ("lttng-ust-2.10", "lttng-tools-2.8", ""),
75 ("lttng-ust-2.10", "lttng-tools-2.9", ""),
76 ("lttng-ust-2.10", "lttng-tools-2.10", ""),
79 runtime_matrix_tracing_available
= []
81 if not Settings
.test_only
:
82 runtime_matrix_tracing_available
= test_matrix_tracing_available
84 for tup
in test_matrix_tracing_available
:
85 if (tup
[0] in Settings
.test_only
or tup
[1] in
87 runtime_matrix_tracing_available
.append(tup
)
90 @pytest.mark
.parametrize("ust_label,tools_label, should_trace", runtime_matrix_tracing_available
)
91 def test_ust_app_tracing_available(tmpdir
, ust_label
, tools_label
, should_trace
):
93 if ((ust_label
== "lttng-ust-2.7" and tools_label
== "lttng-tools-2.8") or
94 (ust_label
== "lttng-ust-2.8" and tools_label
== "lttng-tools-2.7")):
95 pytest
.xfail("FAiling but should work, problem regarding the size of fields structure")
100 ust
= ProjectFactory
.get_precook(ust_label
)
101 tools
= ProjectFactory
.get_precook(tools_label
)
102 babeltrace
= ProjectFactory
.get_precook(Settings
.default_babeltrace
)
104 tools_runtime_path
= os
.path
.join(str(tmpdir
), "tools")
105 ust_runtime_path
= os
.path
.join(str(tmpdir
), "ust")
106 app_path
= os
.path
.join(str(tmpdir
), "app")
108 with Run
.get_runtime(ust_runtime_path
) as runtime_app
, Run
.get_runtime(tools_runtime_path
) as runtime_tools
:
109 runtime_tools
.add_project(tools
)
110 runtime_tools
.add_project(babeltrace
)
112 runtime_app
.add_project(ust
)
113 runtime_app
.lttng_home
= runtime_tools
.lttng_home
115 trace_path
= os
.path
.join(runtime_tools
.lttng_home
, 'trace')
117 # Make application using the ust runtime
118 shutil
.copytree(Settings
.apps_gen_events_folder
, app_path
)
119 runtime_app
.run("make V=1", cwd
=app_path
)
121 # Start lttng-sessiond
122 sessiond
= utils
.sessiond_spawn(runtime_tools
)
124 # Create session using mi to get path and session name
125 runtime_tools
.run('lttng create trace --output={}'.format(trace_path
))
127 # TODO: test with event present in listing
129 runtime_tools
.run('lttng enable-event -u tp:tptest')
130 runtime_tools
.run('lttng start')
133 cmd
= './app {}'.format(nb_events
)
134 runtime_app
.run(cmd
, cwd
=app_path
)
137 runtime_tools
.run('lttng destroy -a')
138 runtime_tools
.subprocess_terminate(sessiond
)
141 # Read trace with babeltrace and check for event count via number of line
142 cmd
= 'babeltrace {}'.format(trace_path
)
143 cp_process
, cp_out
, cp_err
= runtime_tools
.run(cmd
)
144 assert(utils
.line_count(cp_out
) == nb_events
)
145 except subprocess
.CalledProcessError
as e
:
146 # Check if we expected a problem here