Tools/ChangeLog

 12011-04-19 Eric Seidel <eric@webkit.org>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 The commit-queue is confused when non-layout tests fail
 6 https://bugs.webkit.org/show_bug.cgi?id=58955
 7
 8 As seen in http://queues.webkit.org/results/8474435
 9
 10 It fails to create an archive of the layout test results
 11 and then throws an exception.
 12
 13 I've fixed this by making it catch the exception as well
 14 as made it so it never calls that path in the common case.
 15
 16 I've updated MockFileSystem to understand rmtree's affect on
 17 directories as well as files.
 18
 19 * Scripts/webkitpy/common/system/filesystem_mock.py:
 20 * Scripts/webkitpy/common/system/workspace.py:
 21 * Scripts/webkitpy/tool/commands/queues.py:
 22 * Scripts/webkitpy/tool/commands/queues_unittest.py:
 23 * Scripts/webkitpy/tool/mocktool.py:
 24
1252011-04-19 Ojan Vafai <ojan@chromium.org>
226
327 Fix check for whether a failure is expected to deal with

Tools/Scripts/webkitpy/common/system/filesystem_mock.py

@@class MockFileSystem(object):
147147 return False
148148 path = self.normpath(path)
149149 if path in self.dirs:
150  return True
 150 return self.dirs[path] is not None
151151
152152 # We need to use a copy of the keys here in order to avoid switching
153153 # to a different thread and potentially modifying the dict in

@@class MockFileSystem(object):
267267 self.written_files[path] = None
268268
269269 def rmtree(self, path):
270  if not path.endswith(self.sep):
271  path += self.sep
 270 path = self.normpath(path)
272271
273272 for f in self.files:
274273 if f.startswith(path):
275274 self.files[f] = None
276275
 276 for d in self.dirs:
 277 if d.startswith(path):
 278 self.dirs[d] = None
 279
277280 def splitext(self, path):
278281 idx = path.rfind('.')
279282 if idx == -1:

Tools/Scripts/webkitpy/common/system/workspace.py

2929# A home for file logic which should sit above FileSystem, but
3030# below more complicated objects.
3131
 32import logging
3233import zipfile
3334
 35
 36_log = logging.getLogger(__name__)
 37
 38
3439class Workspace(object):
3540 def __init__(self, filesystem, executive):
3641 self._filesystem = filesystem

@@class Workspace(object):
5762 # zip_file.write(os.path.relpath(path, source_path))
5863 # However, getting the paths, encoding and compression correct could be non-trivial.
5964 # So, for now we depend on the environment having "zip" installed (likely fails on Win32)
60  self._executive.run_command(['zip', '-r', zip_path, source_path])
 65 try:
 66 self._executive.run_command(['zip', '-r', zip_path, source_path])
 67 except ScriptError, e:
 68 _log.error("Workspace.create_zip failed:\n%s" % e.message_with_output())
 69 return None
 70
6171 return zip_class(zip_path)

Tools/Scripts/webkitpy/tool/commands/queues.py

@@class CommitQueue(AbstractPatchQueue, StepSequenceErrorHandler, CommitQueueTaskD
353353 zip_path = self._tool.workspace.find_unused_filename(self._log_directory(), "%s-%s" % (patch.bug_id(), results_name), "zip")
354354 if not zip_path:
355355 return None
 356 if not self._tool.filesystem.isdir(results_directory):
 357 log("%s does not exist, not archiving." % results_directory)
 358 return None
356359 archive = self._tool.workspace.create_zip(zip_path, results_directory)
357360 # Remove the results directory to prevent http logs, etc. from getting huge between runs.
358361 # We could have create_zip remove the original, but this is more explicit.

Tools/Scripts/webkitpy/tool/commands/queues_unittest.py

@@The commit-queue is continuing to process your patch.
403403
404404 def test_archive_last_layout_test_results(self):
405405 queue = CommitQueue()
406  queue.bind_to_tool(MockTool())
 406 tool = MockTool()
 407 queue.bind_to_tool(tool)
407408 patch = queue._tool.bugs.fetch_attachment(128)
408  # This is just to test that the method doesn't raise.
409  queue.archive_last_layout_test_results(patch)
 409 # Should fail because the results_directory does not exist.
 410 expected_stderr = "/mock does not exist, not archiving.\n"
 411 archive = OutputCapture().assert_outputs(self, queue.archive_last_layout_test_results, [patch], expected_stderr=expected_stderr)
 412 self.assertEqual(archive, None)
 413
 414 results_directory = "/mock"
 415 # Sanity check what we assume our mock results directory is.
 416 self.assertEqual(queue._results_directory(), results_directory)
 417 tool.filesystem.maybe_make_directory(results_directory)
 418 self.assertTrue(tool.filesystem.exists(results_directory))
 419
 420 self.assertNotEqual(queue.archive_last_layout_test_results(patch), None)
 421 self.assertFalse(tool.filesystem.exists(results_directory))
410422
411423 def test_upload_results_archive_for_patch(self):
412424 queue = CommitQueue()

Tools/Scripts/webkitpy/tool/mocktool.py

@@class MockWorkspace(object):
728728 return "%s/%s.%s" % (directory, name, extension)
729729
730730 def create_zip(self, zip_path, source_path):
731  pass
 731 return object() # Something that is not None
732732
733733
734734class MockTool(object):