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
21 First tuple member: lttng-ust label
22 Second tuple member: lttng-tool label
23 Third tuple member: expected scenario
26 event_registration_error
= "Error: UST app recv reg unsupported version"
28 test_matrix_base_app_tracing_available
= [
29 ("lttng-ust-2.7", "lttng-tools-2.7", True),
30 ("lttng-ust-2.7", "lttng-tools-2.8", True),
31 ("lttng-ust-2.7", "lttng-tools-2.9", True),
32 ("lttng-ust-2.7", "lttng-tools-2.10", True),
33 ("lttng-ust-2.8", "lttng-tools-2.7", True),
34 ("lttng-ust-2.8", "lttng-tools-2.8", True),
35 ("lttng-ust-2.8", "lttng-tools-2.9", True),
36 ("lttng-ust-2.8", "lttng-tools-2.10", True),
37 ("lttng-ust-2.9", "lttng-tools-2.7", True),
38 ("lttng-ust-2.9", "lttng-tools-2.8", True),
39 ("lttng-ust-2.9", "lttng-tools-2.9", True),
40 ("lttng-ust-2.9", "lttng-tools-2.10", True),
41 ("lttng-ust-2.10", "lttng-tools-2.7", True),
42 ("lttng-ust-2.10", "lttng-tools-2.8", True),
43 ("lttng-ust-2.10", "lttng-tools-2.9", True),
44 ("lttng-ust-2.10", "lttng-tools-2.10", True),
47 runtime_matrix_base_app_tracing_available
= []
49 if not Settings
.test_only
:
50 runtime_matrix_base_app_tracing_available
= test_matrix_base_app_tracing_available
52 for tup
in test_matrix_base_app_tracing_available
:
53 if (tup
[0] in Settings
.test_only
or tup
[1] in
55 runtime_matrix_base_app_tracing_available
.append(tup
)
58 @pytest.mark
.parametrize("ust_label,tools_label,success", runtime_matrix_base_app_tracing_available
)
59 def test_ust_app_tools_update_tracing_available(tmpdir
, ust_label
, tools_label
, success
):
64 ust
= ProjectFactory
.get_precook(ust_label
)
65 tools
= ProjectFactory
.get_precook(tools_label
)
66 babeltrace
= ProjectFactory
.get_precook(Settings
.default_babeltrace
)
68 tools_runtime_path
= os
.path
.join(str(tmpdir
), "tools")
69 ust_runtime_path
= os
.path
.join(str(tmpdir
), "ust")
70 app_path
= os
.path
.join(str(tmpdir
), "app")
72 with Run
.get_runtime(ust_runtime_path
) as runtime_app
, Run
.get_runtime(tools_runtime_path
) as runtime_tools
:
73 runtime_tools
.add_project(tools
)
74 runtime_tools
.add_project(babeltrace
)
76 runtime_app
.add_project(ust
)
77 runtime_app
.lttng_home
= runtime_tools
.lttng_home
79 trace_path
= os
.path
.join(runtime_tools
.lttng_home
, 'trace')
81 # Make application using the ust runtime
82 shutil
.copytree(Settings
.apps_gen_events_folder
, app_path
)
83 runtime_app
.run("make V=1", cwd
=app_path
)
85 # Start lttng-sessiond
86 sessiond
= utils
.sessiond_spawn(runtime_tools
)
88 # Create session using mi to get path and session name
89 runtime_tools
.run('lttng create trace --output={}'.format(trace_path
))
91 runtime_tools
.run('lttng enable-event -u tp:tptest')
92 runtime_tools
.run('lttng start')
95 cmd
= './app {}'.format(nb_events
)
96 runtime_tools
.run(cmd
, cwd
=app_path
)
98 runtime_tools
.run("lddtree ./app", cwd
=app_path
)
99 runtime_app
.run("lddtree ./app", cwd
=app_path
)
102 runtime_tools
.run('lttng stop')
103 runtime_tools
.run('lttng destroy -a')
104 cp
= runtime_tools
.subprocess_terminate(sessiond
)
105 if cp
.returncode
!= 0:
106 pytest
.fail("Sessiond return code")
109 cmd
= 'babeltrace {}'.format(trace_path
)
111 cp_process
, cp_out
, cp_err
= runtime_tools
.run(cmd
)
112 assert(utils
.line_count(cp_out
) == nb_events
)
114 with pytest
.raises(subprocess
.CalledProcessError
):
115 cp_process
, cp_out
, cp_err
= runtime_tools
.run(cmd
)