brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · a4ad4d3 Raw
39 lines · python
1"""2Test that we respect the sysroot when building the std module.3"""4 5from lldbsuite.test.decorators import *6from lldbsuite.test.lldbtest import *7from lldbsuite.test import lldbutil8import os9 10 11class ImportStdModule(TestBase):12    # We only emulate a fake libc++ in this test and don't use the real libc++,13    # but we still add the libc++ category so that this test is only run in14    # test configurations where libc++ is actually supposed to be tested.15    @add_test_categories(["libc++"])16    @skipIf(compiler=no_match("clang"))17    @skipIfRemote  # This test messes with the platform, can't be run remotely.18    def test(self):19        self.build()20 21        sysroot = os.path.join(os.getcwd(), "root")22 23        # Set the sysroot.24        self.runCmd(25            "platform select --sysroot '" + sysroot + "' host", CURRENT_EXECUTABLE_SET26        )27 28        lldbutil.run_to_source_breakpoint(29            self, "// Set break point at this line.", lldb.SBFileSpec("main.cpp")30        )31 32        self.runCmd("settings set target.import-std-module true")33 34        # Call our custom function in our sysroot std module.35        # If this gives us the correct result, then we used the sysroot.36        # We rely on the default argument of -123 to make sure we actually have the C++ module.37        # (We don't have default arguments in the debug information).38        self.expect("expr std::myabs()", substrs=["(int) $0 = 123"])39