2 Test lldb data formatter subsystem.
8 from lldbsuite.test.decorators import *
9 from lldbsuite.test.lldbtest import *
10 from lldbsuite.test import lldbutil
13 class LibcxxOptionalDataFormatterTestCase(TestBase):
15 mydir = TestBase.compute_mydir(__file__)
17 @add_test_categories(["libc++"])
18 ## We are skipping clang version less that 5.0 since this test requires -std=c++17
19 @skipIf(oslist=no_match(["macosx"]), compiler="clang", compiler_version=['<', '5.0'])
20 ## We are skipping gcc version less that 5.1 since this test requires -std=c++17
21 @skipIf(compiler="gcc", compiler_version=['<', '5.1'])
23 def test_with_run_command(self):
24 """Test that that file and class static variables display correctly."""
26 self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
28 bkpt = self.target().FindBreakpointByID(
29 lldbutil.run_break_set_by_source_regexp(
32 self.runCmd("run", RUN_SUCCEEDED)
34 # The stop reason of the thread should be breakpoint.
35 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
37 'stop reason = breakpoint'])
39 self.runCmd( "frame variable has_optional" )
41 output = self.res.GetOutput()
43 ## The variable has_optional tells us if the test program
44 ## detected we have a sufficient libc++ version to support optional
45 ## false means we do not and therefore should skip the test
46 if output.find("(bool) has_optional = false") != -1 :
47 self.skipTest( "Optional not supported" )
49 lldbutil.continue_to_breakpoint(self.process(), bkpt)
51 self.expect("frame variable number_not_engaged",
52 substrs=['Has Value=false'])
54 self.expect("frame variable number_engaged",
55 substrs=['Has Value=true',
59 self.expect("frame var numbers",
60 substrs=['(optional_int_vect) numbers = Has Value=true {',
69 self.expect("frame var ostring",
70 substrs=['(optional_string) ostring = Has Value=true {',