brintos

brintos / llvm-project-archived public Read only

0
0
Text · 968 B · 41ba481 Raw
35 lines · python
1"""2Test TestBase test functions.3"""4 5import io6 7from lldbsuite.test.lldbtest import *8from lldbsuite.test_event import build_exception9 10 11class TestBuildMethod(Base):12    def setUp(self):13        super().setUp()14        self._traces = []15        self.traceAlways = True16 17    # override the parent trace method18    def trace(self, *args, **kwargs):19        buf = io.StringIO()20        print(*args, file=buf, **kwargs)21        self._traces.append(buf.getvalue())22 23    def test_build_fails_helpfully(self):24        try:25            self.build(dictionary={"CXX_SOURCES": "nonexisting-file.cpp"})26        except build_exception.BuildError as e:27            self.assertIn("nonexisting-file.cpp", str(e))28        else:29            self.fail("BuildError not raised!")30 31    def test_build_logs_traces(self):32        self.build(dictionary={"CXX_SOURCES": "return0.cpp"})33        self.assertIn("CXX_SOURCES", self._traces[0])34        self.assertIn("return0.o", self._traces[1])35