TestUniversal.py revision 4917e102e01da14496df098ebe8fe6c1096f1610
1"""Test aspects of lldb commands on universal binaries."""
2
3import os, time
4import unittest2
5import lldb
6from lldbtest import *
7
8class TestUniversal(TestBase):
9
10    mydir = "macosx/universal"
11
12    @unittest2.expectedFailure
13    def test_process_launch_for_universal(self):
14        """Test process launch of a universal binary."""
15
16        # Note that "testit" is a universal binary.
17        exe = os.path.join(os.getcwd(), "testit")
18
19        # By default, x86_64 is assumed if no architecture is specified.
20        self.expect("file " + exe, CURRENT_EXECUTABLE_SET,
21            startstr = "Current executable set to ",
22            substrs = ["testit' (x86_64)."])
23
24        # Break inside the main.
25        self.expect("breakpoint set -f main.c -l 5", BREAKPOINT_CREATED,
26            startstr = "Breakpoint created: 1: file ='main.c', line = 5, locations = 1")
27
28        # We should be able to launch the x86_64 executable.
29        self.runCmd("run", RUN_STOPPED)
30        self.runCmd("continue")
31
32        # Now specify i386 as the architecture for "testit".
33        self.expect("file " + exe + " -a i386", CURRENT_EXECUTABLE_SET,
34            startstr = "Current executable set to ",
35            substrs = ["testit' (i386)."])
36
37        # Break inside the main.
38        self.expect("breakpoint set -f main.c -l 5", BREAKPOINT_CREATED,
39            startstr = "Breakpoint created: 1: file ='main.c', line = 5, locations = 1")
40
41        # We should be able to launch the i386 executable.
42        # Process launch for i386 architecture currently fails.
43        # rdar://problem/8349784
44        self.runCmd("run", RUN_STOPPED)
45        self.runCmd("continue")
46
47
48if __name__ == '__main__':
49    import atexit
50    lldb.SBDebugger.Initialize()
51    atexit.register(lambda: lldb.SBDebugger.Terminate())
52    unittest2.main()
53