| 1 | # |
| 2 | # Copyright (C) 2019 EfficiOS Inc. |
| 3 | # |
| 4 | # This program is free software; you can redistribute it and/or |
| 5 | # modify it under the terms of the GNU General Public License |
| 6 | # as published by the Free Software Foundation; only version 2 |
| 7 | # of the License. |
| 8 | # |
| 9 | # This program is distributed in the hope that it will be useful, |
| 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | # GNU General Public License for more details. |
| 13 | # |
| 14 | # You should have received a copy of the GNU General Public License |
| 15 | # along with this program; if not, write to the Free Software |
| 16 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 17 | # |
| 18 | |
| 19 | import unittest |
| 20 | import os.path |
| 21 | import bt2 |
| 22 | import os |
| 23 | |
| 24 | |
| 25 | @unittest.skip('depends on Python bindings, which are broken') |
| 26 | class LttngUtilsDebugInfoTestCase(unittest.TestCase): |
| 27 | def test_debug_info(self): |
| 28 | debug_info_data_path = os.environ['BT_DEBUG_INFO_PATH'] |
| 29 | trace_path = os.path.join(debug_info_data_path, 'trace') |
| 30 | target_prefix = os.path.join(debug_info_data_path, '..', '..') |
| 31 | src = bt2.ComponentSpec('ctf', 'fs', trace_path) |
| 32 | flt = bt2.ComponentSpec('lttng-utils', 'debug-info', { |
| 33 | 'target-prefix': target_prefix, |
| 34 | }) |
| 35 | it = bt2.TraceCollectionNotificationIterator(src, flt, |
| 36 | [bt2.EventNotification]) |
| 37 | notifs = list(it) |
| 38 | debug_info = notifs[2].event['debug_info'] |
| 39 | self.assertEqual(debug_info['bin'], 'libhello_so+0x14d4') |
| 40 | self.assertEqual(debug_info['func'], 'foo+0xa9') |
| 41 | self.assertEqual(debug_info['src'], 'libhello.c:7') |
| 42 | debug_info = notifs[3].event['debug_info'] |
| 43 | self.assertEqual(debug_info['bin'], 'libhello_so+0x15a6') |
| 44 | self.assertEqual(debug_info['func'], 'bar+0xa9') |
| 45 | self.assertEqual(debug_info['src'], 'libhello.c:13') |