[Lldb-commits] [lldb] r255351 - Add test event marking a test as explicitly eligible for rerun if it is marked flakey.

Todd Fiala via lldb-commits lldb-commits at lists.llvm.org
Fri Dec 11 10:06:47 PST 2015


Author: tfiala
Date: Fri Dec 11 12:06:47 2015
New Revision: 255351

URL: http://llvm.org/viewvc/llvm-project?rev=255351&view=rev
Log:
Add test event marking a test as explicitly eligible for rerun if it is marked flakey.

This will be used in a future change to support rerunning flakey tests
that hit a test result isue in a low-load, single worker test runner phase.

This is implemented as an additive-style event rather than being
evaluated and added to the start_test event because the decorator code
only runs after the start_test event is created and sent.  i.e.
LLDBTestResult.startTest() runs before the test method decorators run.

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
    lldb/trunk/packages/Python/lldbsuite/test/result_formatter.py
    lldb/trunk/packages/Python/lldbsuite/test/test_result.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=255351&r1=255350&r2=255351&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Fri Dec 11 12:06:47 2015
@@ -63,6 +63,8 @@ from . import lldbtest_config
 from . import lldbutil
 from . import test_categories
 
+from .result_formatter import EventBuilder
+
 # dosep.py starts lots and lots of dotest instances
 # This option helps you find if two (or more) dotest instances are using the same
 # directory at the same time
@@ -784,6 +786,12 @@ def expectedFlakey(expected_fn, bugnumbe
         def wrapper(*args, **kwargs):
             from unittest2 import case
             self = args[0]
+            if expected_fn(self):
+                # Send event marking test as explicitly eligible for rerunning.
+                if configuration.results_formatter_object is not None:
+                    # Mark this test as rerunnable.
+                    configuration.results_formatter_object.handle_event(
+                        EventBuilder.event_for_mark_test_rerun_eligible(self))
             try:
                 func(*args, **kwargs)
             # don't retry if the test case is already decorated with xfail or skip

Modified: lldb/trunk/packages/Python/lldbsuite/test/result_formatter.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/result_formatter.py?rev=255351&r1=255350&r2=255351&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/result_formatter.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/result_formatter.py Fri Dec 11 12:06:47 2015
@@ -161,6 +161,7 @@ class EventBuilder(object):
     TYPE_JOB_RESULT = "job_result"
     TYPE_TEST_RESULT = "test_result"
     TYPE_TEST_START = "test_start"
+    TYPE_MARK_TEST_RERUN_ELIGIBLE = "test_eligible_for_rerun"
 
     # Test/Job Status Tags
     STATUS_EXCEPTIONAL_EXIT = "exceptional_exit"
@@ -226,6 +227,7 @@ class EventBuilder(object):
             "test_name": test_name,
             "test_filename": inspect.getfile(test.__class__)
         })
+
         return event
 
     @staticmethod
@@ -486,6 +488,26 @@ class EventBuilder(object):
         return event
 
     @staticmethod
+    def event_for_mark_test_rerun_eligible(test):
+        """Creates an event that indicates the specified test is explicitly
+        eligible for rerun.
+
+        Note there is a mode that will enable test rerun eligibility at the
+        global level.  These markings for explicit rerun eligibility are
+        intended for the mode of running where only explicitly rerunnable
+        tests are rerun upon hitting an issue.
+
+        @param test the TestCase instance to which this pertains.
+
+        @return an event that specifies the given test as being eligible to
+        be rerun.
+        """
+        event = EventBuilder._event_dictionary_common(
+            test,
+            EventBuilder.TYPE_MARK_TEST_RERUN_ELIGIBLE)
+        return event
+
+    @staticmethod
     def add_entries_to_all_events(entries_dict):
         """Specifies a dictionary of entries to add to all test events.
 

Modified: lldb/trunk/packages/Python/lldbsuite/test/test_result.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/test_result.py?rev=255351&r1=255350&r2=255351&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/test_result.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/test_result.py Fri Dec 11 12:06:47 2015
@@ -13,10 +13,6 @@ from __future__ import print_function
 
 # System modules
 import inspect
-import os
-import platform
-import subprocess
-
 
 # Third-party modules
 import unittest2




More information about the lldb-commits mailing list