tfiala created this revision. tfiala added a reviewer: labath. tfiala added a subscriber: lldb-commits.
Ensure all uses of a test filename in the test event infrastructure normalize the test filename to end in the ".py" extension. Something here changed recently such that normal code paths through a test run are producing ".pyc" instead of ".py". This caused places that need to generate the filename to differ - e.g. when a timeout or exceptional exit occurs, because those are using the straight-up .py file. This, ultimately, led to test infrastructure having multiple results for the same test when a test timed out or had an exceptional exit. This, in turn, caused a test run to fail when a rerun would normally have cleared the failure. This wreaked havoc on the Swift CI after I took a recent merge from LLVM.org. This change is now up there and, combined with D19214, addressed all the book-keeping issues we were hitting. I'm now bringing these back to the LLDB svn repo. The change itself is simple and just ensures all uses of the test filename change any names ending in .pyc to .py. http://reviews.llvm.org/D19215 Files: packages/Python/lldbsuite/test/result_formatter.py Index: packages/Python/lldbsuite/test/result_formatter.py =================================================================== --- packages/Python/lldbsuite/test/result_formatter.py +++ packages/Python/lldbsuite/test/result_formatter.py @@ -64,7 +64,7 @@ def create_socket(port): """Creates a socket to the localhost on the given port. - @param port the port number of the listenering port on + @param port the port number of the listening port on the localhost. @return (socket object, socket closing function) @@ -231,6 +231,14 @@ return event @staticmethod + def _normalize_test_filename(test_filename): + # Convert .pyc ending to .py. + if test_filename is not None and test_filename.endswith(".pyc"): + return test_filename[0:-1] + else: + return test_filename + + @staticmethod def _event_dictionary_common(test, event_type): """Returns an event dictionary setup with values for the given event type. @@ -245,9 +253,9 @@ # Determine the filename for the test case. If there is an attribute # for it, use it. Otherwise, determine from the TestCase class path. if hasattr(test, "test_filename"): - test_filename = test.test_filename + test_filename = EventBuilder._normalize_test_filename(test.test_filename) else: - test_filename = inspect.getsourcefile(test.__class__) + test_filename = EventBuilder._normalize_test_filename(inspect.getfile(test.__class__)) event = EventBuilder.bare_event(event_type) event.update({ @@ -486,7 +494,7 @@ if exception_description is not None: event["exception_description"] = exception_description if test_filename is not None: - event["test_filename"] = test_filename + event["test_filename"] = EventBuilder._normalize_test_filename(test_filename) if command_line is not None: event["command_line"] = command_line return event @@ -510,7 +518,7 @@ if worker_index is not None: event["worker_index"] = int(worker_index) if test_filename is not None: - event["test_filename"] = test_filename + event["test_filename"] = EventBuilder._normalize_test_filename(test_filename) if command_line is not None: event["command_line"] = command_line return event
Index: packages/Python/lldbsuite/test/result_formatter.py =================================================================== --- packages/Python/lldbsuite/test/result_formatter.py +++ packages/Python/lldbsuite/test/result_formatter.py @@ -64,7 +64,7 @@ def create_socket(port): """Creates a socket to the localhost on the given port. - @param port the port number of the listenering port on + @param port the port number of the listening port on the localhost. @return (socket object, socket closing function) @@ -231,6 +231,14 @@ return event @staticmethod + def _normalize_test_filename(test_filename): + # Convert .pyc ending to .py. + if test_filename is not None and test_filename.endswith(".pyc"): + return test_filename[0:-1] + else: + return test_filename + + @staticmethod def _event_dictionary_common(test, event_type): """Returns an event dictionary setup with values for the given event type. @@ -245,9 +253,9 @@ # Determine the filename for the test case. If there is an attribute # for it, use it. Otherwise, determine from the TestCase class path. if hasattr(test, "test_filename"): - test_filename = test.test_filename + test_filename = EventBuilder._normalize_test_filename(test.test_filename) else: - test_filename = inspect.getsourcefile(test.__class__) + test_filename = EventBuilder._normalize_test_filename(inspect.getfile(test.__class__)) event = EventBuilder.bare_event(event_type) event.update({ @@ -486,7 +494,7 @@ if exception_description is not None: event["exception_description"] = exception_description if test_filename is not None: - event["test_filename"] = test_filename + event["test_filename"] = EventBuilder._normalize_test_filename(test_filename) if command_line is not None: event["command_line"] = command_line return event @@ -510,7 +518,7 @@ if worker_index is not None: event["worker_index"] = int(worker_index) if test_filename is not None: - event["test_filename"] = test_filename + event["test_filename"] = EventBuilder._normalize_test_filename(test_filename) if command_line is not None: event["command_line"] = command_line return event
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits