1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
|
# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright (C) 2019 Simon Marchi <simon.marchi@efficios.com>
#
import os
import unittest
import bt2
from test_all_ctf_versions import test_all_ctf_versions
query_object = "babeltrace.support-info"
@test_all_ctf_versions
class QuerySupportInfoTestCase(unittest.TestCase):
def setUp(self):
ctf = bt2.find_plugin("ctf")
assert ctf
self._fs = ctf.source_component_classes["fs"]
def test_non_map_params(self):
with self.assertRaisesRegex(
bt2._Error, "Error validating parameters: top-level is not a map value"
):
bt2.QueryExecutor(self._fs, query_object).query()
def test_support_info_with_uuid(self):
# Test that the right group is reported for each trace.
session_rotation_trace_path = os.path.join(
os.environ["BT_CTF_TRACES_PATH"],
str(self._ctf_version),
"succeed",
"session-rotation",
)
trace_10352_1 = os.path.join(
session_rotation_trace_path,
"a",
"1",
"ust",
"pid",
"10352",
)
trace_10353_1 = os.path.join(
session_rotation_trace_path,
"a",
"1",
"ust",
"pid",
"10353",
)
trace_10352_2 = os.path.join(
session_rotation_trace_path,
"a",
"2",
"ust",
"pid",
"10352",
)
trace_10353_2 = os.path.join(
session_rotation_trace_path,
"a",
"2",
"ust",
"pid",
"10353",
)
trace_10352_3 = os.path.join(
session_rotation_trace_path,
"3",
"ust",
"pid",
"10352",
)
trace_10353_3 = os.path.join(
session_rotation_trace_path,
"3",
"ust",
"pid",
"10353",
)
def do_one_query(input, expected_group):
qe = bt2.QueryExecutor(
self._fs,
query_object,
{"input": input, "type": "directory"},
)
result = qe.query()
self.assertEqual(result["group"], expected_group)
do_one_query(
trace_10352_1,
"namespace: lttng.org,2009, name: , uid: 21cdfa5e-9a64-490a-832c-53aca6c101ba",
)
do_one_query(
trace_10352_2,
"namespace: lttng.org,2009, name: , uid: 21cdfa5e-9a64-490a-832c-53aca6c101ba",
)
do_one_query(
trace_10352_3,
"namespace: lttng.org,2009, name: , uid: 21cdfa5e-9a64-490a-832c-53aca6c101ba",
)
do_one_query(
trace_10353_1,
"namespace: lttng.org,2009, name: , uid: 83656eb1-b131-40e7-9666-c04ae279b58c",
)
do_one_query(
trace_10353_2,
"namespace: lttng.org,2009, name: , uid: 83656eb1-b131-40e7-9666-c04ae279b58c",
)
do_one_query(
trace_10353_3,
"namespace: lttng.org,2009, name: , uid: 83656eb1-b131-40e7-9666-c04ae279b58c",
)
if __name__ == "__main__":
unittest.main()
|