b8b81b84b6af96d6d7e40c0be21c46610b92cdd6
9 import lttng_ivc
.utils
.ProjectFactory
as ProjectFactory
10 import lttng_ivc
.utils
.utils
as utils
11 import lttng_ivc
.utils
.runtime
as Run
12 import lttng_ivc
.settings
as Settings
15 TODO: Add Command header section
19 First member: babeltrace label
20 Second member: tools label
23 #pytest.param("babeltrace-1.3", "lttng-tools-2.7", marks=pytest.mark.xfail(reason="Flaky test or Flaky babeltrace. Is under investigation")),
24 #pytest.param("babeltrace-1.3", "lttng-tools-2.8", marks=pytest.mark.xfail(reason="Flaky test or Flaky babeltrace. Is under investigation")) ),
25 #pytest.param("babeltrace-1.3", "lttng-tools-2.9", marks=pytest.mark.xfail(reason="Flaky test or Flaky babeltrace. Is under investigation")) ),
26 #pytest.param("babeltrace-1.3", "lttng-tools-2.10", marks=pytest.mark.xfail(reason="Flaky test or Flaky babeltrace. Is under investigation"))),
27 ("babeltrace-1.4", "lttng-tools-2.7"),
28 ("babeltrace-1.4", "lttng-tools-2.8"),
29 ("babeltrace-1.4", "lttng-tools-2.9"),
30 ("babeltrace-1.4", "lttng-tools-2.10"),
31 ("babeltrace-1.5", "lttng-tools-2.7"),
32 ("babeltrace-1.5", "lttng-tools-2.8"),
33 ("babeltrace-1.5", "lttng-tools-2.9"),
34 ("babeltrace-1.5", "lttng-tools-2.10"),
37 runtime_matrix_live
= []
39 if not Settings
.test_only
:
40 runtime_matrix_live
= test_matrix_live
42 for tup
in test_matrix_live
:
43 if (tup
[0] in Settings
.test_only
or tup
[1] in
45 runtime_matrix_live
.append(tup
)
49 @pytest.mark
.parametrize("babeltrace_l,tools_l", runtime_matrix_live
)
50 def test_babeltrace_live(tmpdir
, babeltrace_l
, tools_l
):
53 nb_expected_events
= 100
55 babeltrace
= ProjectFactory
.get_precook(babeltrace_l
)
56 tools
= ProjectFactory
.get_precook(tools_l
)
58 runtime_path
= os
.path
.join(str(tmpdir
), "runtime")
59 app_path
= os
.path
.join(str(tmpdir
), "app")
60 session_name
= "trace"
62 with Run
.get_runtime(runtime_path
) as runtime
:
63 runtime
.add_project(tools
)
64 runtime
.add_project(babeltrace
)
66 shutil
.copytree(Settings
.apps_gen_events_folder
, app_path
)
67 runtime
.run("make V=1", cwd
=app_path
)
69 relayd
, ctrl_port
, data_port
, live_port
= utils
.relayd_spawn(runtime
)
70 sessiond
= utils
.sessiond_spawn(runtime
)
72 hostname
= socket
.gethostname()
73 url_babeltrace
= "net://localhost:{}/host/{}/{}".format(live_port
, hostname
, session_name
)
74 url
= "net://localhost:{}:{}".format(ctrl_port
, data_port
)
76 # Create session using mi to get path and session name
77 runtime
.run('lttng create --set-url={} {} --live'.format(url
, session_name
))
79 runtime
.run('lttng enable-event -u tp:tptest')
81 # From now on babeltrace should be able to hook itself up.
82 # Synchronization point is done via relayd log
83 p_babeltrace
= runtime
.spawn_subprocess("babeltrace -i lttng-live {}".format(url_babeltrace
))
85 # TODO: Move to settings
87 # TODO: Move to settings
88 # Make sure that babeltrace did hook itself or at least tried to.
89 synchro_text
= "Version check done using protocol"
91 for i
in range(timeout
):
92 log
= runtime
.get_subprocess_stderr_path(relayd
)
93 if utils
.file_contains(log
, synchro_text
):
99 raise Exception("Babeltrace live is not listening after timeout")
101 runtime
.run('lttng start')
104 cmd
= './app {}'.format(nb_loop
)
105 runtime
.run(cmd
, cwd
=app_path
)
108 runtime
.run('lttng stop')
109 runtime
.run('lttng destroy -a')
111 # Make sure babeltrace is done reading
112 runtime
.subprocess_wait(p_babeltrace
)
114 runtime
.subprocess_terminate(sessiond
)
115 runtime
.subprocess_terminate(relayd
)
117 # Check the output from babeltrace
118 cp_out
= runtime
.get_subprocess_stdout_path(p_babeltrace
)
119 assert(utils
.line_count(cp_out
) == nb_expected_events
)
This page took 0.039555 seconds and 4 git commands to generate.