tests_run0.txt gets clobbered when re-running failing tests
authorossy@webkit.org <ossy@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Dec 2011 15:44:59 +0000 (15:44 +0000)
committerossy@webkit.org <ossy@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Dec 2011 15:44:59 +0000 (15:44 +0000)
https://bugs.webkit.org/show_bug.cgi?id=63844

Patch by Kristóf Kosztyó <kkristof@inf.u-szeged.hu> on 2011-12-01
Reviewed by Dirk Pranke.

* Scripts/webkitpy/layout_tests/controllers/manager.py:
(Manager.results_directory):
* Scripts/webkitpy/layout_tests/controllers/manager_worker_broker.py:
(AbstractWorker.__init__):
(_ManagerConnection.start_worker):
(_InlineManager.start_worker):
(_MultiProcessManager.start_worker):
(_WorkerConnection.__init__):
(_InlineWorkerConnection.__init__):
(_MultiProcessWorkerConnection.__init__):
* Scripts/webkitpy/layout_tests/controllers/manager_worker_broker_unittest.py:
(_TestWorker.__init__):
(_TestsMixin.test_cancel):
(_TestsMixin.test_done):
(_TestsMixin.test_unknown_message):
(InterfaceTest.test_managerconnection_is_abstract):
(InterfaceTest.test_workerconnection_is_abstract):
* Scripts/webkitpy/layout_tests/controllers/worker.py:
(Worker.__init__):
(Worker.safe_init):
* Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:
(MainTest.test_retries_directory):

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

Tools/ChangeLog
Tools/Scripts/webkitpy/layout_tests/controllers/manager.py
Tools/Scripts/webkitpy/layout_tests/controllers/manager_worker_broker.py
Tools/Scripts/webkitpy/layout_tests/controllers/manager_worker_broker_unittest.py
Tools/Scripts/webkitpy/layout_tests/controllers/worker.py
Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py

index e9945f4..5e5675a 100644 (file)
@@ -1,3 +1,33 @@
+2011-12-01  Kristóf Kosztyó  <kkristof@inf.u-szeged.hu>
+
+        tests_run0.txt gets clobbered when re-running failing tests
+        https://bugs.webkit.org/show_bug.cgi?id=63844
+
+        Reviewed by Dirk Pranke.
+
+        * Scripts/webkitpy/layout_tests/controllers/manager.py:
+        (Manager.results_directory):
+        * Scripts/webkitpy/layout_tests/controllers/manager_worker_broker.py:
+        (AbstractWorker.__init__):
+        (_ManagerConnection.start_worker):
+        (_InlineManager.start_worker):
+        (_MultiProcessManager.start_worker):
+        (_WorkerConnection.__init__):
+        (_InlineWorkerConnection.__init__):
+        (_MultiProcessWorkerConnection.__init__):
+        * Scripts/webkitpy/layout_tests/controllers/manager_worker_broker_unittest.py:
+        (_TestWorker.__init__):
+        (_TestsMixin.test_cancel):
+        (_TestsMixin.test_done):
+        (_TestsMixin.test_unknown_message):
+        (InterfaceTest.test_managerconnection_is_abstract):
+        (InterfaceTest.test_workerconnection_is_abstract):
+        * Scripts/webkitpy/layout_tests/controllers/worker.py:
+        (Worker.__init__):
+        (Worker.safe_init):
+        * Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:
+        (MainTest.test_retries_directory):
+
 2011-12-01  Adam Roben  <aroben@apple.com>
 
         Buildbot fix
index ad4be2c..bab609e 100644 (file)
@@ -768,7 +768,7 @@ class Manager(object):
 
         self._printer.print_update('Starting %s ...' % grammar.pluralize('worker', num_workers))
         for worker_number in xrange(num_workers):
-            worker_connection = manager_connection.start_worker(worker_number)
+            worker_connection = manager_connection.start_worker(worker_number, self.results_directory())
             worker_state = _WorkerState(worker_number, worker_connection)
             self._worker_states[worker_connection.name] = worker_state
 
@@ -826,6 +826,13 @@ class Manager(object):
         # FIXME: should this be a class instead of a tuple?
         return (interrupted, keyboard_interrupted, thread_timings, self._group_stats, self._all_results)
 
+    def results_directory(self):
+        if not self._retrying:
+            return self._results_directory
+        else:
+            self._port._filesystem.maybe_make_directory(self._port._filesystem.join(self._results_directory, 'retries'))
+            return self._port._filesystem.join(self._results_directory, 'retries')
+
     def update(self):
         self.update_summary(self._current_result_summary)
 
index d5d089a..0dcabeb 100755 (executable)
@@ -106,7 +106,7 @@ def get(port, options, client, worker_class):
 
 
 class AbstractWorker(message_broker.BrokerClient):
-    def __init__(self, worker_connection, worker_number, options):
+    def __init__(self, worker_connection, worker_number, results_directory, options):
         """The constructor should be used to do any simple initialization
         necessary, but should not do anything that creates data structures
         that cannot be Pickled or sent across processes (like opening
@@ -123,6 +123,7 @@ class AbstractWorker(message_broker.BrokerClient):
         self._options = options
         self._worker_number = worker_number
         self._name = 'worker/%d' % worker_number
+        self._results_directory = results_directory
 
     def run(self, port):
         """Callback for the worker to start executing. Typically does any
@@ -151,7 +152,7 @@ class _ManagerConnection(message_broker.BrokerConnection):
         self._options = options
         self._worker_class = worker_class
 
-    def start_worker(self, worker_number):
+    def start_worker(self, worker_number, results_directory):
         raise NotImplementedError
 
 
@@ -161,9 +162,9 @@ class _InlineManager(_ManagerConnection):
         self._port = port
         self._inline_worker = None
 
-    def start_worker(self, worker_number):
+    def start_worker(self, worker_number, results_directory):
         self._inline_worker = _InlineWorkerConnection(self._broker, self._port,
-            self._client, self._worker_class, worker_number)
+            self._client, self._worker_class, worker_number, results_directory)
         return self._inline_worker
 
     def run_message_loop(self, delay_secs=None):
@@ -182,16 +183,16 @@ class _MultiProcessManager(_ManagerConnection):
         _ManagerConnection.__init__(self, broker, options, client, worker_class)
         self._platform_name = port.real_name()
 
-    def start_worker(self, worker_number):
+    def start_worker(self, worker_number, results_directory):
         worker_connection = _MultiProcessWorkerConnection(self._broker, self._platform_name,
-            self._worker_class, worker_number, self._options)
+            self._worker_class, worker_number, results_directory, self._options)
         worker_connection.start()
         return worker_connection
 
 
 class _WorkerConnection(message_broker.BrokerConnection):
-    def __init__(self, broker, worker_class, worker_number, options):
-        self._client = worker_class(self, worker_number, options)
+    def __init__(self, broker, worker_class, worker_number, results_directory, options):
+        self._client = worker_class(self, worker_number, results_directory, options)
         self.name = self._client.name()
         message_broker.BrokerConnection.__init__(self, broker, self._client,
                                                  ANY_WORKER_TOPIC, MANAGER_TOPIC)
@@ -210,8 +211,8 @@ class _WorkerConnection(message_broker.BrokerConnection):
 
 
 class _InlineWorkerConnection(_WorkerConnection):
-    def __init__(self, broker, port, manager_client, worker_class, worker_number):
-        _WorkerConnection.__init__(self, broker, worker_class, worker_number, port.options)
+    def __init__(self, broker, port, manager_client, worker_class, worker_number, results_directory):
+        _WorkerConnection.__init__(self, broker, worker_class, worker_number, results_directory, port.options)
         self._alive = False
         self._port = port
         self._manager_client = manager_client
@@ -272,8 +273,8 @@ if multiprocessing:
 
 
 class _MultiProcessWorkerConnection(_WorkerConnection):
-    def __init__(self, broker, platform_name, worker_class, worker_number, options):
-        _WorkerConnection.__init__(self, broker, worker_class, worker_number, options)
+    def __init__(self, broker, platform_name, worker_class, worker_number, results_directory, options):
+        _WorkerConnection.__init__(self, broker, worker_class, worker_number, results_directory, options)
         self._proc = _Process(self, platform_name, options, self._client)
 
     def cancel(self):
index e80765a..8e63f93 100644 (file)
@@ -67,7 +67,7 @@ def make_broker(manager, worker_model, start_queue=None, stop_queue=None):
 
 
 class _TestWorker(manager_worker_broker.AbstractWorker):
-    def __init__(self, broker_connection, worker_number, options):
+    def __init__(self, broker_connection, worker_number, results_directory, options):
         self._broker_connection = broker_connection
         self._options = options
         self._worker_number = worker_number
@@ -172,7 +172,7 @@ class _TestsMixin(object):
 
     def test_cancel(self):
         self.make_broker()
-        worker = self._broker.start_worker(0)
+        worker = self._broker.start_worker(0, None)
         worker.cancel()
         self._broker.post_message('test', 1, 'hello, world')
         worker.join(0.5)
@@ -180,7 +180,7 @@ class _TestsMixin(object):
 
     def test_done(self):
         self.make_broker()
-        worker = self._broker.start_worker(0)
+        worker = self._broker.start_worker(0, None)
         self._broker.post_message('test', 1, 'hello, world')
         self._broker.post_message('stop')
         self._broker.run_message_loop()
@@ -192,7 +192,7 @@ class _TestsMixin(object):
 
     def test_unknown_message(self):
         self.make_broker()
-        worker = self._broker.start_worker(0)
+        worker = self._broker.start_worker(0, None)
         self._broker.post_message('unknown')
         self._broker.run_message_loop()
         worker.join(0.5)
@@ -234,13 +234,13 @@ class InterfaceTest(unittest.TestCase):
         # signature we expect.
         broker = make_broker(self, 'inline')
         obj = manager_worker_broker._ManagerConnection(broker._broker, None, self, None)
-        self.assertRaises(NotImplementedError, obj.start_worker, 0)
+        self.assertRaises(NotImplementedError, obj.start_worker, 0, None)
 
     def test_workerconnection_is_abstract(self):
         # Test that all the base class methods are abstract and have the
         # signature we expect.
         broker = make_broker(self, 'inline')
-        obj = manager_worker_broker._WorkerConnection(broker._broker, _TestWorker, 0, None)
+        obj = manager_worker_broker._WorkerConnection(broker._broker, _TestWorker, 0, None, None)
         self.assertRaises(NotImplementedError, obj.cancel)
         self.assertRaises(NotImplementedError, obj.is_alive)
         self.assertRaises(NotImplementedError, obj.join, None)
index 5dd33a2..832eed8 100644 (file)
@@ -43,8 +43,8 @@ _log = logging.getLogger(__name__)
 
 
 class Worker(manager_worker_broker.AbstractWorker):
-    def __init__(self, worker_connection, worker_number, options):
-        manager_worker_broker.AbstractWorker.__init__(self, worker_connection, worker_number, options)
+    def __init__(self, worker_connection, worker_number, results_directory, options):
+        manager_worker_broker.AbstractWorker.__init__(self, worker_connection, worker_number, results_directory, options)
         self._done = False
         self._canceled = False
         self._port = None
@@ -68,7 +68,7 @@ class Worker(manager_worker_broker.AbstractWorker):
         self._filesystem = port.filesystem
         self._batch_count = 0
         self._batch_size = self._options.batch_size or 0
-        tests_run_filename = self._filesystem.join(port.results_directory(), "tests_run%d.txt" % self._worker_number)
+        tests_run_filename = self._filesystem.join(self._results_directory, "tests_run%d.txt" % self._worker_number)
         self._tests_run_file = self._filesystem.open_text_file_for_writing(tests_run_filename)
 
     def cancel(self):
index f6adcfc..3d36d58 100755 (executable)
@@ -625,6 +625,11 @@ class MainTest(unittest.TestCase):
                                           tests_included=True, filesystem=fs)
         self.assertEqual(user.opened_urls, ['/tmp/cwd/foo/results.html'])
 
+    def test_retries_directory(self):
+        fs = unit_test_filesystem()
+        res, out, err, user = logging_run(tests_included=True, filesystem=fs)
+        self.assertTrue('/tmp/layout-test-results/retries/tests_run0.txt' in fs.files)
+
     # These next tests test that we run the tests in ascending alphabetical
     # order per directory. HTTP tests are sharded separately from other tests,
     # so we have to test both.