From 6bbdecc5cf8096148df4726245f3bc60e464c76b Mon Sep 17 00:00:00 2001 From: Raphael Isemann Date: Fri, 6 Mar 2020 18:42:20 -0800 Subject: [PATCH] [lldb][NFC] Make TestStats.py not an inline test There is still the bug that empty lines seem to skip any following expressions and it makes it harder to commend between all the comments. Let's make this a normal test instead which is just slightly more verbose but can be properly formatted. --- lldb/test/API/commands/statistics/basic/Makefile | 2 ++ .../API/commands/statistics/basic/TestStats.py | 35 +++++++++++++++++++--- lldb/test/API/commands/statistics/basic/main.c | 13 +------- 3 files changed, 34 insertions(+), 16 deletions(-) create mode 100644 lldb/test/API/commands/statistics/basic/Makefile diff --git a/lldb/test/API/commands/statistics/basic/Makefile b/lldb/test/API/commands/statistics/basic/Makefile new file mode 100644 index 0000000..c9319d6 --- /dev/null +++ b/lldb/test/API/commands/statistics/basic/Makefile @@ -0,0 +1,2 @@ +C_SOURCES := main.c +include Makefile.rules diff --git a/lldb/test/API/commands/statistics/basic/TestStats.py b/lldb/test/API/commands/statistics/basic/TestStats.py index 9f5c717..4809adf 100644 --- a/lldb/test/API/commands/statistics/basic/TestStats.py +++ b/lldb/test/API/commands/statistics/basic/TestStats.py @@ -1,5 +1,32 @@ -from lldbsuite.test import lldbinline -from lldbsuite.test import decorators +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil -lldbinline.MakeInlineTest( - __file__, globals(), [decorators.no_debug_info_test]) +class TestCase(TestBase): + + mydir = TestBase.compute_mydir(__file__) + + def test(self): + self.build() + lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.c")) + + self.expect("statistics disable", substrs=['need to enable statistics before disabling'], error=True) + + # 'expression' should change the statistics. + self.expect("statistics enable") + self.expect("statistics enable", substrs=['already enabled'], error=True) + self.expect("expr patatino", substrs=['27']) + self.expect("statistics disable") + self.expect("statistics dump", substrs=['expr evaluation successes : 1', + 'expr evaluation failures : 0']) + + # 'frame var' with disabled statistics shouldn't change stats. + self.expect("frame var", substrs=['27']) + + self.expect("statistics enable") + # 'frame var' with enabled statistics will change stats. + self.expect("frame var", substrs=['27']) + self.expect("statistics disable") + self.expect("statistics dump", substrs=['frame var successes : 1', + 'frame var failures : 0']) diff --git a/lldb/test/API/commands/statistics/basic/main.c b/lldb/test/API/commands/statistics/basic/main.c index 9adb3a0..2c5b4f5 100644 --- a/lldb/test/API/commands/statistics/basic/main.c +++ b/lldb/test/API/commands/statistics/basic/main.c @@ -2,17 +2,6 @@ int main(void) { int patatino = 27; - //%self.expect("statistics disable", substrs=['need to enable statistics before disabling'], error=True) - //%self.expect("statistics enable") - //%self.expect("statistics enable", substrs=['already enabled'], error=True) - //%self.expect("expr patatino", substrs=['27']) - //%self.expect("statistics disable") - //%self.expect("statistics dump", substrs=['expr evaluation successes : 1', 'expr evaluation failures : 0']) - //%self.expect("frame var", substrs=['27']) - //%self.expect("statistics enable") - //%self.expect("frame var", substrs=['27']) - //%self.expect("statistics disable") - //%self.expect("statistics dump", substrs=['frame var successes : 1', 'frame var failures : 0']) - return 0; + return 0; // break here } -- 2.7.4