| 1 | # SPDX-License-Identifier: GPL-2.0-only |
| 2 | # |
| 3 | # Copyright (C) 2019 Simon Marchi <simon.marchi@efficios.com> |
| 4 | # |
| 5 | |
| 6 | import os |
| 7 | import unittest |
| 8 | |
| 9 | import bt2 |
| 10 | from test_all_ctf_versions import test_all_ctf_versions |
| 11 | |
| 12 | |
| 13 | @test_all_ctf_versions |
| 14 | class QuerySupportInfoTestCase(unittest.TestCase): |
| 15 | def test_support_info_with_uuid(self): |
| 16 | # Test that the right group is reported for each trace. |
| 17 | ctf = bt2.find_plugin("ctf") |
| 18 | fs = ctf.source_component_classes["fs"] |
| 19 | |
| 20 | session_rotation_trace_path = os.path.join( |
| 21 | os.environ["BT_CTF_TRACES_PATH"], |
| 22 | str(self._ctf_version), |
| 23 | "succeed", |
| 24 | "session-rotation", |
| 25 | ) |
| 26 | |
| 27 | trace_10352_1 = os.path.join( |
| 28 | session_rotation_trace_path, |
| 29 | "a", |
| 30 | "1", |
| 31 | "ust", |
| 32 | "pid", |
| 33 | "10352", |
| 34 | ) |
| 35 | trace_10353_1 = os.path.join( |
| 36 | session_rotation_trace_path, |
| 37 | "a", |
| 38 | "1", |
| 39 | "ust", |
| 40 | "pid", |
| 41 | "10353", |
| 42 | ) |
| 43 | trace_10352_2 = os.path.join( |
| 44 | session_rotation_trace_path, |
| 45 | "a", |
| 46 | "2", |
| 47 | "ust", |
| 48 | "pid", |
| 49 | "10352", |
| 50 | ) |
| 51 | trace_10353_2 = os.path.join( |
| 52 | session_rotation_trace_path, |
| 53 | "a", |
| 54 | "2", |
| 55 | "ust", |
| 56 | "pid", |
| 57 | "10353", |
| 58 | ) |
| 59 | trace_10352_3 = os.path.join( |
| 60 | session_rotation_trace_path, |
| 61 | "3", |
| 62 | "ust", |
| 63 | "pid", |
| 64 | "10352", |
| 65 | ) |
| 66 | trace_10353_3 = os.path.join( |
| 67 | session_rotation_trace_path, |
| 68 | "3", |
| 69 | "ust", |
| 70 | "pid", |
| 71 | "10353", |
| 72 | ) |
| 73 | |
| 74 | def do_one_query(input, expected_group): |
| 75 | qe = bt2.QueryExecutor( |
| 76 | fs, "babeltrace.support-info", {"input": input, "type": "directory"} |
| 77 | ) |
| 78 | |
| 79 | result = qe.query() |
| 80 | self.assertEqual(result["group"], expected_group) |
| 81 | |
| 82 | do_one_query(trace_10352_1, "21cdfa5e-9a64-490a-832c-53aca6c101ba") |
| 83 | do_one_query(trace_10352_2, "21cdfa5e-9a64-490a-832c-53aca6c101ba") |
| 84 | do_one_query(trace_10352_3, "21cdfa5e-9a64-490a-832c-53aca6c101ba") |
| 85 | do_one_query(trace_10353_1, "83656eb1-b131-40e7-9666-c04ae279b58c") |
| 86 | do_one_query(trace_10353_2, "83656eb1-b131-40e7-9666-c04ae279b58c") |
| 87 | do_one_query(trace_10353_3, "83656eb1-b131-40e7-9666-c04ae279b58c") |
| 88 | |
| 89 | |
| 90 | if __name__ == "__main__": |
| 91 | unittest.main() |