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