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