Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / API / lang / c / const_variables / TestConstVariables.py
blob0b75f88682acfd44af7a0d3dcbe9458c085faeb3
1 """Check that compiler-generated constant values work correctly"""
4 import lldb
5 from lldbsuite.test.decorators import *
6 from lldbsuite.test.lldbtest import *
7 from lldbsuite.test import lldbutil
10 class ConstVariableTestCase(TestBase):
11 @expectedFailureAll(oslist=["freebsd", "linux"], compiler="icc")
12 @expectedFailureAll(archs=["mips", "mipsel", "mips64", "mips64el"])
13 @expectedFailureAll(
14 oslist=["windows"],
15 bugnumber="llvm.org/pr24489: Name lookup not working correctly on Windows",
17 def test_and_run_command(self):
18 """Test interpreted and JITted expressions on constant values."""
19 self.build()
20 exe = self.getBuildArtifact("a.out")
21 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
23 # Break inside the main.
24 lldbutil.run_break_set_by_symbol(self, "main", num_expected_locations=1)
26 self.runCmd("run", RUN_SUCCEEDED)
28 # The stop reason of the thread should be breakpoint.
29 self.expect(
30 "thread list",
31 STOPPED_DUE_TO_BREAKPOINT,
32 substrs=["stopped", "stop reason = breakpoint"],
35 # The breakpoint should have a hit count of 1.
36 lldbutil.check_breakpoint(self, bpno=1, expected_hit_count=1)
38 self.runCmd("next")
39 self.runCmd("next")
41 # Try frame variable.
42 self.expect(
43 "frame variable index",
44 VARIABLES_DISPLAYED_CORRECTLY,
45 substrs=["(int32_t) index = 512"],
48 # Try an interpreted expression.
49 self.expect(
50 "expr (index + 512)", VARIABLES_DISPLAYED_CORRECTLY, substrs=["1024"]
53 # Try a JITted expression.
54 self.expect(
55 "expr (int)getpid(); (index - 256)",
56 VARIABLES_DISPLAYED_CORRECTLY,
57 substrs=["256"],
60 self.runCmd("kill")