| 1 | # Copyright (C) 2019 Simon Marchi <simon.marchi@efficios.com> |
| 2 | # |
| 3 | # This program is free software; you can redistribute it and/or |
| 4 | # modify it under the terms of the GNU General Public License |
| 5 | # as published by the Free Software Foundation; only version 2 |
| 6 | # of the License. |
| 7 | # |
| 8 | # This program is distributed in the hope that it will be useful, |
| 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | # GNU General Public License for more details. |
| 12 | # |
| 13 | # You should have received a copy of the GNU General Public License |
| 14 | # along with this program; if not, write to the Free Software |
| 15 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 16 | |
| 17 | import unittest |
| 18 | import bt2 |
| 19 | import os |
| 20 | |
| 21 | |
| 22 | session_rotation_trace_path = os.path.join( |
| 23 | os.environ['BT_CTF_TRACES_PATH'], 'succeed', 'session-rotation' |
| 24 | ) |
| 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 | |
| 75 | class QuerySupportInfoTestCase(unittest.TestCase): |
| 76 | def test_support_info_with_uuid(self): |
| 77 | # Test that the right group is reported for each trace. |
| 78 | |
| 79 | def do_one_query(input, expected_group): |
| 80 | qe = bt2.QueryExecutor( |
| 81 | fs, 'babeltrace.support-info', {'input': input, 'type': 'directory'} |
| 82 | ) |
| 83 | |
| 84 | result = qe.query() |
| 85 | self.assertEqual(result['group'], expected_group) |
| 86 | |
| 87 | ctf = bt2.find_plugin('ctf') |
| 88 | fs = ctf.source_component_classes['fs'] |
| 89 | |
| 90 | do_one_query(trace_10352_1, '21cdfa5e-9a64-490a-832c-53aca6c101ba') |
| 91 | do_one_query(trace_10352_2, '21cdfa5e-9a64-490a-832c-53aca6c101ba') |
| 92 | do_one_query(trace_10352_3, '21cdfa5e-9a64-490a-832c-53aca6c101ba') |
| 93 | do_one_query(trace_10353_1, '83656eb1-b131-40e7-9666-c04ae279b58c') |
| 94 | do_one_query(trace_10353_2, '83656eb1-b131-40e7-9666-c04ae279b58c') |
| 95 | do_one_query(trace_10353_3, '83656eb1-b131-40e7-9666-c04ae279b58c') |
| 96 | |
| 97 | |
| 98 | if __name__ == '__main__': |
| 99 | unittest.main() |