<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[184382] trunk/Tools</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/184382">184382</a></dd>
<dt>Author</dt> <dd>ossy@webkit.org</dd>
<dt>Date</dt> <dd>2015-05-15 05:22:12 -0700 (Fri, 15 May 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>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 <r.kasibhatla@samsung.com> 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):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptswebkitpylayout_testscontrollerslayout_test_runnerpy">trunk/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py</a></li>
<li><a href="#trunkToolsScriptswebkitpylayout_testscontrollersmanagerpy">trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py</a></li>
<li><a href="#trunkToolsScriptswebkitpylayout_testsmodelstest_run_resultspy">trunk/Tools/Scripts/webkitpy/layout_tests/models/test_run_results.py</a></li>
<li><a href="#trunkToolsScriptswebkitpylayout_testsrun_webkit_testspy">trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py</a></li>
<li><a href="#trunkToolsScriptswebkitpylayout_testsrun_webkit_tests_integrationtestpy">trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (184381 => 184382)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-05-15 12:04:35 UTC (rev 184381)
+++ trunk/Tools/ChangeLog        2015-05-15 12:22:12 UTC (rev 184382)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2015-05-15 Ravi Phaneendra Kasibhatla <r.kasibhatla@samsung.com>
+
+ 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):
+
</ins><span class="cx"> 2015-05-15 Csaba Osztrogonác <ossy@webkit.org>
</span><span class="cx">
</span><span class="cx"> [buildbot] Fix the URL of the performance bots
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpylayout_testscontrollerslayout_test_runnerpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py (184381 => 184382)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -123,7 +123,7 @@
</span><span class="cx"> except KeyboardInterrupt:
</span><span class="cx"> self._printer.flush()
</span><span class="cx"> self._printer.writeln('Interrupted, exiting ...')
</span><del>- raise
</del><ins>+ run_results.keyboard_interrupted = True
</ins><span class="cx"> except Exception, e:
</span><span class="cx"> _log.debug('%s("%s") raised, exiting' % (e.__class__.__name__, str(e)))
</span><span class="cx"> raise
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpylayout_testscontrollersmanagerpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py (184381 => 184382)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -51,6 +51,7 @@
</span><span class="cx"> from webkitpy.layout_tests.models import test_failures
</span><span class="cx"> from webkitpy.layout_tests.models import test_run_results
</span><span class="cx"> from webkitpy.layout_tests.models.test_input import TestInput
</span><ins>+from webkitpy.layout_tests.models.test_run_results import INTERRUPTED_EXIT_STATUS
</ins><span class="cx"> from webkitpy.tool.grammar import pluralize
</span><span class="cx">
</span><span class="cx"> _log = logging.getLogger(__name__)
</span><span class="lines">@@ -194,7 +195,9 @@
</span><span class="cx"> int(self._options.child_processes), retrying=False)
</span><span class="cx">
</span><span class="cx"> tests_to_retry = self._tests_to_retry(initial_results, include_crashes=self._port.should_retry_crashes())
</span><del>- if self._options.retry_failures and tests_to_retry and not initial_results.interrupted:
</del><ins>+ # 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:
</ins><span class="cx"> enabled_pixel_tests_in_retry = self._force_pixel_tests_if_needed()
</span><span class="cx">
</span><span class="cx"> _log.info('')
</span><span class="lines">@@ -226,19 +229,22 @@
</span><span class="cx"> 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)
</span><span class="cx"> self._printer.print_results(end_time - start_time, initial_results, summarized_results)
</span><span class="cx">
</span><ins>+ exit_code = -1
</ins><span class="cx"> if not self._options.dry_run:
</span><span class="cx"> self._port.print_leaks_summary()
</span><span class="cx"> self._upload_json_files(summarized_results, initial_results, results_including_passes, start_time, end_time)
</span><span class="cx">
</span><span class="cx"> results_path = self._filesystem.join(self._results_directory, "results.html")
</span><span class="cx"> self._copy_results_html_file(results_path)
</span><del>- 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)
</del><ins>+ 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)
</ins><span class="cx">
</span><del>- 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)
-
</del><span class="cx"> def _run_tests(self, tests_to_run, tests_to_skip, repeat_each, iterations, num_workers, retrying):
</span><span class="cx"> needs_http = any((self._is_http_test(test) and not self._is_web_platform_test(test)) for test in tests_to_run)
</span><span class="cx"> needs_web_platform_test_server = any(self._is_web_platform_test(test) for test in tests_to_run)
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpylayout_testsmodelstest_run_resultspy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/layout_tests/models/test_run_results.py (184381 => 184382)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">
</span><span class="cx"> import logging
</span><ins>+import signal
</ins><span class="cx">
</span><span class="cx"> from webkitpy.layout_tests.models import test_expectations
</span><span class="cx"> from webkitpy.layout_tests.models import test_failures
</span><span class="lines">@@ -35,6 +36,7 @@
</span><span class="cx">
</span><span class="cx"> _log = logging.getLogger(__name__)
</span><span class="cx">
</span><ins>+INTERRUPTED_EXIT_STATUS = signal.SIGINT + 128
</ins><span class="cx">
</span><span class="cx"> class TestRunResults(object):
</span><span class="cx"> def __init__(self, expectations, num_tests):
</span><span class="lines">@@ -60,6 +62,7 @@
</span><span class="cx"> self.tests_by_timeline[timeline] = expectations.model().get_tests_with_timeline(timeline)
</span><span class="cx"> self.slow_tests = set()
</span><span class="cx"> self.interrupted = False
</span><ins>+ self.keyboard_interrupted = False
</ins><span class="cx">
</span><span class="cx"> def add(self, test_result, expected, test_is_slow):
</span><span class="cx"> self.tests_by_expectation[test_result.type].add(test_result.test_name)
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpylayout_testsrun_webkit_testspy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py (184381 => 184382)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -31,12 +31,12 @@
</span><span class="cx"> import logging
</span><span class="cx"> import optparse
</span><span class="cx"> import os
</span><del>-import signal
</del><span class="cx"> import sys
</span><span class="cx"> import traceback
</span><span class="cx">
</span><span class="cx"> from webkitpy.common.host import Host
</span><span class="cx"> from webkitpy.layout_tests.controllers.manager import Manager
</span><ins>+from webkitpy.layout_tests.models.test_run_results import INTERRUPTED_EXIT_STATUS
</ins><span class="cx"> from webkitpy.port import configuration_options, platform_options
</span><span class="cx"> from webkitpy.layout_tests.views import buildbot_results
</span><span class="cx"> from webkitpy.layout_tests.views import printing
</span><span class="lines">@@ -45,9 +45,6 @@
</span><span class="cx"> _log = logging.getLogger(__name__)
</span><span class="cx">
</span><span class="cx">
</span><del>-# This mirrors what the shell normally does.
-INTERRUPTED_EXIT_STATUS = signal.SIGINT + 128
-
</del><span class="cx"> # This is a randomly chosen exit code that can be tested against to
</span><span class="cx"> # indicate that an unexpected exception occurred.
</span><span class="cx"> EXCEPTIONAL_EXIT_STATUS = 254
</span><span class="lines">@@ -78,11 +75,12 @@
</span><span class="cx">
</span><span class="cx"> try:
</span><span class="cx"> run_details = run(port, options, args, stderr)
</span><del>- if run_details.exit_code != -1:
</del><ins>+ if run_details.exit_code != -1 and not run_details.initial_results.keyboard_interrupted:
</ins><span class="cx"> bot_printer = buildbot_results.BuildBotPrinter(stdout, options.debug_rwt_logging)
</span><span class="cx"> bot_printer.print_results(run_details)
</span><span class="cx">
</span><span class="cx"> return run_details.exit_code
</span><ins>+ # We still need to handle KeyboardInterrupt, at least for webkitpy unittest cases.
</ins><span class="cx"> except KeyboardInterrupt:
</span><span class="cx"> return INTERRUPTED_EXIT_STATUS
</span><span class="cx"> except BaseException as e:
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpylayout_testsrun_webkit_tests_integrationtestpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py (184381 => 184382)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -50,6 +50,7 @@
</span><span class="cx">
</span><span class="cx"> from webkitpy import port
</span><span class="cx"> from webkitpy.layout_tests import run_webkit_tests
</span><ins>+from webkitpy.layout_tests.models.test_run_results import INTERRUPTED_EXIT_STATUS
</ins><span class="cx"> from webkitpy.port import Port
</span><span class="cx"> from webkitpy.port import test
</span><span class="cx"> from webkitpy.test.skip import skip_if
</span><span class="lines">@@ -276,11 +277,12 @@
</span><span class="cx"> def test_keyboard_interrupt(self):
</span><span class="cx"> # Note that this also tests running a test marked as SKIP if
</span><span class="cx"> # you specify it explicitly.
</span><del>- self.assertRaises(KeyboardInterrupt, logging_run, ['failures/expected/keyboard.html', '--child-processes', '1'], tests_included=True)
</del><ins>+ details, _, _ = logging_run(['failures/expected/keyboard.html', '--child-processes', '1'], tests_included=True)
+ self.assertEqual(details.exit_code, INTERRUPTED_EXIT_STATUS)
</ins><span class="cx">
</span><span class="cx"> if self.should_test_processes:
</span><del>- self.assertRaises(KeyboardInterrupt, logging_run,
- ['failures/expected/keyboard.html', 'passes/text.html', '--child-processes', '2', '--force'], tests_included=True, shared_port=False)
</del><ins>+ _, 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]))
</ins><span class="cx">
</span><span class="cx"> def test_no_tests_found(self):
</span><span class="cx"> details, err, _ = logging_run(['resources'], tests_included=True)
</span><span class="lines">@@ -940,7 +942,7 @@
</span><span class="cx"> try:
</span><span class="cx"> run_webkit_tests.run = interrupting_run
</span><span class="cx"> res = run_webkit_tests.main([], stdout, stderr)
</span><del>- self.assertEqual(res, run_webkit_tests.INTERRUPTED_EXIT_STATUS)
</del><ins>+ self.assertEqual(res, INTERRUPTED_EXIT_STATUS)
</ins><span class="cx">
</span><span class="cx"> run_webkit_tests.run = successful_run
</span><span class="cx"> res = run_webkit_tests.main(['--platform', 'test'], stdout, stderr)
</span></span></pre>
</div>
</div>
</body>
</html>