9bc7e5b0da15cde35a1a2b8c60088dac96829e26
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
13 TODO: Add Command header section
17 First member: babeltrace label
18 Second member: tools label
21 #pytest.param("babeltrace-1.3", "lttng-tools-2.7", marks=pytest.mark.xfail(reason="Flaky test or Flaky babeltrace. Is under investigation")),
22 #pytest.param("babeltrace-1.3", "lttng-tools-2.8", marks=pytest.mark.xfail(reason="Flaky test or Flaky babeltrace. Is under investigation")) ),
23 #pytest.param("babeltrace-1.3", "lttng-tools-2.9", marks=pytest.mark.xfail(reason="Flaky test or Flaky babeltrace. Is under investigation")) ),
24 #pytest.param("babeltrace-1.3", "lttng-tools-2.10", marks=pytest.mark.xfail(reason="Flaky test or Flaky babeltrace. Is under investigation"))),
25 ("babeltrace-1.4", "lttng-tools-2.7"),
26 ("babeltrace-1.4", "lttng-tools-2.8"),
27 ("babeltrace-1.4", "lttng-tools-2.9"),
28 ("babeltrace-1.4", "lttng-tools-2.10"),
29 ("babeltrace-1.5", "lttng-tools-2.7"),
30 ("babeltrace-1.5", "lttng-tools-2.8"),
31 ("babeltrace-1.5", "lttng-tools-2.9"),
32 ("babeltrace-1.5", "lttng-tools-2.10"),
35 runtime_matrix_live
= []
37 if not Settings
.test_only
:
38 runtime_matrix_live
= test_matrix_live
40 for tup
in test_matrix_live
:
41 if (tup
[0] in Settings
.test_only
or tup
[1] in
43 runtime_matrix_live
.append(tup
)
46 @pytest.mark
.parametrize("babeltrace_l,tools_l", runtime_matrix_live
)
47 def test_babeltrace_live(tmpdir
, babeltrace_l
, tools_l
):
50 nb_expected_events
= 100
52 babeltrace
= ProjectFactory
.get_precook(babeltrace_l
)
53 tools
= ProjectFactory
.get_precook(tools_l
)
55 runtime_path
= os
.path
.join(str(tmpdir
), "runtime")
56 app_path
= os
.path
.join(str(tmpdir
), "app")
57 session_name
= "trace"
59 with Run
.get_runtime(runtime_path
) as runtime
:
60 runtime
.add_project(tools
)
61 runtime
.add_project(babeltrace
)
63 shutil
.copytree(Settings
.apps_gen_events_folder
, app_path
)
64 runtime
.run("make V=1", cwd
=app_path
)
66 relayd
, ctrl_port
, data_port
, live_port
= utils
.relayd_spawn(runtime
)
67 sessiond
= utils
.sessiond_spawn(runtime
)
69 hostname
= socket
.gethostname()
70 url_babeltrace
= "net://localhost:{}/host/{}/{}".format(live_port
, hostname
, session_name
)
71 url
= "net://localhost:{}:{}".format(ctrl_port
, data_port
)
73 # Create session using mi to get path and session name
74 runtime
.run('lttng create --set-url={} {} --live'.format(url
, session_name
))
76 runtime
.run('lttng enable-event -u tp:tptest')
78 # From now on babeltrace should be able to hook itself up.
79 # Synchronization point is done via relayd log
80 p_babeltrace
= runtime
.spawn_subprocess("babeltrace -i lttng-live {}".format(url_babeltrace
))
82 # TODO: Move to settings
84 # TODO: Move to settings
85 # Make sure that babeltrace did hook itself or at least tried to.
86 synchro_text
= "Version check done using protocol"
88 for i
in range(timeout
):
89 log
= runtime
.get_subprocess_stderr_path(relayd
)
90 if utils
.file_contains(log
, synchro_text
):
96 raise Exception("Babeltrace live is not listening after timeout")
98 runtime
.run('lttng start')
101 cmd
= './app {}'.format(nb_loop
)
102 runtime
.run(cmd
, cwd
=app_path
)
105 runtime
.run('lttng stop')
106 runtime
.run('lttng destroy -a')
108 # Make sure babeltrace is done reading
109 runtime
.subprocess_wait(p_babeltrace
)
111 runtime
.subprocess_terminate(sessiond
)
112 runtime
.subprocess_terminate(relayd
)
114 # Check the output from babeltrace
115 cp_out
= runtime
.get_subprocess_stdout_path(p_babeltrace
)
116 assert(utils
.line_count(cp_out
) == nb_expected_events
)
This page took 0.040859 seconds and 4 git commands to generate.