3 # Copyright (C) 2022 Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 # Copyright (C) 2023 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 # SPDX-License-Identifier: GPL-2.0-only
10 Test instrumentation coverage of C++ constructors and destructors by LTTng-UST
11 tracepoints with a static archive.
13 This test successively sets up a session, traces a test application, and then
14 reads the resulting trace to determine if all the expected events are present.
21 # Import in-tree test utils
22 test_utils_import_path
= pathlib
.Path(__file__
).absolute().parents
[3] / "utils"
23 sys
.path
.append(str(test_utils_import_path
))
26 import ust_constructor_common
as ust
29 "description": "Test user space constructor/destructor instrumentation coverage (C++ w/ static archive)",
30 "application": "gen-ust-events-constructor/gen-ust-events-constructor-a",
31 "expected_events": copy
.deepcopy(
32 ust
.expected_events_common
33 + ust
.expected_events_common_cpp
34 + ust
.expected_events_tp_a
35 + ust
.expected_events_tp_a_cpp
37 "skip_if_application_not_present": False,
40 tap
= lttngtest
.TapGenerator(7 + len(test
["expected_events"]))
41 with lttngtest
.test_environment(with_sessiond
=True, log
=tap
.diagnostic
) as test_env
:
43 outputlocation
= ust
.capture_trace(
44 tap
, test_env
, test
["application"], test
["description"]
46 except FileNotFoundError
as fne
:
48 if test
["skip_if_application_not_present"]:
50 "Test application '{}' not found".format(test
["application"]),
51 tap
.remaining_test_cases
,
54 # Warning: validate_trace mutates test['expected_events']
55 ust
.validate_trace(outputlocation
.path
, tap
, test
["expected_events"])
58 sys
.exit(0 if tap
.is_successful
else 1)