1import lldb
2from lldbsuite.test.decorators import *
3from lldbsuite.test.lldbtest import *
4from lldbsuite.test import lldbutil
5
6
7class CPPAcceleratorTableTestCase(TestBase):
8
9    mydir = TestBase.compute_mydir(__file__)
10
11    @skipUnlessDarwin
12    @skipIf(debug_info=no_match(["dwarf"]))
13    def test(self):
14        """Test that type lookups fail early (performance)"""
15        self.build()
16
17        logfile = self.getBuildArtifact('dwarf.log')
18        if configuration.is_reproducer_replay():
19            logfile = self.getReproducerRemappedPath(logfile)
20
21        self.expect('log enable dwarf lookups -f' + logfile)
22        target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
23            self, 'break here', lldb.SBFileSpec('main.cpp'))
24        # Pick one from the middle of the list to have a high chance
25        # of it not being in the first file looked at.
26        self.expect('frame variable inner_d')
27
28        log = open(logfile, 'r')
29        n = 0
30        for line in log:
31            if re.findall(r'[abcdefg]\.o: FindByNameAndTag\(\)', line):
32                self.assertTrue("d.o" in line)
33                n += 1
34
35        self.assertEqual(n, 1, log)
36