]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/expression_command/ir-interpreter-phi-nodes/TestIRInterpreterPHINodes.py
Vendor import of lldb trunk r290819:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / expression_command / ir-interpreter-phi-nodes / TestIRInterpreterPHINodes.py
1 """
2 Test PHI nodes work in the IR interpreter.
3 """
4
5 import os
6 import os.path
7
8 import lldb
9 from lldbsuite.test.lldbtest import *
10 import lldbsuite.test.lldbutil as lldbutil
11
12
13 class IRInterpreterPHINodesTestCase(TestBase):
14     mydir = TestBase.compute_mydir(__file__)
15
16     def test_phi_node_support(self):
17         """Test support for PHI nodes in the IR interpreter."""
18
19         self.build()
20         exe = os.path.join(os.getcwd(), 'a.out')
21         self.runCmd('file ' + exe, CURRENT_EXECUTABLE_SET)
22
23         # Break on the first assignment to i
24         line = line_number('main.cpp', 'i = 5')
25         lldbutil.run_break_set_by_file_and_line(
26             self, 'main.cpp', line, num_expected_locations=1, loc_exact=True)
27
28         self.runCmd('run', RUN_SUCCEEDED)
29
30         # The stop reason of the thread should be breakpoint
31         self.expect('thread list', STOPPED_DUE_TO_BREAKPOINT,
32                     substrs=['stopped', 'stop reason = breakpoint'])
33
34         self.runCmd('s')
35
36         # The logical 'or' causes a PHI node to be generated. Execute without JIT
37         # to test that the interpreter can handle this
38         self.expect('expr -j 0 -- i == 3 || i == 5', substrs=['true'])
39
40         self.runCmd('s')
41         self.expect('expr -j 0 -- i == 3 || i == 5', substrs=['false'])
42         self.runCmd('s')
43         self.expect('expr -j 0 -- i == 3 || i == 5', substrs=['true'])