brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · 2047a8f Raw
69 lines · python
1"""2Tests that frame variable and expr work for3C++ unions and their static data members.4"""5import lldb6from lldbsuite.test.lldbtest import *7from lldbsuite.test.decorators import *8import lldbsuite.test.lldbutil as lldbutil9 10 11class CppUnionStaticMembersTestCase(TestBase):12    def test_print_union(self):13        """Tests that frame variable and expr work14        for union with static data members"""15        self.build()16 17        (target, process, main_thread, _) = lldbutil.run_to_source_breakpoint(18            self, "return 0", lldb.SBFileSpec("main.cpp")19        )20 21        self.expect("frame variable foo", substrs=["val = 42"])22        self.expect("frame variable bar", substrs=["val = 137"])23 24        self.expect_expr(25            "foo",26            result_type="Foo",27            result_children=[ValueCheck(name="val", value="42")],28        )29        self.expect_expr(30            "bar",31            result_type="Bar",32            result_children=[ValueCheck(name="val", value="137")],33        )34 35    @expectedFailureWindows36    def test_expr_union_static_members(self):37        """Tests that frame variable and expr work38        for union static data members"""39        self.build()40 41        (target, process, main_thread, _) = lldbutil.run_to_source_breakpoint(42            self, "return 0", lldb.SBFileSpec("main.cpp")43        )44 45        self.expect_expr("Foo::sVal1", result_type="const int", result_value="-42")46        self.expect_expr(47            "Foo::sVal2",48            result_type="Foo",49            result_children=[ValueCheck(name="val", value="42")],50        )51 52    @expectedFailureWindows53    def test_union_in_anon_namespace(self):54        """Tests that frame variable and expr work55        for union static data members in anonymous56        namespaces"""57        self.build()58 59        (target, process, main_thread, _) = lldbutil.run_to_source_breakpoint(60            self, "return 0", lldb.SBFileSpec("main.cpp")61        )62 63        self.expect_expr("Bar::sVal1", result_type="const int", result_value="-137")64        self.expect_expr(65            "Bar::sVal2",66            result_type="Bar",67            result_children=[ValueCheck(name="val", value="137")],68        )69