3 # Copyright (C) 2013 Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 # Copyright (C) 2015 Antoine Busque <abusque@efficios.com>
6 # SPDX-License-Identifier: GPL-2.0-only
14 test_path
= os
.path
.dirname(os
.path
.abspath(__file__
)) + "/"
15 test_utils_path
= test_path
17 test_utils_path
= os
.path
.dirname(test_utils_path
)
18 test_utils_path
= test_utils_path
+ "/utils"
19 sys
.path
.append(test_utils_path
)
20 from test_utils
import *
25 print("1..{0}".format(NR_TESTS
))
27 # Check if a sessiond is running... bail out if none found.
28 if session_daemon_alive() == 0:
30 """No sessiond running. Please make sure you are running this test
31 with the "run" shell script and verify that the lttng tools are
32 properly installed."""
35 session_info
= create_session()
36 enable_ust_tracepoint_event(session_info
, "*")
37 start_session(session_info
)
39 test_process
= subprocess
.Popen(
40 test_path
+ "prog.strip", stdout
=subprocess
.DEVNULL
, stderr
=subprocess
.DEVNULL
45 test_process
.returncode
== 0, current_test
, "Test application exited normally"
49 stop_session(session_info
)
51 # Check for statedump events in the resulting trace
53 babeltrace_process
= subprocess
.Popen(
54 [BABELTRACE_BIN
, session_info
.trace_path
],
55 stdout
=subprocess
.PIPE
,
56 stderr
=subprocess
.PIPE
,
58 except FileNotFoundError
:
60 "Could not open {}. Please make sure it is installed.".format(BABELTRACE_BIN
),
64 start_event_found
= False
65 bin_info_event_found
= False
66 build_id_event_found
= False
67 debug_link_event_found
= False
68 end_event_found
= False
70 for event_line
in babeltrace_process
.stdout
:
71 # Let babeltrace finish to get the return code
74 and bin_info_event_found
75 and build_id_event_found
76 and debug_link_event_found
81 event_line
= event_line
.decode("utf-8").replace("\n", "")
82 if re
.search(r
".*lttng_ust_statedump:start.*", event_line
) is not None:
83 start_event_found
= True
84 elif re
.search(r
".*lttng_ust_statedump:bin_info.*", event_line
) is not None:
85 bin_info_event_found
= True
86 elif re
.search(r
".*lttng_ust_statedump:build_id.*", event_line
) is not None:
87 build_id_event_found
= True
88 elif re
.search(r
".*lttng_ust_statedump:debug_link.*", event_line
) is not None:
89 debug_link_event_found
= True
90 elif re
.search(r
".*lttng_ust_statedump:end.*", event_line
) is not None:
91 end_event_found
= True
93 babeltrace_process
.wait()
96 babeltrace_process
.returncode
== 0, current_test
, "Resulting trace is readable"
103 "lttng_ust_statedump:start event found in resulting trace",
108 bin_info_event_found
,
110 "lttng_ust_statedump:bin_info event found in resulting trace",
115 build_id_event_found
,
117 "lttng_ust_statedump:build_id event found in resulting trace",
122 debug_link_event_found
,
124 "lttng_ust_statedump:debug_link event found in resulting trace",
131 "lttng_ust_statedump:end event found in resulting trace",
135 shutil
.rmtree(session_info
.tmp_directory
)
This page took 0.033066 seconds and 4 git commands to generate.