2010-12-01 Dirk Pranke <dpranke@chromium.org>
authordpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Dec 2010 23:59:15 +0000 (23:59 +0000)
committerdpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Dec 2010 23:59:15 +0000 (23:59 +0000)
        Reviewed by Tony Chang.

        new-run-webkit-tests: add a --dry-run / -n flag
        https://bugs.webkit.org/show_bug.cgi?id=50045

        * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
        * Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73080 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKitTools/ChangeLog
WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py

index f981dd46b815a4f6a721a0286cd2be71ee2cfcc9..0e8ea6e57b3f8c463fd017107b4ae93d6483d8a4 100644 (file)
@@ -1,3 +1,13 @@
+2010-12-01  Dirk Pranke  <dpranke@chromium.org>
+
+        Reviewed by Tony Chang.
+
+        new-run-webkit-tests: add a --dry-run / -n flag
+        https://bugs.webkit.org/show_bug.cgi?id=50045
+
+        * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
+        * Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py:
+
 2010-12-01  Steve Falkenburg  <sfalken@apple.com>
 
         Reviewed by Adam Roben.
index 643e20493c8a3bf40ab08ef44b9de70911b43e79..f4e92a68698d4b069031d6bb1b37882dbaf1faf5 100755 (executable)
@@ -599,20 +599,25 @@ class TestRunner:
         message_broker = self._message_broker
         self._current_filename_queue = filename_queue
         self._current_result_summary = result_summary
-        threads = message_broker.start_workers(self)
+
+        if not self._options.dry_run:
+            threads = message_broker.start_workers(self)
+        else:
+            threads = {}
 
         self._printer.print_update("Starting testing ...")
         keyboard_interrupted = False
-        try:
-            message_broker.run_message_loop()
-        except KeyboardInterrupt:
-            _log.info("Interrupted, exiting")
-            message_broker.cancel_workers()
-            keyboard_interrupted = True
-        except:
-            # Unexpected exception; don't try to clean up workers.
-            _log.info("Exception raised, exiting")
-            raise
+        if not self._options.dry_run:
+            try:
+                message_broker.run_message_loop()
+            except KeyboardInterrupt:
+                _log.info("Interrupted, exiting")
+                message_broker.cancel_workers()
+                keyboard_interrupted = True
+            except:
+                # Unexpected exception; don't try to clean up workers.
+                _log.info("Exception raised, exiting")
+                raise
 
         thread_timings, test_timings, individual_test_timings = \
             self._collect_timing_info(threads)
@@ -737,16 +742,18 @@ class TestRunner:
             self._expectations, result_summary, retry_summary)
         self._printer.print_unexpected_results(unexpected_results)
 
-        if self._options.record_results:
+        if (self._options.record_results and not self._options.dry_run and
+            not keyboard_interrupted):
             # Write the same data to log files and upload generated JSON files
             # to appengine server.
             self._upload_json_files(unexpected_results, result_summary,
                                     individual_test_timings)
 
         # Write the summary to disk (results.html) and display it if requested.
-        wrote_results = self._write_results_html_file(result_summary)
-        if self._options.show_results and wrote_results:
-            self._show_results_html_file()
+        if not self._options.dry_run:
+            wrote_results = self._write_results_html_file(result_summary)
+            if self._options.show_results and wrote_results:
+                self._show_results_html_file()
 
         # Now that we've completed all the processing we can, we re-raise
         # a KeyboardInterrupt if necessary so the caller can handle it.
@@ -1520,6 +1527,9 @@ def parse_args(args=None):
         optparse.make_option("--no-build", dest="build",
             action="store_false", help="Don't check to see if the "
                                        "DumpRenderTree build is up-to-date."),
+        optparse.make_option("-n", "--dry-run", action="store_true",
+            default=False,
+            help="Do everything but actually run the tests or upload results."),
         # old-run-webkit-tests has --valgrind instead of wrapper.
         optparse.make_option("--wrapper",
             help="wrapper command to insert before invocations of "
index 20a4ac0eada795650599f9100b1a30f13fea6270..6bb741a57c91c0b0e264cfde7d6410cbf583966a 100644 (file)
@@ -201,6 +201,13 @@ class MainTest(unittest.TestCase):
         self.assertTrue('Running 2 DumpRenderTrees in parallel\n'
                         in regular_output.get())
 
+    def test_dryrun(self):
+        batch_tests_run = get_tests_run(['--dry-run'])
+        self.assertEqual(batch_tests_run, [])
+
+        batch_tests_run = get_tests_run(['-n'])
+        self.assertEqual(batch_tests_run, [])
+
     def test_exception_raised(self):
         self.assertRaises(ValueError, logging_run,
             ['failures/expected/exception.html'], tests_included=True)