Changeset 91210 in webkit
- Timestamp:
- Jul 18, 2011 2:16:45 PM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 37 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r91197 r91210 1 2011-07-18 Eric Seidel <eric@webkit.org> 2 3 webkit-patch apply-attachment does not work when not called from the root of the checkout 4 https://bugs.webkit.org/show_bug.cgi?id=64751 5 6 Reviewed by Adam Barth. 7 8 Last week I removed a os.chdir in EnsureWorkingDirectoryClean, which 9 is a step that we run for most commands (as one of the earliest steps). 10 EnsureWorkingDirectoryClean was incorrectly calling os.chdir to change 11 the CWD to the checkout root. This magically made a bunch of otherwise 12 wrong code work. 13 14 When I realized that apply-attachment no longer worked as expected today, 15 I went and fixed the bug, then realizing that we were not testing 16 what the cwd was when running various commands. I fixed our MockExecutive 17 to always log what the cwd is and fixed a whole bunch of places 18 where we needed to be setting the cwd. 19 20 Hopefully this will solve our cwd problems once and for-all, and webkit-patch 21 will again correctly work when called from any directory (including outside 22 of a webkit checkout). 23 24 * Scripts/webkitpy/common/checkout/scm/scm_unittest.py: 25 * Scripts/webkitpy/common/system/executive.py: 26 * Scripts/webkitpy/common/system/workspace_unittest.py: 27 * Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py: 28 * Scripts/webkitpy/layout_tests/port/gtk_unittest.py: 29 * Scripts/webkitpy/layout_tests/port/mac_unittest.py: 30 * Scripts/webkitpy/layout_tests/port/qt_unittest.py: 31 * Scripts/webkitpy/layout_tests/port/webkit_unittest.py: 32 * Scripts/webkitpy/tool/bot/irc_command.py: 33 * Scripts/webkitpy/tool/bot/irc_command_unittest.py: 34 * Scripts/webkitpy/tool/bot/layouttestresultsreader_unittest.py: 35 * Scripts/webkitpy/tool/commands/download_unittest.py: 36 * Scripts/webkitpy/tool/commands/earlywarningsystem_unittest.py: 37 * Scripts/webkitpy/tool/commands/queues.py: 38 * Scripts/webkitpy/tool/commands/queues_unittest.py: 39 * Scripts/webkitpy/tool/commands/queuestest.py: 40 * Scripts/webkitpy/tool/mocktool.py: 41 * Scripts/webkitpy/tool/servers/gardeningserver.py: 42 * Scripts/webkitpy/tool/servers/gardeningserver_unittest.py: 43 * Scripts/webkitpy/tool/steps/build.py: 44 * Scripts/webkitpy/tool/steps/checkstyle.py: 45 * Scripts/webkitpy/tool/steps/editchangelog.py: 46 * Scripts/webkitpy/tool/steps/preparechangelog.py: 47 * Scripts/webkitpy/tool/steps/preparechangelogforrevert.py: 48 * Scripts/webkitpy/tool/steps/runtests.py: 49 * Scripts/webkitpy/tool/steps/steps_unittest.py: 50 * Scripts/webkitpy/tool/steps/update.py: 51 1 52 2011-07-18 Adam Barth <abarth@webkit.org> 2 53 -
trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py
r90978 r91210 1501 1501 def test_create_patch(self): 1502 1502 scm = self.make_scm(logging_executive=True) 1503 expected_stderr = "MOCK run_command: ['git', 'merge-base', u'refs/remotes/origin/master', 'HEAD'] \nMOCK run_command: ['git', 'diff', '--binary', '--no-ext-diff', '--full-index', '-M', 'MOCK output of child process', '--']\nMOCK run_command: ['git', 'log', '-25']\n"1503 expected_stderr = "MOCK run_command: ['git', 'merge-base', u'refs/remotes/origin/master', 'HEAD'], cwd=/mock-checkoutMOCK run_command: ['git', 'diff', '--binary', '--no-ext-diff', '--full-index', '-M', 'MOCK output of child process', '--'], cwd=/mock-checkoutMOCK run_command: ['git', 'log', '-25'], cwd=/mock-checkout\n" 1504 1504 OutputCapture().assert_outputs(self, scm.create_patch, expected_stderr=expected_stderr) 1505 1505 -
trunk/Tools/Scripts/webkitpy/common/system/executive.py
r90978 r91210 109 109 return sys.platform not in ('win32', 'cygwin') 110 110 111 def _run_command_with_teed_output(self, args, teed_output ):111 def _run_command_with_teed_output(self, args, teed_output, cwd=None): 112 112 args = map(unicode, args) # Popen will throw an exception if args are non-strings (like int()) 113 113 args = map(self._encode_argument_if_needed, args) … … 116 116 stdout=self.PIPE, 117 117 stderr=self.STDOUT, 118 close_fds=self._should_close_fds()) 118 close_fds=self._should_close_fds(), 119 cwd=cwd) 119 120 120 121 # Use our own custom wait loop because Popen ignores a tee'd … … 136 137 # like "build-webkit" where we want to display to the user that we're building 137 138 # but still have the output to stuff into a log file. 138 def run_and_throw_if_fail(self, args, quiet=False, decode_output=True ):139 def run_and_throw_if_fail(self, args, quiet=False, decode_output=True, cwd=None): 139 140 # Cache the child's output locally so it can be used for error reports. 140 141 child_out_file = StringIO.StringIO() … … 144 145 tee_stdout = dev_null 145 146 child_stdout = tee(child_out_file, tee_stdout) 146 exit_code = self._run_command_with_teed_output(args, child_stdout )147 exit_code = self._run_command_with_teed_output(args, child_stdout, cwd=cwd) 147 148 if quiet: 148 149 dev_null.close() -
trunk/Tools/Scripts/webkitpy/common/system/filesystem_mock.py
r90702 r91210 81 81 82 82 def path_to_module(self, module_name): 83 return "/mock /Tools/Scripts/webkitpy/%s" % module_name83 return "/mock-checkout/Tools/Scripts/webkitpy/%s" % module_name 84 84 85 85 def chdir(self, path): -
trunk/Tools/Scripts/webkitpy/common/system/workspace_unittest.py
r87751 r91210 51 51 def test_create_zip(self): 52 52 workspace = Workspace(None, MockExecutive(should_log=True)) 53 expected_stderr = "MOCK run_command: ['zip', '-9', '-r', '/zip/path', '/source/path'] \n"53 expected_stderr = "MOCK run_command: ['zip', '-9', '-r', '/zip/path', '/source/path'], cwd=None\n" 54 54 class MockZipFile(object): 55 55 def __init__(self, path): … … 60 60 def test_create_zip_exception(self): 61 61 workspace = Workspace(None, MockExecutive(should_log=True, should_throw=True)) 62 expected_stderr = "MOCK run_command: ['zip', '-9', '-r', '/zip/path', '/source/path'] \n"62 expected_stderr = "MOCK run_command: ['zip', '-9', '-r', '/zip/path', '/source/path'], cwd=None\n" 63 63 class MockZipFile(object): 64 64 def __init__(self, path): -
trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py
r91136 r91210 215 215 # to fail, since they assert that we have no logging output. 216 216 # The revision lookup always fails when running the tests since it tries to read from 217 # "/mock " using the real file system (since there is no way to mock out detect_scm_system at current).217 # "/mock-checkout" using the real file system (since there is no way to mock out detect_scm_system at current). 218 218 # Once we fix detect_scm_system to use the mock file system we can add this log back. 219 219 #_log.warn("Failed to determine svn revision for checkout (cwd: %s, webkit_base: %s), leaving 'revision' key blank in full_results.json.\n%s" % (port_obj._filesystem.getcwd(), port_obj.path_from_webkit_base(), e)) -
trunk/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py
r90520 r91210 256 256 filesystem = MockFileSystem() 257 257 port = Port(port_name='foo', filesystem=filesystem) 258 port.path_to_test_expectations_file = lambda: '/mock /test_expectations.txt'258 port.path_to_test_expectations_file = lambda: '/mock-results/test_expectations.txt' 259 259 self.assertFalse(port.uses_test_expectations_file()) 260 port._filesystem = MockFileSystem({'/mock /test_expectations.txt': ''})260 port._filesystem = MockFileSystem({'/mock-results/test_expectations.txt': ''}) 261 261 self.assertTrue(port.uses_test_expectations_file()) 262 262 -
trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py
r90527 r91210 88 88 port.path_from_chromium_base = self._mock_path_from_chromium_base 89 89 self._port = port 90 setup_mount = self._mock_path_from_chromium_base("third_party", 91 "cygwin", 92 "setup_mount.bat") 90 setup_mount = self._mock_path_from_chromium_base("third_party", "cygwin", "setup_mount.bat") 93 91 expected_stderr = "MOCK run_command: %s\n" % [setup_mount] 94 92 output = outputcapture.OutputCapture() 95 output.assert_outputs(self, port.setup_environ_for_server, 96 expected_stderr=expected_stderr) 93 output.assert_outputs(self, port.setup_environ_for_server, expected_stderr=expected_stderr) 97 94 98 95 def assert_name(self, port_name, windows_version, expected): -
trunk/Tools/Scripts/webkitpy/layout_tests/port/gtk_unittest.py
r90826 r91210 42 42 port = self.make_port() 43 43 port._executive = MockExecutive(should_log=True) 44 expected_stderr = "MOCK run_command: ['Tools/Scripts/run-launcher', '--release', '--gtk', 'file://test.html'] \n"44 expected_stderr = "MOCK run_command: ['Tools/Scripts/run-launcher', '--release', '--gtk', 'file://test.html'], cwd=/mock-checkout\n" 45 45 OutputCapture().assert_outputs(self, port.show_results_html_file, ["test.html"], expected_stderr=expected_stderr) -
trunk/Tools/Scripts/webkitpy/layout_tests/port/mac_unittest.py
r90826 r91210 148 148 # Delay setting a should_log executive to avoid logging from MacPort.__init__. 149 149 port._executive = MockExecutive(should_log=True) 150 expected_stderr = "MOCK run_command: ['Tools/Scripts/run-safari', '--release', '-NSOpen', 'test.html'] \n"150 expected_stderr = "MOCK run_command: ['Tools/Scripts/run-safari', '--release', '-NSOpen', 'test.html'], cwd=/mock-checkout\n" 151 151 OutputCapture().assert_outputs(self, port.show_results_html_file, ["test.html"], expected_stderr=expected_stderr) 152 152 -
trunk/Tools/Scripts/webkitpy/layout_tests/port/qt_unittest.py
r90826 r91210 66 66 port = self.make_port() 67 67 port._executive = MockExecutive(should_log=True) 68 expected_stderr = "MOCK run_command: ['Tools/Scripts/run-launcher', '--release', '--qt', 'file://test.html'] \n"68 expected_stderr = "MOCK run_command: ['Tools/Scripts/run-launcher', '--release', '--qt', 'file://test.html'], cwd=/mock-checkout\n" 69 69 OutputCapture().assert_outputs(self, port.show_results_html_file, ["test.html"], expected_stderr=expected_stderr) -
trunk/Tools/Scripts/webkitpy/layout_tests/port/server_process_unittest.py
r90184 r91210 46 46 class TrivialMockPort(object): 47 47 def results_directory(self): 48 return "/mock /results"48 return "/mock-results" 49 49 50 50 … … 96 96 server_process = FakeServerProcess(port_obj=TrivialMockPort(), name="test", cmd=["test"], executive=MockExecutive2(run_command_fn=_logging_run_command)) 97 97 server_process._proc = MockProc(server_process) 98 expected_stdout = "['/usr/bin/sample', 1, 10, 10, '-file', '/mock /results/test-1.sample.txt']\n"98 expected_stdout = "['/usr/bin/sample', 1, 10, 10, '-file', '/mock-results/test-1.sample.txt']\n" 99 99 OutputCapture().assert_outputs(self, server_process._sample, expected_stdout=expected_stdout) 100 100 -
trunk/Tools/Scripts/webkitpy/layout_tests/port/test.py
r91136 r91210 247 247 files[LAYOUT_TEST_DIR + 'userscripts/resources/iframe.html'] = 'iframe' 248 248 249 fs = filesystem_mock.MockFileSystem(files, dirs=set(['/mock '])) # Make sure at least the checkout_root exists as a directory.249 fs = filesystem_mock.MockFileSystem(files, dirs=set(['/mock-checkout'])) # Make sure at least the checkout_root exists as a directory. 250 250 fs._tests = test_list 251 251 return fs -
trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit_unittest.py
r90810 r91210 119 119 # Skipped file, and that we include the feature and platform checks. 120 120 files = { 121 '/mock /LayoutTests/platform/testwebkitport/test_expectations.txt': 'BUG_TESTEXPECTATIONS SKIP : fast/html/article-element.html = FAIL\n',122 '/mock /LayoutTests/platform/testwebkitport/Skipped': 'fast/html/keygen.html',121 '/mock-checkout/LayoutTests/platform/testwebkitport/test_expectations.txt': 'BUG_TESTEXPECTATIONS SKIP : fast/html/article-element.html = FAIL\n', 122 '/mock-checkout/LayoutTests/platform/testwebkitport/Skipped': 'fast/html/keygen.html', 123 123 } 124 124 mock_fs = MockFileSystem(files) … … 135 135 port._executive = MockExecutive(should_log=True) 136 136 port._options = MockOptions(configuration="Release") # This should not be necessary, but I think TestWebKitPort is actually reading from disk (and thus detects the current configuration). 137 expected_stderr = "MOCK run_command: ['Tools/Scripts/build-dumprendertree', '--release'] \n"137 expected_stderr = "MOCK run_command: ['Tools/Scripts/build-dumprendertree', '--release'], cwd=/mock-checkout\n" 138 138 self.assertTrue(output.assert_outputs(self, port._build_driver, expected_stderr=expected_stderr)) 139 139 140 140 # Make sure when passed --webkit-test-runner web build the right tool. 141 141 port._options = MockOptions(webkit_test_runner=True, configuration="Release") 142 expected_stderr = "MOCK run_command: ['Tools/Scripts/build-webkittestrunner', '--release'] \n"142 expected_stderr = "MOCK run_command: ['Tools/Scripts/build-webkittestrunner', '--release'], cwd=/mock-checkout\n" 143 143 self.assertTrue(output.assert_outputs(self, port._build_driver, expected_stderr=expected_stderr)) 144 144 145 145 # Make sure that failure to build returns False. 146 146 port._executive = MockExecutive(should_log=True, should_throw=True) 147 expected_stderr = "MOCK run_command: ['Tools/Scripts/build-webkittestrunner', '--release'] \n"147 expected_stderr = "MOCK run_command: ['Tools/Scripts/build-webkittestrunner', '--release'], cwd=/mock-checkout\n" 148 148 self.assertFalse(output.assert_outputs(self, port._build_driver, expected_stderr=expected_stderr)) 149 149 … … 186 186 # Mock out _apache_config_file_name_for_platform to ignore the passed sys.platform value. 187 187 port._apache_config_file_name_for_platform = lambda platform: 'httpd.conf' 188 self.assertEquals(port._path_to_apache_config_file(), '/mock /LayoutTests/http/conf/httpd.conf')188 self.assertEquals(port._path_to_apache_config_file(), '/mock-checkout/LayoutTests/http/conf/httpd.conf') -
trunk/Tools/Scripts/webkitpy/tool/bot/flakytestreporter_unittest.py
r90532 r91210 100 100 def test_report_flaky_tests_creating_bug(self): 101 101 tool = MockTool() 102 tool.filesystem = MockFileSystem({"/mock /foo/bar-diffs.txt": "mock"})102 tool.filesystem = MockFileSystem({"/mock-results/foo/bar-diffs.txt": "mock"}) 103 103 tool.status_server = MockStatusServer(bot_id="mock-bot-id") 104 104 reporter = FlakyTestReporter(tool, 'dummy-queue') -
trunk/Tools/Scripts/webkitpy/tool/bot/irc_command.py
r90840 r91210 103 103 def _update_working_copy(self, tool): 104 104 tool.scm().ensure_clean_working_directory(force_clean=True) 105 tool.executive.run_and_throw_if_fail(tool.port().update_webkit_command(), quiet=True )105 tool.executive.run_and_throw_if_fail(tool.port().update_webkit_command(), quiet=True, cwd=tool.scm().checkout_root) 106 106 107 107 def execute(self, nick, args, tool, sheriff): -
trunk/Tools/Scripts/webkitpy/tool/bot/irc_command_unittest.py
r90840 r91210 81 81 tool = MockTool() 82 82 tool.executive = MockExecutive(should_log=True) 83 expected_stderr = "MOCK run_and_throw_if_fail: ['mock-update-webkit'] \n"83 expected_stderr = "MOCK run_and_throw_if_fail: ['mock-update-webkit'], cwd=/mock-checkout\n" 84 84 OutputCapture().assert_outputs(self, rollout._update_working_copy, [tool], expected_stderr=expected_stderr) 85 85 -
trunk/Tools/Scripts/webkitpy/tool/bot/layouttestresultsreader.py
r84689 r91210 26 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 29 import os30 28 31 29 from webkitpy.common.net.layouttestresults import LayoutTestResults … … 72 70 # which will not support Chromium. However the new arch doesn't work with old-run-webkit-tests 73 71 # so we have to use this for now. 74 return os.path.dirname(results_path)72 return self._tool.filesystem.dirname(results_path) 75 73 76 74 def archive(self, patch): 77 75 results_directory = self._results_directory() 78 results_name, _ = os.path.splitext(os.path.basename(results_directory))76 results_name, _ = self._tool.filesystem.splitext(self._tool.filesystem.basename(results_directory)) 79 77 # Note: We name the zip with the bug_id instead of patch_id to match work_item_log_path(). 80 78 zip_path = self._tool.workspace.find_unused_filename(self._archive_directory, "%s-%s" % (patch.bug_id(), results_name), "zip") -
trunk/Tools/Scripts/webkitpy/tool/bot/layouttestresultsreader_unittest.py
r85524 r91210 40 40 tool = MockTool() 41 41 reader = LayoutTestResultsReader(tool, "/var/logs") 42 results_path = '/mock /results.html'42 results_path = '/mock-results/results.html' 43 43 tool.filesystem = MockFileSystem({results_path: None}) 44 44 # Make sure that our filesystem mock functions as we expect. … … 62 62 reader = LayoutTestResultsReader(tool, "/var/logs") 63 63 patch = tool.bugs.fetch_attachment(128) 64 tool.filesystem = MockFileSystem() 64 65 # Should fail because the results_directory does not exist. 65 expected_stderr = "/mock does not exist, not archiving.\n"66 expected_stderr = "/mock-results does not exist, not archiving.\n" 66 67 archive = OutputCapture().assert_outputs(self, reader.archive, [patch], expected_stderr=expected_stderr) 67 68 self.assertEqual(archive, None) 68 69 69 results_directory = "/mock "70 results_directory = "/mock-results" 70 71 # Sanity check what we assume our mock results directory is. 71 72 self.assertEqual(reader._results_directory(), results_directory) -
trunk/Tools/Scripts/webkitpy/tool/commands/download_unittest.py
r90513 r91210 126 126 expected_stderr = """Processing 1 patch from 1 bug. 127 127 Updating working directory 128 MOCK run_and_throw_if_fail: ['mock-update-webkit'] 128 MOCK run_and_throw_if_fail: ['mock-update-webkit'], cwd=/mock-checkout 129 129 Processing patch 197 from bug 42. 130 MOCK run_and_throw_if_fail: ['mock-check-webkit-style', '--git-commit', 'MOCK git commit', '--diff-files', 'MockFile1'] 130 MOCK run_and_throw_if_fail: ['mock-check-webkit-style', '--git-commit', 'MOCK git commit', '--diff-files', 'MockFile1'], cwd=/mock-checkout 131 131 """ 132 132 self.assert_execute_outputs(CheckStyle(), [197], options=self._default_options(), expected_stderr=expected_stderr, tool=MockTool(log_executive=True)) -
trunk/Tools/Scripts/webkitpy/tool/commands/earlywarningsystem_unittest.py
r87626 r91210 46 46 ews.bind_to_tool(MockTool()) 47 47 ews._options = MockOptions(port=None, confirm=False) 48 OutputCapture().assert_outputs(self, ews.begin_work_queue, expected_stderr=self._default_begin_work_queue_stderr(ews.name , ews._tool.scm().checkout_root))48 OutputCapture().assert_outputs(self, ews.begin_work_queue, expected_stderr=self._default_begin_work_queue_stderr(ews.name)) 49 49 ews._expected_failures.unexpected_failures_observed = lambda results: set(["foo.html", "bar.html"]) 50 50 task = Mock() … … 60 60 } 61 61 expected_stderr = { 62 "begin_work_queue": self._default_begin_work_queue_stderr(ews.name , ews._tool.scm().checkout_root),62 "begin_work_queue": self._default_begin_work_queue_stderr(ews.name), 63 63 "handle_unexpected_error": "Mock error message\n", 64 64 "next_work_item": "", -
trunk/Tools/Scripts/webkitpy/tool/commands/queues.py
r87626 r91210 96 96 # but the queues don't need live-progress, a dump-of-output at the 97 97 # end should be sufficient. 98 return self._tool.executive.run_and_throw_if_fail(webkit_patch_args )98 return self._tool.executive.run_and_throw_if_fail(webkit_patch_args, cwd=self._tool.scm().checkout_root) 99 99 100 100 def _log_directory(self): -
trunk/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py
r90532 r91210 87 87 expected_run_args.append("--port=%s" % port) 88 88 expected_run_args.extend(run_args) 89 tool.executive.run_and_throw_if_fail.assert_called_with(expected_run_args )89 tool.executive.run_and_throw_if_fail.assert_called_with(expected_run_args, cwd='/mock-checkout') 90 90 91 91 def test_run_webkit_patch(self): … … 136 136 tool = MockTool(log_executive=True) 137 137 expected_stderr = { 138 "begin_work_queue": self._default_begin_work_queue_stderr("feeder-queue" , MockSCM.fake_checkout_root),138 "begin_work_queue": self._default_begin_work_queue_stderr("feeder-queue"), 139 139 "should_proceed_with_work_item": "", 140 140 "next_work_item": "", … … 237 237 def test_commit_queue(self): 238 238 expected_stderr = { 239 "begin_work_queue": self._default_begin_work_queue_stderr("commit-queue" , MockSCM.fake_checkout_root),239 "begin_work_queue": self._default_begin_work_queue_stderr("commit-queue"), 240 240 "should_proceed_with_work_item": "MOCK: update_status: commit-queue Processing patch\n", 241 241 "next_work_item": "", … … 256 256 def test_commit_queue_failure(self): 257 257 expected_stderr = { 258 "begin_work_queue": self._default_begin_work_queue_stderr("commit-queue" , MockSCM.fake_checkout_root),258 "begin_work_queue": self._default_begin_work_queue_stderr("commit-queue"), 259 259 "should_proceed_with_work_item": "MOCK: update_status: commit-queue Processing patch\n", 260 260 "next_work_item": "", … … 283 283 def test_rollout(self): 284 284 tool = MockTool(log_executive=True) 285 tool.filesystem.write_text_file('/mock /results.html', '') # Otherwise the commit-queue will hit a KeyError trying to read the results from the MockFileSystem.285 tool.filesystem.write_text_file('/mock-results/results.html', '') # Otherwise the commit-queue will hit a KeyError trying to read the results from the MockFileSystem. 286 286 tool.buildbot.light_tree_on_fire() 287 287 expected_stderr = { 288 "begin_work_queue": self._default_begin_work_queue_stderr("commit-queue" , MockSCM.fake_checkout_root),288 "begin_work_queue": self._default_begin_work_queue_stderr("commit-queue"), 289 289 "should_proceed_with_work_item": "MOCK: update_status: commit-queue Processing patch\n", 290 290 "next_work_item": "", 291 "process_work_item": """MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'clean'] 291 "process_work_item": """MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'clean'], cwd=/mock-checkout 292 292 MOCK: update_status: commit-queue Cleaned working directory 293 MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'update'] 293 MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'update'], cwd=/mock-checkout 294 294 MOCK: update_status: commit-queue Updated working directory 295 MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'apply-attachment', '--no-update', '--non-interactive', 197] 295 MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'apply-attachment', '--no-update', '--non-interactive', 197], cwd=/mock-checkout 296 296 MOCK: update_status: commit-queue Applied patch 297 MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'build', '--no-clean', '--no-update', '--build-style=both'] 297 MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'build', '--no-clean', '--no-update', '--build-style=both'], cwd=/mock-checkout 298 298 MOCK: update_status: commit-queue Built patch 299 MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'build-and-test', '--no-clean', '--no-update', '--test', '--non-interactive'] 299 MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'build-and-test', '--no-clean', '--no-update', '--test', '--non-interactive'], cwd=/mock-checkout 300 300 MOCK: update_status: commit-queue Passed tests 301 MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'land-attachment', '--force-clean', '--ignore-builders', '--non-interactive', '--parent-command=commit-queue', 197] 301 MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'land-attachment', '--force-clean', '--ignore-builders', '--non-interactive', '--parent-command=commit-queue', 197], cwd=/mock-checkout 302 302 MOCK: update_status: commit-queue Landed patch 303 303 MOCK: update_status: commit-queue Pass … … 315 315 assert(rollout_patch.is_rollout()) 316 316 expected_stderr = { 317 "begin_work_queue": self._default_begin_work_queue_stderr("commit-queue" , MockSCM.fake_checkout_root),317 "begin_work_queue": self._default_begin_work_queue_stderr("commit-queue"), 318 318 "should_proceed_with_work_item": "MOCK: update_status: commit-queue Processing rollout patch\n", 319 319 "next_work_item": "", 320 "process_work_item": """MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'clean'] 320 "process_work_item": """MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'clean'], cwd=/mock-checkout 321 321 MOCK: update_status: commit-queue Cleaned working directory 322 MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'update'] 322 MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'update'], cwd=/mock-checkout 323 323 MOCK: update_status: commit-queue Updated working directory 324 MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'apply-attachment', '--no-update', '--non-interactive', 106] 324 MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'apply-attachment', '--no-update', '--non-interactive', 106], cwd=/mock-checkout 325 325 MOCK: update_status: commit-queue Applied patch 326 MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'land-attachment', '--force-clean', '--ignore-builders', '--non-interactive', '--parent-command=commit-queue', 106] 326 MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'land-attachment', '--force-clean', '--ignore-builders', '--non-interactive', '--parent-command=commit-queue', 106], cwd=/mock-checkout 327 327 MOCK: update_status: commit-queue Landed patch 328 328 MOCK: update_status: commit-queue Pass … … 352 352 queue = SecondThoughtsCommitQueue(MockTool()) 353 353 queue.begin_work_queue() 354 queue._tool.filesystem.write_text_file('/mock /results.html', '') # Otherwise the commit-queue will hit a KeyError trying to read the results from the MockFileSystem.354 queue._tool.filesystem.write_text_file('/mock-results/results.html', '') # Otherwise the commit-queue will hit a KeyError trying to read the results from the MockFileSystem. 355 355 queue._options = Mock() 356 356 queue._options.port = None … … 411 411 def test_style_queue(self): 412 412 expected_stderr = { 413 "begin_work_queue": self._default_begin_work_queue_stderr("style-queue" , MockSCM.fake_checkout_root),413 "begin_work_queue": self._default_begin_work_queue_stderr("style-queue"), 414 414 "next_work_item": "", 415 415 "should_proceed_with_work_item": "MOCK: update_status: style-queue Checking style\n", -
trunk/Tools/Scripts/webkitpy/tool/commands/queuestest.py
r83795 r91210 61 61 expected_exception=exception) 62 62 63 def _default_begin_work_queue_stderr(self, name, checkout_dir): 63 def _default_begin_work_queue_stderr(self, name): 64 checkout_dir = '/mock-checkout' 64 65 string_replacements = {"name": name, 'checkout_dir': checkout_dir} 65 66 return "CAUTION: %(name)s will discard all local changes in \"%(checkout_dir)s\"\nRunning WebKit %(name)s.\nMOCK: update_status: %(name)s Starting Queue\n" % string_replacements … … 70 71 # This is a hack to make it easy for callers to not have to setup a custom MockFileSystem just to test the commit-queue 71 72 # the cq tries to read the layout test results, and will hit a KeyError in MockFileSystem if we don't do this. 72 tool.filesystem.write_text_file('/mock /results.html', "")73 tool.filesystem.write_text_file('/mock-results/results.html', "") 73 74 if not expected_stdout: 74 75 expected_stdout = {} -
trunk/Tools/Scripts/webkitpy/tool/mocktool.py
r91144 r91210 480 480 481 481 class MockSCM(object): 482 483 fake_checkout_root = os.path.realpath("/tmp") # realpath is needed to allow for Mac OS X's /private/tmp484 485 482 def __init__(self, filesystem=None, executive=None): 486 # FIXME: We should probably use real checkout-root detection logic here. 487 # os.getcwd() can't work here because other parts of the code assume that "checkout_root" 488 # will actually be the root. Since getcwd() is wrong, use a globally fake root for now. 489 self.checkout_root = self.fake_checkout_root 483 self.checkout_root = "/mock-checkout" 490 484 self.added_paths = set() 491 485 self._filesystem = filesystem or MockFileSystem() … … 723 717 self._should_throw = should_throw 724 718 725 def run_and_throw_if_fail(self, args, quiet=False ):719 def run_and_throw_if_fail(self, args, quiet=False, cwd=None): 726 720 if self._should_log: 727 log("MOCK run_and_throw_if_fail: %s " % args)721 log("MOCK run_and_throw_if_fail: %s, cwd=%s" % (args, cwd)) 728 722 return "MOCK output of child process" 729 723 … … 737 731 decode_output=False): 738 732 if self._should_log: 739 log("MOCK run_command: %s " % args)733 log("MOCK run_command: %s, cwd=%s" % (args, cwd)) 740 734 if self._should_throw: 741 735 raise ScriptError("MOCK ScriptError") … … 761 755 762 756 def layout_tests_results_path(self): 763 return "/mock /results.html"757 return "/mock-results/results.html" 764 758 765 759 def check_webkit_style_command(self): -
trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver.py
r91144 r91210 54 54 55 55 def _run_webkit_patch(self, args): 56 return self.server.tool.executive.run_command([self.server.tool.path()] + args )56 return self.server.tool.executive.run_command([self.server.tool.path()] + args, cwd=self.server.tool.scm().checkout_root) 57 57 58 58 def changelog(self): … … 62 62 # Updating the working copy could conflict with any rebaselines we have in progress. 63 63 update_webkit_command = self.server.tool.port().update_webkit_command() 64 self.server.tool.executive.run_and_throw_if_fail(update_webkit_command, quiet=True )64 self.server.tool.executive.run_and_throw_if_fail(update_webkit_command, quiet=True, cwd=self.server.tool.scm().checkout_root) 65 65 commit_info = self.server.tool.checkout().commit_info_for_revision(revision) 66 66 if not commit_info: -
trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py
r91144 r91210 71 71 72 72 def test_changelog(self): 73 expected_stderr = "MOCK run_and_throw_if_fail: ['mock-update-webkit'] \n"73 expected_stderr = "MOCK run_and_throw_if_fail: ['mock-update-webkit'], cwd=/mock-checkout\n" 74 74 expected_stdout = """== Begin JSON Response == 75 75 {"bug_id": 42, "author_email": "abarth@webkit.org", "reviewer_text": "Darin Adler", "author_name": "Adam Barth", "changed_files": ["path/to/file", "another/file"]} … … 83 83 84 84 def test_rollout(self): 85 expected_stderr = "MOCK run_command: ['echo', 'rollout', '--force-clean', '--non-interactive', '2314', 'MOCK rollout reason'] \n"85 expected_stderr = "MOCK run_command: ['echo', 'rollout', '--force-clean', '--non-interactive', '2314', 'MOCK rollout reason'], cwd=/mock-checkout\n" 86 86 expected_stdout = "== Begin Response ==\nsuccess\n== End Response ==\n" 87 87 self._post_to_path("/rollout?revision=2314&reason=MOCK+rollout+reason", expected_stderr=expected_stderr, expected_stdout=expected_stdout) 88 88 89 89 def test_rebaseline(self): 90 expected_stderr = "MOCK run_command: ['echo', 'rebaseline-test', 'MOCK builder', 'user-scripts/another-test.html', 'txt'] \n"90 expected_stderr = "MOCK run_command: ['echo', 'rebaseline-test', 'MOCK builder', 'user-scripts/another-test.html', 'txt'], cwd=/mock-checkout\n" 91 91 expected_stdout = "== Begin Response ==\nsuccess\n== End Response ==\n" 92 92 self._post_to_path("/rebaseline?builder=MOCK+builder&test=user-scripts/another-test.html&suffix=txt", expected_stderr=expected_stderr, expected_stdout=expected_stdout) -
trunk/Tools/Scripts/webkitpy/tool/servers/rebaselineserver_unittest.py
r90546 r91210 293 293 def get_test_config(test_files=[], result_files=[]): 294 294 # We could grab this from port.layout_tests_dir(), but instantiating a fully mocked port is a pain. 295 layout_tests_directory = "/mock /LayoutTests"295 layout_tests_directory = "/mock-checkout/LayoutTests" 296 296 results_directory = '/WebKitBuild/Debug/layout-test-results' 297 297 mock_filesystem = filesystem_mock.MockFileSystem() -
trunk/Tools/Scripts/webkitpy/tool/steps/build.py
r69829 r91210 42 42 43 43 def build(self, build_style): 44 self._tool.executive.run_and_throw_if_fail(self._tool.port().build_webkit_command(build_style=build_style), self._options.quiet )44 self._tool.executive.run_and_throw_if_fail(self._tool.port().build_webkit_command(build_style=build_style), self._options.quiet, cwd=self._tool.scm().checkout_root) 45 45 46 46 def run(self, state): -
trunk/Tools/Scripts/webkitpy/tool/steps/checkstyle.py
r83158 r91210 46 46 if not self._options.check_style: 47 47 return 48 os.chdir(self._tool.scm().checkout_root)49 48 50 49 args = [] … … 57 56 58 57 try: 59 self._tool.executive.run_and_throw_if_fail(self._tool.port().check_webkit_style_command() + args )58 self._tool.executive.run_and_throw_if_fail(self._tool.port().check_webkit_style_command() + args, cwd=self._tool.scm().checkout_root) 60 59 except ScriptError, e: 61 60 if self._options.non_interactive: -
trunk/Tools/Scripts/webkitpy/tool/steps/cleanworkingdirectory_unittest.py
r90978 r91210 38 38 tool = MockTool() 39 39 tool._scm = Mock() 40 tool._scm.checkout_root = '/mock '40 tool._scm.checkout_root = '/mock-checkout' 41 41 step = CleanWorkingDirectory(tool, MockOptions(clean=True, force_clean=False)) 42 42 step.run({}) -
trunk/Tools/Scripts/webkitpy/tool/steps/editchangelog.py
r70059 r91210 34 34 class EditChangeLog(AbstractStep): 35 35 def run(self, state): 36 os.chdir(self._tool.scm().checkout_root)37 self._tool.user.edit_changelog( self.cached_lookup(state, "changelogs"))36 absolute_paths = map(self._tool.scm().absolute_path, self.cached_lookup(state, "changelogs")) 37 self._tool.user.edit_changelog(absolute_paths) 38 38 self.did_modify_checkout(state) -
trunk/Tools/Scripts/webkitpy/tool/steps/preparechangelog.py
r82771 r91210 61 61 self._ensure_bug_url(state) 62 62 return 63 os.chdir(self._tool.scm().checkout_root)64 63 args = self._tool.port().prepare_changelog_command() 65 64 if state.get("bug_id"): … … 75 74 76 75 try: 77 self._tool.executive.run_and_throw_if_fail(args, self._options.quiet )76 self._tool.executive.run_and_throw_if_fail(args, self._options.quiet, cwd=self._tool.scm().checkout_root) 78 77 except ScriptError, e: 79 78 error("Unable to prepare ChangeLogs.") -
trunk/Tools/Scripts/webkitpy/tool/steps/preparechangelogforrevert.py
r82771 r91210 51 51 def run(self, state): 52 52 # This could move to prepare-ChangeLog by adding a --revert= option. 53 self._tool.executive.run_and_throw_if_fail(self._tool.port().prepare_changelog_command() )53 self._tool.executive.run_and_throw_if_fail(self._tool.port().prepare_changelog_command(), cwd=self._tool.scm().checkout_root) 54 54 changelog_paths = self._tool.checkout().modified_changelogs(git_commit=None) 55 55 bug_url = self._tool.bugs.bug_url_for_bug_id(state["bug_id"]) if state["bug_id"] else None -
trunk/Tools/Scripts/webkitpy/tool/steps/runtests.py
r89289 r91210 50 50 if python_unittests_command: 51 51 log("Running Python unit tests") 52 self._tool.executive.run_and_throw_if_fail(python_unittests_command )52 self._tool.executive.run_and_throw_if_fail(python_unittests_command, cwd=self._tool.scm().checkout_root) 53 53 54 54 perl_unittests_command = self._tool.port().run_perl_unittests_command() 55 55 if perl_unittests_command: 56 56 log("Running Perl unit tests") 57 self._tool.executive.run_and_throw_if_fail(perl_unittests_command )57 self._tool.executive.run_and_throw_if_fail(perl_unittests_command, cwd=self._tool.scm().checkout_root) 58 58 59 59 bindings_tests_command = self._tool.port().run_bindings_tests_command() 60 60 if bindings_tests_command: 61 61 log("Running Bindings tests") 62 self._tool.executive.run_and_throw_if_fail(bindings_tests_command )62 self._tool.executive.run_and_throw_if_fail(bindings_tests_command, cwd=self._tool.scm().checkout_root) 63 63 64 64 javascriptcore_tests_command = self._tool.port().run_javascriptcore_tests_command() 65 65 if javascriptcore_tests_command: 66 66 log("Running JavaScriptCore tests") 67 self._tool.executive.run_and_throw_if_fail(javascriptcore_tests_command, quiet=True )67 self._tool.executive.run_and_throw_if_fail(javascriptcore_tests_command, quiet=True, cwd=self._tool.scm().checkout_root) 68 68 69 69 log("Running run-webkit-tests") … … 76 76 if self._options.quiet: 77 77 args.append("--quiet") 78 self._tool.executive.run_and_throw_if_fail(args )78 self._tool.executive.run_and_throw_if_fail(args, cwd=self._tool.scm().checkout_root) 79 79 -
trunk/Tools/Scripts/webkitpy/tool/steps/steps_unittest.py
r89289 r91210 77 77 step = RunTests(tool, mock_options) 78 78 expected_stderr = """Running Python unit tests 79 MOCK run_and_throw_if_fail: ['Tools/Scripts/test-webkitpy'] 79 MOCK run_and_throw_if_fail: ['Tools/Scripts/test-webkitpy'], cwd=/mock-checkout 80 80 Running Perl unit tests 81 MOCK run_and_throw_if_fail: ['Tools/Scripts/test-webkitperl'] 81 MOCK run_and_throw_if_fail: ['Tools/Scripts/test-webkitperl'], cwd=/mock-checkout 82 82 Running Bindings tests 83 MOCK run_and_throw_if_fail: ['Tools/Scripts/run-bindings-tests'] 83 MOCK run_and_throw_if_fail: ['Tools/Scripts/run-bindings-tests'], cwd=/mock-checkout 84 84 Running JavaScriptCore tests 85 MOCK run_and_throw_if_fail: ['Tools/Scripts/run-javascriptcore-tests'] 85 MOCK run_and_throw_if_fail: ['Tools/Scripts/run-javascriptcore-tests'], cwd=/mock-checkout 86 86 Running run-webkit-tests 87 MOCK run_and_throw_if_fail: ['Tools/Scripts/run-webkit-tests', '--no-new-test-results', '--no-launch-safari', '--exit-after-n-failures=20', '--quiet'] 87 MOCK run_and_throw_if_fail: ['Tools/Scripts/run-webkit-tests', '--no-new-test-results', '--no-launch-safari', '--exit-after-n-failures=20', '--quiet'], cwd=/mock-checkout 88 88 """ 89 89 OutputCapture().assert_outputs(self, step.run, [{}], expected_stderr=expected_stderr) -
trunk/Tools/Scripts/webkitpy/tool/steps/update.py
r74914 r91210 44 44 return 45 45 log("Updating working directory") 46 self._tool.executive.run_and_throw_if_fail(self._tool.port().update_webkit_command(), quiet=self._options.quiet )46 self._tool.executive.run_and_throw_if_fail(self._tool.port().update_webkit_command(), quiet=self._options.quiet, cwd=self._tool.scm().checkout_root)
Note: See TracChangeset
for help on using the changeset viewer.