X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=tests%2Fregression%2Fust%2Fust-constructor%2Ftest_ust_constructor_cpp_static.py;fp=tests%2Fregression%2Fust%2Fust-constructor%2Ftest_ust_constructor_cpp_static.py;h=db1570df4f5bdd0871bcb681c14c50af5d555ae3;hp=0000000000000000000000000000000000000000;hb=f506900f904887310c26a441ea86352fc27242c2;hpb=f6fd58e865ae9918ca5c9b935c526140b1622f3c diff --git a/tests/regression/ust/ust-constructor/test_ust_constructor_cpp_static.py b/tests/regression/ust/ust-constructor/test_ust_constructor_cpp_static.py new file mode 100755 index 000000000..db1570df4 --- /dev/null +++ b/tests/regression/ust/ust-constructor/test_ust_constructor_cpp_static.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2022 Jérémie Galarneau +# Copyright (C) 2023 Mathieu Desnoyers +# +# SPDX-License-Identifier: GPL-2.0-only + + +""" +Test instrumentation coverage of C++ constructors and destructors by LTTng-UST +tracepoints with a static archive. + +This test successively sets up a session, traces a test application, and then +reads the resulting trace to determine if all the expected events are present. +""" + +import copy +import pathlib +import sys + +# Import in-tree test utils +test_utils_import_path = pathlib.Path(__file__).absolute().parents[3] / "utils" +sys.path.append(str(test_utils_import_path)) + +import lttngtest +import ust_constructor_common as ust + +test = { + "description": "Test user space constructor/destructor instrumentation coverage (C++ w/ static archive)", + "application": "gen-ust-events-constructor/gen-ust-events-constructor-a", + "expected_events": copy.deepcopy( + ust.expected_events_common + + ust.expected_events_common_cpp + + ust.expected_events_tp_a + + ust.expected_events_tp_a_cpp + ), + "skip_if_application_not_present": False, +} + +tap = lttngtest.TapGenerator(7 + len(test["expected_events"])) +with lttngtest.test_environment(with_sessiond=True, log=tap.diagnostic) as test_env: + try: + outputlocation = ust.capture_trace( + tap, test_env, test["application"], test["description"] + ) + except FileNotFoundError as fne: + tap.diagnostic(fne) + if test["skip_if_application_not_present"]: + tap.skip( + "Test application '{}' not found".format(test["application"]), + tap.remaining_test_cases, + ) + sys.exit(0) + # Warning: validate_trace mutates test['expected_events'] + ust.validate_trace(outputlocation.path, tap, test["expected_events"]) + + +sys.exit(0 if tap.is_successful else 1)