Commit | Line | Data |
---|---|---|
0235b0db | 1 | # SPDX-License-Identifier: GPL-2.0-only |
493917ba | 2 | # |
0235b0db | 3 | # Copyright (C) 2019 Simon Marchi <simon.marchi@efficios.com> |
493917ba | 4 | # |
493917ba | 5 | |
493917ba | 6 | import os |
5995b304 | 7 | import unittest |
493917ba | 8 | |
5995b304 | 9 | import bt2 |
c5d4db7a | 10 | from test_all_ctf_versions import test_all_ctf_versions |
493917ba SM |
11 | |
12 | ||
c5d4db7a | 13 | @test_all_ctf_versions |
493917ba SM |
14 | class QuerySupportInfoTestCase(unittest.TestCase): |
15 | def test_support_info_with_uuid(self): | |
16 | # Test that the right group is reported for each trace. | |
c5d4db7a SM |
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 | ) | |
493917ba SM |
73 | |
74 | def do_one_query(input, expected_group): | |
75 | qe = bt2.QueryExecutor( | |
f5567ea8 | 76 | fs, "babeltrace.support-info", {"input": input, "type": "directory"} |
493917ba SM |
77 | ) |
78 | ||
79 | result = qe.query() | |
f5567ea8 | 80 | self.assertEqual(result["group"], expected_group) |
493917ba | 81 | |
f5567ea8 FD |
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") | |
493917ba SM |
88 | |
89 | ||
f5567ea8 | 90 | if __name__ == "__main__": |
493917ba | 91 | unittest.main() |