Title: [184382] trunk/Tools
Revision
184382
Author
[email protected]
Date
2015-05-15 05:22:12 -0700 (Fri, 15 May 2015)

Log Message

User interruption while running of run-webkit-tests should also generate results.html
https://bugs.webkit.org/show_bug.cgi?id=122154

Patch by Ravi Phaneendra Kasibhatla <[email protected]> on 2015-05-15
Reviewed by Csaba Osztrogonác.

Generation of results.html on execution of run-webkit-tests happens only
on completion of entire layout tests run. It should be created even when
the execution has been interrupted - either by user (by pressing Ctrl+C)
or because of other interruptions (like exit-after-n-failures option).

* Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py:
(LayoutTestRunner.run_tests):
* Scripts/webkitpy/layout_tests/controllers/manager.py:
(Manager.run):
* Scripts/webkitpy/layout_tests/models/test_run_results.py:
(TestRunResults.__init__):
* Scripts/webkitpy/layout_tests/run_webkit_tests.py:
(main):
* Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:
(RunTest.test_keyboard_interrupt):
(MainTest.test_exception_handling):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (184381 => 184382)


--- trunk/Tools/ChangeLog	2015-05-15 12:04:35 UTC (rev 184381)
+++ trunk/Tools/ChangeLog	2015-05-15 12:22:12 UTC (rev 184382)
@@ -1,3 +1,27 @@
+2015-05-15  Ravi Phaneendra Kasibhatla  <[email protected]>
+
+        User interruption while running of run-webkit-tests should also generate results.html
+        https://bugs.webkit.org/show_bug.cgi?id=122154
+
+        Reviewed by Csaba Osztrogonác.
+
+        Generation of results.html on execution of run-webkit-tests happens only
+        on completion of entire layout tests run. It should be created even when
+        the execution has been interrupted - either by user (by pressing Ctrl+C)
+        or because of other interruptions (like exit-after-n-failures option).
+
+        * Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py:
+        (LayoutTestRunner.run_tests):
+        * Scripts/webkitpy/layout_tests/controllers/manager.py:
+        (Manager.run):
+        * Scripts/webkitpy/layout_tests/models/test_run_results.py:
+        (TestRunResults.__init__):
+        * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
+        (main):
+        * Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:
+        (RunTest.test_keyboard_interrupt):
+        (MainTest.test_exception_handling):
+
 2015-05-15  Csaba Osztrogonác  <[email protected]>
 
         [buildbot] Fix the URL of the performance bots

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py (184381 => 184382)


--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py	2015-05-15 12:04:35 UTC (rev 184381)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py	2015-05-15 12:22:12 UTC (rev 184382)
@@ -123,7 +123,7 @@
         except KeyboardInterrupt:
             self._printer.flush()
             self._printer.writeln('Interrupted, exiting ...')
-            raise
+            run_results.keyboard_interrupted = True
         except Exception, e:
             _log.debug('%s("%s") raised, exiting' % (e.__class__.__name__, str(e)))
             raise

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py (184381 => 184382)


--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py	2015-05-15 12:04:35 UTC (rev 184381)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py	2015-05-15 12:22:12 UTC (rev 184382)
@@ -51,6 +51,7 @@
 from webkitpy.layout_tests.models import test_failures
 from webkitpy.layout_tests.models import test_run_results
 from webkitpy.layout_tests.models.test_input import TestInput
+from webkitpy.layout_tests.models.test_run_results import INTERRUPTED_EXIT_STATUS
 from webkitpy.tool.grammar import pluralize
 
 _log = logging.getLogger(__name__)
@@ -194,7 +195,9 @@
                 int(self._options.child_processes), retrying=False)
 
             tests_to_retry = self._tests_to_retry(initial_results, include_crashes=self._port.should_retry_crashes())
-            if self._options.retry_failures and tests_to_retry and not initial_results.interrupted:
+            # Don't retry failures when interrupted by user or failures limit exception.
+            retry_failures = self._options.retry_failures and not (initial_results.interrupted or initial_results.keyboard_interrupted)
+            if retry_failures and tests_to_retry:
                 enabled_pixel_tests_in_retry = self._force_pixel_tests_if_needed()
 
                 _log.info('')
@@ -226,19 +229,22 @@
             results_including_passes = test_run_results.summarize_results(self._port, self._expectations, initial_results, retry_results, enabled_pixel_tests_in_retry, include_passes=True, include_time_and_modifiers=True)
         self._printer.print_results(end_time - start_time, initial_results, summarized_results)
 
+        exit_code = -1
         if not self._options.dry_run:
             self._port.print_leaks_summary()
             self._upload_json_files(summarized_results, initial_results, results_including_passes, start_time, end_time)
 
             results_path = self._filesystem.join(self._results_directory, "results.html")
             self._copy_results_html_file(results_path)
-            if self._options.show_results and (initial_results.unexpected_results_by_name or
-                                               (self._options.full_results_html and initial_results.total_failures)):
-                self._port.show_results_html_file(results_path)
+            if initial_results.keyboard_interrupted:
+                exit_code = INTERRUPTED_EXIT_STATUS
+            else:
+                if self._options.show_results and (initial_results.unexpected_results_by_name or
+                    (self._options.full_results_html and initial_results.total_failures)):
+                    self._port.show_results_html_file(results_path)
+                exit_code = self._port.exit_code_from_summarized_results(summarized_results)
+        return test_run_results.RunDetails(exit_code, summarized_results, initial_results, retry_results, enabled_pixel_tests_in_retry)
 
-        return test_run_results.RunDetails(self._port.exit_code_from_summarized_results(summarized_results),
-                                           summarized_results, initial_results, retry_results, enabled_pixel_tests_in_retry)
-
     def _run_tests(self, tests_to_run, tests_to_skip, repeat_each, iterations, num_workers, retrying):
         needs_http = any((self._is_http_test(test) and not self._is_web_platform_test(test)) for test in tests_to_run)
         needs_web_platform_test_server = any(self._is_web_platform_test(test) for test in tests_to_run)

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/models/test_run_results.py (184381 => 184382)


--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_run_results.py	2015-05-15 12:04:35 UTC (rev 184381)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_run_results.py	2015-05-15 12:22:12 UTC (rev 184382)
@@ -28,6 +28,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import logging
+import signal
 
 from webkitpy.layout_tests.models import test_expectations
 from webkitpy.layout_tests.models import test_failures
@@ -35,6 +36,7 @@
 
 _log = logging.getLogger(__name__)
 
+INTERRUPTED_EXIT_STATUS = signal.SIGINT + 128
 
 class TestRunResults(object):
     def __init__(self, expectations, num_tests):
@@ -60,6 +62,7 @@
             self.tests_by_timeline[timeline] = expectations.model().get_tests_with_timeline(timeline)
         self.slow_tests = set()
         self.interrupted = False
+        self.keyboard_interrupted = False
 
     def add(self, test_result, expected, test_is_slow):
         self.tests_by_expectation[test_result.type].add(test_result.test_name)

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py (184381 => 184382)


--- trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py	2015-05-15 12:04:35 UTC (rev 184381)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py	2015-05-15 12:22:12 UTC (rev 184382)
@@ -31,12 +31,12 @@
 import logging
 import optparse
 import os
-import signal
 import sys
 import traceback
 
 from webkitpy.common.host import Host
 from webkitpy.layout_tests.controllers.manager import Manager
+from webkitpy.layout_tests.models.test_run_results import INTERRUPTED_EXIT_STATUS
 from webkitpy.port import configuration_options, platform_options
 from webkitpy.layout_tests.views import buildbot_results
 from webkitpy.layout_tests.views import printing
@@ -45,9 +45,6 @@
 _log = logging.getLogger(__name__)
 
 
-# This mirrors what the shell normally does.
-INTERRUPTED_EXIT_STATUS = signal.SIGINT + 128
-
 # This is a randomly chosen exit code that can be tested against to
 # indicate that an unexpected exception occurred.
 EXCEPTIONAL_EXIT_STATUS = 254
@@ -78,11 +75,12 @@
 
     try:
         run_details = run(port, options, args, stderr)
-        if run_details.exit_code != -1:
+        if run_details.exit_code != -1 and not run_details.initial_results.keyboard_interrupted:
             bot_printer = buildbot_results.BuildBotPrinter(stdout, options.debug_rwt_logging)
             bot_printer.print_results(run_details)
 
         return run_details.exit_code
+    # We still need to handle KeyboardInterrupt, at least for webkitpy unittest cases.
     except KeyboardInterrupt:
         return INTERRUPTED_EXIT_STATUS
     except BaseException as e:

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py (184381 => 184382)


--- trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py	2015-05-15 12:04:35 UTC (rev 184381)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py	2015-05-15 12:22:12 UTC (rev 184382)
@@ -50,6 +50,7 @@
 
 from webkitpy import port
 from webkitpy.layout_tests import run_webkit_tests
+from webkitpy.layout_tests.models.test_run_results import INTERRUPTED_EXIT_STATUS
 from webkitpy.port import Port
 from webkitpy.port import test
 from webkitpy.test.skip import skip_if
@@ -276,11 +277,12 @@
     def test_keyboard_interrupt(self):
         # Note that this also tests running a test marked as SKIP if
         # you specify it explicitly.
-        self.assertRaises(KeyboardInterrupt, logging_run, ['failures/expected/keyboard.html', '--child-processes', '1'], tests_included=True)
+        details, _, _ = logging_run(['failures/expected/keyboard.html', '--child-processes', '1'], tests_included=True)
+        self.assertEqual(details.exit_code, INTERRUPTED_EXIT_STATUS)
 
         if self.should_test_processes:
-            self.assertRaises(KeyboardInterrupt, logging_run,
-                ['failures/expected/keyboard.html', 'passes/text.html', '--child-processes', '2', '--force'], tests_included=True, shared_port=False)
+            _, regular_output, _ = logging_run(['failures/expected/keyboard.html', 'passes/text.html', '--child-processes', '2', '--force'], tests_included=True, shared_port=False)
+            self.assertTrue(any(['Interrupted, exiting' in line for line in regular_output.buflist]))
 
     def test_no_tests_found(self):
         details, err, _ = logging_run(['resources'], tests_included=True)
@@ -940,7 +942,7 @@
         try:
             run_webkit_tests.run = interrupting_run
             res = run_webkit_tests.main([], stdout, stderr)
-            self.assertEqual(res, run_webkit_tests.INTERRUPTED_EXIT_STATUS)
+            self.assertEqual(res, INTERRUPTED_EXIT_STATUS)
 
             run_webkit_tests.run = successful_run
             res = run_webkit_tests.main(['--platform', 'test'], stdout, stderr)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to