]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/macosx/order/TestOrderFile.py
Vendor import of lldb release_39 branch r276489:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / macosx / order / TestOrderFile.py
1 """
2 Test that debug symbols have the correct order as specified by the order file.
3 """
4
5 from __future__ import print_function
6
7
8
9 import os, time
10 import re
11 import lldb
12 from lldbsuite.test.decorators import *
13 from lldbsuite.test.lldbtest import *
14 from lldbsuite.test import lldbutil
15
16 class OrderFileTestCase(TestBase):
17
18     mydir = TestBase.compute_mydir(__file__)
19
20     @skipUnlessDarwin
21     def test(self):
22         """Test debug symbols follow the correct order by the order file."""
23         self.build()
24         exe = os.path.join(os.getcwd(), "a.out")
25         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
26
27         # Test that the debug symbols have Function f3 before Function f1.
28         # Use "-s address" option to sort by address.
29         self.runCmd("image dump symtab -s address a.out")
30         output = self.res.GetOutput()
31         mo_f3 = re.search("Code +.+f3", output)
32         mo_f1 = re.search("Code +.+f1", output)
33         
34         # Match objects for f3 and f1 must exist and f3 must come before f1.
35         self.assertTrue(mo_f3 and mo_f1 and mo_f3.start() < mo_f1.start(),
36                         "Symbols have correct order by the order file")
37
38         self.runCmd("run", RUN_COMPLETED)