diff options
author | Kate Stone <katherine.stone@apple.com> | 2016-09-06 20:57:50 +0000 |
---|---|---|
committer | Kate Stone <katherine.stone@apple.com> | 2016-09-06 20:57:50 +0000 |
commit | b9c1b51e45b845debb76d8658edabca70ca56079 (patch) | |
tree | dfcb5a13ef2b014202340f47036da383eaee74aa /lldb/packages/Python/lldbsuite/test/test_result.py | |
parent | d5aa73376966339caad04013510626ec2e42c760 (diff) | |
download | bcm5719-llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.gz bcm5719-llvm-b9c1b51e45b845debb76d8658edabca70ca56079.zip |
*** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style. This kind of mass change has
*** two obvious implications:
Firstly, merging this particular commit into a downstream fork may be a huge
effort. Alternatively, it may be worth merging all changes up to this commit,
performing the same reformatting operation locally, and then discarding the
merge for this particular commit. The commands used to accomplish this
reformatting were as follows (with current working directory as the root of
the repository):
find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} +
find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ;
The version of clang-format used was 3.9.0, and autopep8 was 1.2.4.
Secondly, “blame” style tools will generally point to this commit instead of
a meaningful prior commit. There are alternatives available that will attempt
to look through this change and find the appropriate prior commit. YMMV.
llvm-svn: 280751
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/test_result.py')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/test_result.py | 73 |
1 files changed, 50 insertions, 23 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/test_result.py b/lldb/packages/Python/lldbsuite/test/test_result.py index 01db1f69163..327d170f58d 100644 --- a/lldb/packages/Python/lldbsuite/test/test_result.py +++ b/lldb/packages/Python/lldbsuite/test/test_result.py @@ -23,6 +23,7 @@ from . import configuration from lldbsuite.test_event.event_builder import EventBuilder from lldbsuite.test_event import build_exception + class LLDBTestResult(unittest2.TextTestResult): """ Enforce a singleton pattern to allow introspection of test progress. @@ -39,11 +40,15 @@ class LLDBTestResult(unittest2.TextTestResult): def getTerminalSize(): import os env = os.environ + def ioctl_GWINSZ(fd): try: - import fcntl, termios, struct, os + import fcntl + import termios + import struct + import os cr = struct.unpack('hh', fcntl.ioctl(fd, termios.TIOCGWINSZ, - '1234')) + '1234')) except: return return cr @@ -78,15 +83,18 @@ class LLDBTestResult(unittest2.TextTestResult): def _config_string(self, test): compiler = getattr(test, "getCompiler", None) arch = getattr(test, "getArchitecture", None) - return "%s-%s" % (compiler() if compiler else "", arch() if arch else "") + return "%s-%s" % (compiler() if compiler else "", + arch() if arch else "") def _exc_info_to_string(self, err, test): """Overrides superclass TestResult's method in order to append our test config info string to the exception info string.""" if hasattr(test, "getArchitecture") and hasattr(test, "getCompiler"): - return '%sConfig=%s-%s' % (super(LLDBTestResult, self)._exc_info_to_string(err, test), - test.getArchitecture(), - test.getCompiler()) + return '%sConfig=%s-%s' % (super(LLDBTestResult, + self)._exc_info_to_string(err, + test), + test.getArchitecture(), + test.getCompiler()) else: return super(LLDBTestResult, self)._exc_info_to_string(err, test) @@ -103,23 +111,29 @@ class LLDBTestResult(unittest2.TextTestResult): """ test_categories = [] test_method = getattr(test, test._testMethodName) - if test_method != None and hasattr(test_method, "categories"): + if test_method is not None and hasattr(test_method, "categories"): test_categories.extend(test_method.categories) test_categories.extend(test.getCategories()) return test_categories - def hardMarkAsSkipped(self,test): + def hardMarkAsSkipped(self, test): getattr(test, test._testMethodName).__func__.__unittest_skip__ = True - getattr(test, test._testMethodName).__func__.__unittest_skip_why__ = "test case does not fall in any category of interest for this run" + getattr( + test, + test._testMethodName).__func__.__unittest_skip_why__ = "test case does not fall in any category of interest for this run" def startTest(self, test): - if configuration.shouldSkipBecauseOfCategories(self.getCategoriesForTest(test)): + if configuration.shouldSkipBecauseOfCategories( + self.getCategoriesForTest(test)): self.hardMarkAsSkipped(test) - configuration.setCrashInfoHook("%s at %s" % (str(test),inspect.getfile(test.__class__))) + configuration.setCrashInfoHook( + "%s at %s" % + (str(test), inspect.getfile( + test.__class__))) self.counter += 1 - #if self.counter == 4: + # if self.counter == 4: # import crashinfo # crashinfo.testCrashReporterDescription(None) test.test_number = self.counter @@ -133,7 +147,9 @@ class LLDBTestResult(unittest2.TextTestResult): def addSuccess(self, test): super(LLDBTestResult, self).addSuccess(test) if configuration.parsable: - self.stream.write("PASS: LLDB (%s) :: %s\n" % (self._config_string(test), str(test))) + self.stream.write( + "PASS: LLDB (%s) :: %s\n" % + (self._config_string(test), str(test))) if self.results_formatter: self.results_formatter.handle_event( EventBuilder.event_for_success(test)) @@ -150,7 +166,6 @@ class LLDBTestResult(unittest2.TextTestResult): else: return inspect.getsourcefile(test.__class__) - def _saveBuildErrorTuple(self, test, err): # Adjust the error description so it prints the build command and build error # rather than an uninformative Python backtrace. @@ -172,7 +187,9 @@ class LLDBTestResult(unittest2.TextTestResult): if method: method() if configuration.parsable: - self.stream.write("FAIL: LLDB (%s) :: %s\n" % (self._config_string(test), str(test))) + self.stream.write( + "FAIL: LLDB (%s) :: %s\n" % + (self._config_string(test), str(test))) if self.results_formatter: # Handle build errors as a separate event type if self._isBuildError(err): @@ -188,7 +205,9 @@ class LLDBTestResult(unittest2.TextTestResult): if method: method() if configuration.parsable: - self.stream.write("CLEANUP ERROR: LLDB (%s) :: %s\n" % (self._config_string(test), str(test))) + self.stream.write( + "CLEANUP ERROR: LLDB (%s) :: %s\n" % + (self._config_string(test), str(test))) if self.results_formatter: self.results_formatter.handle_event( EventBuilder.event_for_cleanup_error( @@ -201,19 +220,21 @@ class LLDBTestResult(unittest2.TextTestResult): if method: method() if configuration.parsable: - self.stream.write("FAIL: LLDB (%s) :: %s\n" % (self._config_string(test), str(test))) + self.stream.write( + "FAIL: LLDB (%s) :: %s\n" % + (self._config_string(test), str(test))) if configuration.useCategories: test_categories = self.getCategoriesForTest(test) for category in test_categories: if category in configuration.failuresPerCategory: - configuration.failuresPerCategory[category] = configuration.failuresPerCategory[category] + 1 + configuration.failuresPerCategory[ + category] = configuration.failuresPerCategory[category] + 1 else: configuration.failuresPerCategory[category] = 1 if self.results_formatter: self.results_formatter.handle_event( EventBuilder.event_for_failure(test, err)) - def addExpectedFailure(self, test, err, bugnumber): configuration.sdir_has_content = True super(LLDBTestResult, self).addExpectedFailure(test, err, bugnumber) @@ -221,11 +242,13 @@ class LLDBTestResult(unittest2.TextTestResult): if method: method(err, bugnumber) if configuration.parsable: - self.stream.write("XFAIL: LLDB (%s) :: %s\n" % (self._config_string(test), str(test))) + self.stream.write( + "XFAIL: LLDB (%s) :: %s\n" % + (self._config_string(test), str(test))) if self.results_formatter: self.results_formatter.handle_event( EventBuilder.event_for_expected_failure( - test, err, bugnumber)) + test, err, bugnumber)) def addSkip(self, test, reason): configuration.sdir_has_content = True @@ -234,7 +257,9 @@ class LLDBTestResult(unittest2.TextTestResult): if method: method() if configuration.parsable: - self.stream.write("UNSUPPORTED: LLDB (%s) :: %s (%s) \n" % (self._config_string(test), str(test), reason)) + self.stream.write( + "UNSUPPORTED: LLDB (%s) :: %s (%s) \n" % + (self._config_string(test), str(test), reason)) if self.results_formatter: self.results_formatter.handle_event( EventBuilder.event_for_skip(test, reason)) @@ -246,7 +271,9 @@ class LLDBTestResult(unittest2.TextTestResult): if method: method(bugnumber) if configuration.parsable: - self.stream.write("XPASS: LLDB (%s) :: %s\n" % (self._config_string(test), str(test))) + self.stream.write( + "XPASS: LLDB (%s) :: %s\n" % + (self._config_string(test), str(test))) if self.results_formatter: self.results_formatter.handle_event( EventBuilder.event_for_unexpected_success( |