1 """Test lldb's response time for 'frame variable' command."""
3 from __future__ import print_function
9 from lldbsuite.test import configuration
10 from lldbsuite.test import lldbtest_config
11 from lldbsuite.test.decorators import *
12 from lldbsuite.test.lldbbench import *
14 class FrameVariableResponseBench(BenchBase):
16 mydir = TestBase.compute_mydir(__file__)
20 self.exe = lldbtest_config.lldbExec
21 self.break_spec = '-n main'
26 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
27 def test_startup_delay(self):
28 """Test response time for the 'frame variable' command."""
30 self.run_frame_variable_bench(self.exe, self.break_spec, self.count)
31 print("lldb frame variable benchmark:", self.stopwatch)
33 def run_frame_variable_bench(self, exe, break_spec, count):
35 # Set self.child_prompt, which is "(lldb) ".
36 self.child_prompt = '(lldb) '
37 prompt = self.child_prompt
39 # Reset the stopwatchs now.
40 self.stopwatch.reset()
41 for i in range(count):
42 # So that the child gets torn down after the test.
43 self.child = pexpect.spawn('%s %s %s' % (lldbtest_config.lldbExec, self.lldbOption, exe))
46 # Turn on logging for what the child sends back.
48 child.logfile_read = sys.stdout
51 child.sendline('breakpoint set %s' % break_spec)
52 child.expect_exact(prompt)
54 # Run the target and expect it to be stopped due to breakpoint.
55 child.sendline('run') # Aka 'process launch'.
56 child.expect_exact(prompt)
59 # Measure the 'frame variable' response time.
60 child.sendline('frame variable')
61 child.expect_exact(prompt)
63 child.sendline('quit')
65 self.child.expect(pexpect.EOF)
69 # The test is about to end and if we come to here, the child process has
70 # been terminated. Mark it so.