fix: relayd: unaligned access in trace_chunk_registry_ht_key_hash
[lttng-tools.git] / tests / regression / ust / baddr-statedump / test_baddr-statedump.py
1 #!/usr/bin/env python3
2 #
3 # Copyright (C) 2013 Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 # Copyright (C) 2015 Antoine Busque <abusque@efficios.com>
5 #
6 # SPDX-License-Identifier: GPL-2.0-only
7
8 import os
9 import subprocess
10 import re
11 import shutil
12 import sys
13
14 test_path = os.path.dirname(os.path.abspath(__file__)) + "/"
15 test_utils_path = test_path
16 for i in range(4):
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 *
21
22
23 NR_TESTS = 7
24 current_test = 1
25 print("1..{0}".format(NR_TESTS))
26
27 # Check if a sessiond is running... bail out if none found.
28 if session_daemon_alive() == 0:
29 bail(
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."""
33 )
34
35 session_info = create_session()
36 enable_ust_tracepoint_event(session_info, "*")
37 start_session(session_info)
38
39 test_process = subprocess.Popen(
40 test_path + "prog.strip", stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL
41 )
42 test_process.wait()
43
44 print_test_result(
45 test_process.returncode == 0, current_test, "Test application exited normally"
46 )
47 current_test += 1
48
49 stop_session(session_info)
50
51 # Check for statedump events in the resulting trace
52 try:
53 babeltrace_process = subprocess.Popen(
54 [BABELTRACE_BIN, session_info.trace_path],
55 stdout=subprocess.PIPE,
56 stderr=subprocess.PIPE,
57 )
58 except FileNotFoundError:
59 bail(
60 "Could not open {}. Please make sure it is installed.".format(BABELTRACE_BIN),
61 session_info,
62 )
63
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
69
70 for event_line in babeltrace_process.stdout:
71 # Let babeltrace finish to get the return code
72 if (
73 start_event_found
74 and bin_info_event_found
75 and build_id_event_found
76 and debug_link_event_found
77 and end_event_found
78 ):
79 continue
80
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
92
93 babeltrace_process.wait()
94
95 print_test_result(
96 babeltrace_process.returncode == 0, current_test, "Resulting trace is readable"
97 )
98 current_test += 1
99
100 print_test_result(
101 start_event_found,
102 current_test,
103 "lttng_ust_statedump:start event found in resulting trace",
104 )
105 current_test += 1
106
107 print_test_result(
108 bin_info_event_found,
109 current_test,
110 "lttng_ust_statedump:bin_info event found in resulting trace",
111 )
112 current_test += 1
113
114 print_test_result(
115 build_id_event_found,
116 current_test,
117 "lttng_ust_statedump:build_id event found in resulting trace",
118 )
119 current_test += 1
120
121 print_test_result(
122 debug_link_event_found,
123 current_test,
124 "lttng_ust_statedump:debug_link event found in resulting trace",
125 )
126 current_test += 1
127
128 print_test_result(
129 end_event_found,
130 current_test,
131 "lttng_ust_statedump:end event found in resulting trace",
132 )
133 current_test += 1
134
135 shutil.rmtree(session_info.tmp_directory)
This page took 0.032047 seconds and 4 git commands to generate.