Enrico Granata | 7a242109 | 2015-01-22 19:33:53 +0000 | [diff] [blame] | 1 | """ |
| 2 | Test lldb data formatter subsystem. |
| 3 | """ |
| 4 | |
Zachary Turner | 77db4a8 | 2015-10-22 20:06:20 +0000 | [diff] [blame^] | 5 | import lldb_shared |
| 6 | |
Enrico Granata | 7a242109 | 2015-01-22 19:33:53 +0000 | [diff] [blame] | 7 | import os, time |
Enrico Granata | 7a242109 | 2015-01-22 19:33:53 +0000 | [diff] [blame] | 8 | import lldb |
| 9 | from lldbbench import * |
| 10 | import lldbutil |
| 11 | |
| 12 | class TestBenchmarkContinue(BenchBase): |
| 13 | |
| 14 | mydir = TestBase.compute_mydir(__file__) |
| 15 | |
| 16 | @benchmarks_test |
Tamas Berghammer | c8fd130 | 2015-09-30 10:12:40 +0000 | [diff] [blame] | 17 | def test_run_command(self): |
Enrico Granata | 7a242109 | 2015-01-22 19:33:53 +0000 | [diff] [blame] | 18 | """Benchmark different ways to continue a process""" |
Tamas Berghammer | c8fd130 | 2015-09-30 10:12:40 +0000 | [diff] [blame] | 19 | self.build() |
Enrico Granata | 7a242109 | 2015-01-22 19:33:53 +0000 | [diff] [blame] | 20 | self.data_formatter_commands() |
| 21 | |
| 22 | def setUp(self): |
| 23 | # Call super's setUp(). |
| 24 | BenchBase.setUp(self) |
| 25 | |
| 26 | def data_formatter_commands(self): |
| 27 | """Benchmark different ways to continue a process""" |
| 28 | self.runCmd("file a.out", CURRENT_EXECUTABLE_SET) |
| 29 | |
| 30 | bkpt = self.target().FindBreakpointByID(lldbutil.run_break_set_by_source_regexp (self, "// break here")) |
| 31 | |
Sean Callanan | 05834cd | 2015-07-01 23:56:30 +0000 | [diff] [blame] | 32 | self.runCmd("run", RUN_SUCCEEDED) |
Enrico Granata | 7a242109 | 2015-01-22 19:33:53 +0000 | [diff] [blame] | 33 | |
| 34 | # The stop reason of the thread should be breakpoint. |
| 35 | self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, |
| 36 | substrs = ['stopped', |
| 37 | 'stop reason = breakpoint']) |
| 38 | |
| 39 | # This is the function to remove the custom formats in order to have a |
| 40 | # clean slate for the next test case. |
| 41 | def cleanup(): |
| 42 | self.runCmd('type format clear', check=False) |
| 43 | self.runCmd('type summary clear', check=False) |
| 44 | self.runCmd('type filter clear', check=False) |
| 45 | self.runCmd('type synth clear', check=False) |
| 46 | self.runCmd("settings set target.max-children-count 256", check=False) |
| 47 | |
| 48 | # Execute the cleanup function during test case tear down. |
| 49 | self.addTearDownHook(cleanup) |
| 50 | |
| 51 | runCmd_sw = Stopwatch() |
| 52 | lldbutil_sw = Stopwatch() |
| 53 | |
| 54 | for i in range(0,15): |
| 55 | runCmd_sw.start() |
| 56 | self.runCmd("continue") |
| 57 | runCmd_sw.stop() |
| 58 | |
| 59 | for i in range(0,15): |
| 60 | lldbutil_sw.start() |
| 61 | lldbutil.continue_to_breakpoint(self.process(), bkpt) |
| 62 | lldbutil_sw.stop() |
| 63 | |
| 64 | print "runCmd: %s\nlldbutil: %s" % (runCmd_sw,lldbutil_sw) |