[CI][Github] Do not fail premerge job
[llvm-project.git] / lldb / test / API / functionalities / non-overlapping-index-variable-i / TestIndexVariable.py
blob4efd3b72b44c20ce9f3e0e8cbd2cd2d9fb97f0dd
1 """Test evaluating expressions which ref. index variable 'i' which just goes
2 from out of scope to in scope when stopped at the breakpoint."""
5 import lldb
6 from lldbsuite.test.lldbtest import *
7 import lldbsuite.test.lldbutil as lldbutil
10 class NonOverlappingIndexVariableCase(TestBase):
11 def setUp(self):
12 TestBase.setUp(self)
13 self.source = "main.cpp"
14 self.line_to_break = line_number(self.source, "// Set breakpoint here.")
16 # rdar://problem/9890530
17 def test_eval_index_variable(self):
18 """Test expressions of variable 'i' which appears in two for loops."""
19 self.build()
20 self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
22 lldbutil.run_break_set_by_file_and_line(
23 self,
24 self.source,
25 self.line_to_break,
26 num_expected_locations=1,
27 loc_exact=True,
30 self.runCmd("run", RUN_SUCCEEDED)
32 # The stop reason of the thread should be breakpoint.
33 self.expect(
34 "thread list",
35 STOPPED_DUE_TO_BREAKPOINT,
36 substrs=["stopped", "stop reason = breakpoint"],
39 self.runCmd("frame variable i")
40 self.runCmd("expr i")
41 self.runCmd("expr ptr[0]->point.x")
42 self.runCmd("expr ptr[0]->point.y")
43 self.runCmd("expr ptr[i]->point.x")
44 self.runCmd("expr ptr[i]->point.y")