Use compiler-agnostic defines to silence warning
[lttng-tools.git] / tests / regression / tools / clear / test_live_hang.py
CommitLineData
6a96f8df
KS
1#!/usr/bin/env python3
2#
3# Copyright (C) 2024 Kienan Stewart <kstewart@efficios.com>
4# SPDX-License-Identifier: GPL-2.0-only
5#
6
7"""
8Test for https://review.lttng.org/c/lttng-tools/+/11819
9
10A live client shouldn't hang around after a session with no data has
11been destroyed
12"""
13
14import pathlib
15import socket
16import subprocess
17import sys
6a96f8df
KS
18
19# Import in-tree test utils
20test_utils_import_path = pathlib.Path(__file__).absolute().parents[3] / "utils"
21sys.path.append(str(test_utils_import_path))
22
23import lttngtest
24import bt2
25
26tap = lttngtest.TapGenerator(1)
27
28
29def test_live_hang(tap, test_env):
30 client = lttngtest.LTTngClient(test_env, log=tap.diagnostic)
31
32 # lttng create --live
33 output = lttngtest.NetworkSessionOutputLocation(
34 "net://localhost:{}:{}/".format(
35 test_env.lttng_relayd_control_port, test_env.lttng_relayd_data_port
36 )
37 )
38 session = client.create_session(output=output, live=True)
39
40 # lttng enable-event --userspace --all
41 channel = session.add_channel(lttngtest.lttngctl.TracingDomain.User)
42 channel.add_recording_rule(lttngtest.lttngctl.UserTracepointEventRule())
43
44 session.start()
45 test_app = test_env.launch_wait_trace_test_application(100)
46 session.stop()
47 session.clear()
48
c3200502
KS
49 viewer = test_env.launch_live_viewer(session.name)
50 viewer.wait_until_connected()
6a96f8df
KS
51
52 session.destroy()
53
c3200502 54 viewer.wait()
6a96f8df 55 tap.test(
c3200502
KS
56 True,
57 "BT2 live viewer exited successfully",
6a96f8df 58 )
6a96f8df
KS
59
60
61with lttngtest.test_environment(
62 with_sessiond=True, log=tap.diagnostic, with_relayd=True
63) as test_env:
64 test_live_hang(tap, test_env)
65
66sys.exit(0 if tap.is_successful else 1)
This page took 0.032541 seconds and 5 git commands to generate.