blob: 1e3a21afc2ccc0a9828cfa31cfb5f74c74b97eb3 [file] [log] [blame]
#!/usr/bin/env python
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import cStringIO
import logging
import os
import sys
import textwrap
import unittest
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, ROOT_DIR)
import reduce_debugline
class ReduceDebuglineTest(unittest.TestCase):
_DECODED_DEBUGLINE = textwrap.dedent("""\
Decoded dump of debug contents of section .debug_line:
CU: ../../chrome/service/
File name Line number Starting address 21 0xa41210 24 0xa4141f 30 0xa4142b 31 0xa4143e
message_loop.h 550 0xa41300
message_loop.h 551 0xa41310
logging.h 246 0xa41710
logging.h 247 0xa41726
logging.h 846 0xa3fd90
logging.h 846 0xa3fda0
(0xa3fd90, '../../base/logging.h'),
(0xa41210, '../../chrome/service/'),
(0xa41300, '../../base/message_loop.h'),
(0xa4141f, '../../chrome/service/'),
(0xa41710, '../../base/logging.h'),
def test(self):
ranges_dict = reduce_debugline.reduce_decoded_debugline(
self.assertEqual(self._EXPECTED_REDUCED_DEBUGLINE, ranges_dict)
if __name__ == '__main__':
level=logging.DEBUG if '-v' in sys.argv else logging.ERROR,
format='%(levelname)5s %(filename)15s(%(lineno)3d): %(message)s')