diff options
| author | Enrico Granata <egranata@apple.com> | 2014-11-05 21:31:57 +0000 |
|---|---|---|
| committer | Enrico Granata <egranata@apple.com> | 2014-11-05 21:31:57 +0000 |
| commit | ab0e83148523ee21f0c0c9e79436ba6244310609 (patch) | |
| tree | c78d8344709c59bfe093bc55e40118e565cd67b5 | |
| parent | a7202bdbedae69cd5feade4631eb61914c79e5fa (diff) | |
| download | bcm5719-llvm-ab0e83148523ee21f0c0c9e79436ba6244310609.tar.gz bcm5719-llvm-ab0e83148523ee21f0c0c9e79436ba6244310609.zip | |
Allow inline test case to register actually useful teardown hooks by allowing a hook to be passed back the test instance, were it not to be already bound to self. Use this ability to make the reversal of escape-non-printables a teardown hook for added reliability of the testing logic
llvm-svn: 221402
| -rw-r--r-- | lldb/test/functionalities/data-formatter/stringprinter/main.cpp | 4 | ||||
| -rw-r--r-- | lldb/test/lldbinline.py | 3 | ||||
| -rw-r--r-- | lldb/test/lldbtest.py | 11 |
3 files changed, 13 insertions, 5 deletions
diff --git a/lldb/test/functionalities/data-formatter/stringprinter/main.cpp b/lldb/test/functionalities/data-formatter/stringprinter/main.cpp index fc04ed538d6..e30e8fb37f9 100644 --- a/lldb/test/functionalities/data-formatter/stringprinter/main.cpp +++ b/lldb/test/functionalities/data-formatter/stringprinter/main.cpp @@ -11,13 +11,11 @@ int main (int argc, char const *argv[]) { - std::string stdstring("Hello\t\tWorld\nI am here\t\tto say hello\n"); + std::string stdstring("Hello\t\tWorld\nI am here\t\tto say hello\n"); //%self.addTearDownHook(lambda x: x.runCmd("setting set escape-non-printables true")) const char* constcharstar = stdstring.c_str(); return 0; //% self.assertTrue(self.frame().FindVariable('stdstring').GetSummary() == '"Hello\\t\\tWorld\\nI am here\\t\\tto say hello\\n"') //% self.assertTrue(self.frame().FindVariable('constcharstar').GetSummary() == '"Hello\\t\\tWorld\\nI am here\\t\\tto say hello\\n"') //% self.runCmd("setting set escape-non-printables false") - //% print self.frame().FindVariable('stdstring').GetSummary() //% self.assertTrue(self.frame().FindVariable('stdstring').GetSummary() == '"Hello\t\tWorld\nI am here\t\tto say hello\n"') //% self.assertTrue(self.frame().FindVariable('constcharstar').GetSummary() == '"Hello\t\tWorld\nI am here\t\tto say hello\n"') - //% self.runCmd("setting set escape-non-printables true") } diff --git a/lldb/test/lldbinline.py b/lldb/test/lldbinline.py index c8209f72e3a..868b695eadf 100644 --- a/lldb/test/lldbinline.py +++ b/lldb/test/lldbinline.py @@ -187,5 +187,6 @@ def MakeInlineTest(__file, __globals, decorators=None): # Add the test case to the globals, and hide InlineTest __globals.update({test_name : test}) - + + return test diff --git a/lldb/test/lldbtest.py b/lldb/test/lldbtest.py index c19dfc78541..318b4e02491 100644 --- a/lldb/test/lldbtest.py +++ b/lldb/test/lldbtest.py @@ -999,6 +999,8 @@ class Base(unittest2.TestCase): with recording(self, traceAlways) as sbuf: print >> sbuf, "Adding tearDown hook:", getsource_if_available(hook) self.hooks.append(hook) + + return self def deletePexpectChild(self): # This is for the case of directly spawning 'lldb' and interacting with it @@ -1033,7 +1035,14 @@ class Base(unittest2.TestCase): for hook in reversed(self.hooks): with recording(self, traceAlways) as sbuf: print >> sbuf, "Executing tearDown hook:", getsource_if_available(hook) - hook() + import inspect + hook_argc = len(inspect.getargspec(hook).args) + if hook_argc == 0: + hook() + elif hook_argc == 1: + hook(self) + else: + hook() # try the plain call and hope it works del self.hooks |

