]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/lang/c/const_variables/TestConstVariables.py
Vendor import of lldb trunk r256945:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / lang / c / const_variables / TestConstVariables.py
1 """Check that compiler-generated constant values work correctly"""
2
3 from __future__ import print_function
4
5
6
7 import os, time
8 import lldb
9 from lldbsuite.test.lldbtest import *
10 import lldbsuite.test.lldbutil as lldbutil
11
12 class ConstVariableTestCase(TestBase):
13
14     mydir = TestBase.compute_mydir(__file__)
15
16     @expectedFailureAll(
17         oslist=["freebsd", "linux"],
18         compiler="clang", compiler_version=["<", "3.5"])
19     @expectedFailureAll(
20         oslist=["freebsd", "linux"],
21         compiler="clang", compiler_version=["=", "3.7"])
22     @expectedFailureAll(
23         oslist=["freebsd", "linux"],
24         compiler="clang", compiler_version=["=", "3.8"])
25     @expectedFailureAll(oslist=["freebsd", "linux"], compiler="icc")
26     @expectedFailureAll(archs=['mips', 'mipsel', 'mips64', 'mips64el'])
27     @expectedFailureWindows("llvm.org/pr24489: Name lookup not working correctly on Windows")
28     @expectedFailureWindows("llvm.org/pr24490: We shouldn't be using platform-specific names like `getpid` in tests")
29     def test_and_run_command(self):
30         """Test interpreted and JITted expressions on constant values."""
31         self.build()
32         exe = os.path.join(os.getcwd(), "a.out")
33         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
34
35         # Break inside the main.
36         lldbutil.run_break_set_by_symbol (self, "main", num_expected_locations=1)
37
38         self.runCmd("run", RUN_SUCCEEDED)
39
40         # The stop reason of the thread should be breakpoint.
41         self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
42             substrs = ['stopped',
43                        'stop reason = breakpoint'])
44
45         # The breakpoint should have a hit count of 1.
46         self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
47             substrs = [' resolved, hit count = 1'])
48
49         self.runCmd("next")
50         self.runCmd("next")
51
52         # Try frame variable.
53         self.expect("frame variable index", VARIABLES_DISPLAYED_CORRECTLY,
54             substrs = ['(int32_t) index = 512'])
55
56         # Try an interpreted expression.
57         self.expect("expr (index + 512)", VARIABLES_DISPLAYED_CORRECTLY,
58             substrs = ['1024'])
59
60         # Try a JITted expression.
61         self.expect("expr (int)getpid(); (index - 256)", VARIABLES_DISPLAYED_CORRECTLY,
62             substrs = ['256'])
63
64         self.runCmd("kill")