def test_patch_not_relevant_bindings(self): self.maxDiff = None mock_options = self._step_options() mock_options.group = "bindings" tool = MockTool(log_executive=True) tool.scm()._mockChangedFiles = ["Source/JavaScriptCore/Makefile", "Source/ChangeLog"] # FIXME: We shouldn't use a real port-object here, but there is too much to mock at the moment. tool._deprecated_port = DeprecatedPort() step = steps.CheckPatchRelevance(tool, mock_options) expected_logs = """Checking relevance of patch
def test_patch_relevant(self): self.maxDiff = None mock_options = self._step_options() tool = MockTool(log_executive=True) tool.scm()._mockChangedFiles = ["JSTests/MockFile1", "ChangeLog"] # FIXME: We shouldn't use a real port-object here, but there is too much to mock at the moment. tool._deprecated_port = DeprecatedPort() step = steps.CheckPatchRelevance(tool, mock_options) expected_logs = """Checking relevance of patch """ OutputCapture().assert_outputs(self, step.run, [{}], expected_logs=expected_logs)
def test_runtests_api_debug(self): mock_options = self._step_options() mock_options.non_interactive = False mock_options.build_style = "debug" mock_options.group = "api" step = steps.RunTests(MockTool(log_executive=True), mock_options) tool = MockTool(log_executive=True) tool._deprecated_port = DeprecatedPort() step = steps.RunTests(tool, mock_options) expected_logs = """MOCK run_and_throw_if_fail: ['Tools/Scripts/run-api-tests', '--debug', '--json-output=/tmp/api_test_results.json'], cwd=/mock-checkout """ OutputCapture().assert_outputs(self, step.run, [{}], expected_logs=expected_logs)
def test_runtests_webkitpy(self): mock_options = self._step_options() mock_options.non_interactive = False mock_options.group = "webkitpy" step = steps.RunTests(MockTool(log_executive=True), mock_options) tool = MockTool(log_executive=True) # FIXME: We shouldn't use a real port-object here, but there is too much to mock at the moment. tool._deprecated_port = DeprecatedPort() step = steps.RunTests(tool, mock_options) expected_logs = """MOCK run_and_throw_if_fail: ['Tools/Scripts/test-webkitpy', '--json-output=/tmp/python-unittest-results/webkitpy_test_results.json'], cwd=/mock-checkout """ OutputCapture().assert_outputs(self, step.run, [{}], expected_logs=expected_logs)
def test_runtests_jsc_debug(self): mock_options = self._step_options() mock_options.non_interactive = False mock_options.build_style = "debug" mock_options.group = "jsc" tool = MockTool(log_executive=True) # FIXME: We shouldn't use a real port-object here, but there is too much to mock at the moment. tool._deprecated_port = DeprecatedPort() step = steps.RunTests(tool, mock_options) expected_logs = """MOCK run_and_throw_if_fail: ['Tools/Scripts/run-javascriptcore-tests', '--no-fail-fast', '--debug', '--json-output=/tmp/jsc_test_results.json'], cwd=/mock-checkout """ OutputCapture().assert_outputs(self, step.run, [{}], expected_logs=expected_logs)
def test_patch_not_relevant_jsc(self): self.maxDiff = None mock_options = self._step_options() mock_options.group = "jsc" tool = MockTool(log_executive=True) tool.scm()._mockChangedFiles = ["Tools/ChangeLog", "Tools/Scripts/webkitpy/tool/steps/steps_unittest.py"] # FIXME: We shouldn't use a real port-object here, but there is too much to mock at the moment. tool._deprecated_port = DeprecatedPort() step = steps.CheckPatchRelevance(tool, mock_options) expected_logs = """Checking relevance of patch This patch does not have relevant changes. """ with self.assertRaises(ScriptError): OutputCapture().assert_outputs(self, step.run, [{}], expected_logs=expected_logs)
def test_patch_relevant(self): self.maxDiff = None mock_options = self._step_options() tool = MockTool(log_executive=True) tool.scm()._mockChangedFiles = ["JSTests/MockFile1", "ChangeLog"] # FIXME: We shouldn't use a real port-object here, but there is too much to mock at the moment. tool._deprecated_port = DeprecatedPort() step = steps.CheckPatchRelevance(tool, mock_options) with OutputCapture(level=logging.INFO) as captured: step.run({}) self.assertEqual( captured.root.log.getvalue(), 'Checking relevance of patch\n', )
def test_build_jsc(self): mock_options = self._step_options() mock_options.non_interactive = False mock_options.build_style = "release" mock_options.build = True mock_options.architecture = True mock_options.group = "jsc" tool = MockTool(log_executive=True) # FIXME: We shouldn't use a real port-object here, but there is too much to mock at the moment. tool._deprecated_port = DeprecatedPort() step = steps.Build(tool, mock_options) expected_logs = """Building WebKit MOCK run_and_throw_if_fail: ['Tools/Scripts/build-jsc', '--release', 'ARCHS=True'], cwd=/mock-checkout, env={'MOCK_ENVIRON_COPY': '1', 'TERM': 'dumb'} """ OutputCapture().assert_outputs(self, step.run, [{}], expected_logs=expected_logs)
def test_runtests_jsc_debug(self): mock_options = self._step_options() mock_options.non_interactive = False mock_options.build_style = "debug" mock_options.group = "jsc" tool = MockTool(log_executive=True) # FIXME: We shouldn't use a real port-object here, but there is too much to mock at the moment. tool._deprecated_port = DeprecatedPort() step = steps.RunTests(tool, mock_options) with OutputCapture(level=logging.INFO) as captured: step.run({}) self.assertEqual( captured.root.log.getvalue(), "MOCK run_and_throw_if_fail: ['Tools/Scripts/run-javascriptcore-tests', '--no-fail-fast', '--debug', '--json-output=/tmp/jsc_test_results.json'], cwd=/mock-checkout\n", )
def test_runtests_jsc(self): mock_options = self._step_options() mock_options.non_interactive = False mock_options.build_style = "release" mock_options.group = "jsc" step = steps.RunTests(MockTool(log_executive=True), mock_options) tool = MockTool(log_executive=True) # FIXME: We shouldn't use a real port-object here, but there is too much to mock at the moment. tool._deprecated_port = DeprecatedPort() step = steps.RunTests(tool, mock_options) expected_logs = """MOCK run_command: ['perl', 'Tools/Scripts/webkit-build-directory', '--configuration', '--release', '--mac'], cwd=/mock-checkout MOCK run_and_throw_if_fail: ['Tools/Scripts/run-javascriptcore-tests', '--no-fail-fast', '--release', '--json-output=/MOCK output of child process/jsc_test_results.json'], cwd=/mock-checkout """ OutputCapture().assert_outputs(self, step.run, [{}], expected_logs=expected_logs)
def test_runtests_debug_args(self): mock_options = self._step_options() mock_options.non_interactive = False mock_options.build_style = "debug" step = steps.RunTests(MockTool(log_executive=True), mock_options) tool = MockTool(log_executive=True) # FIXME: We shouldn't use a real port-object here, but there is too much to mock at the moment. tool._deprecated_port = DeprecatedPort() step = steps.RunTests(tool, mock_options) expected_logs = """Running Python unit tests MOCK run_and_throw_if_fail: ['Tools/Scripts/test-webkitpy'], cwd=/mock-checkout Running Perl unit tests MOCK run_and_throw_if_fail: ['Tools/Scripts/test-webkitperl'], cwd=/mock-checkout Running JavaScriptCore tests MOCK run_and_throw_if_fail: ['Tools/Scripts/run-javascriptcore-tests', '--no-fail-fast'], cwd=/mock-checkout Running run-webkit-tests MOCK run_and_throw_if_fail: ['Tools/Scripts/run-webkit-tests', '--debug', '--quiet'], cwd=/mock-checkout """ OutputCapture().assert_outputs(self, step.run, [{}], expected_logs=expected_logs)
def test_build_jsc(self): mock_options = self._step_options() mock_options.non_interactive = False mock_options.build_style = "release" mock_options.build = True mock_options.architecture = True mock_options.group = "jsc" tool = MockTool(log_executive=True) # FIXME: We shouldn't use a real port-object here, but there is too much to mock at the moment. tool._deprecated_port = DeprecatedPort() step = steps.Build(tool, mock_options) with OutputCapture(level=logging.INFO) as captured: step.run({}) self.assertEqual( captured.root.log.getvalue(), '''Building WebKit MOCK run_and_throw_if_fail: ['Tools/Scripts/build-jsc', '--release', 'ARCHS=True'], cwd=/mock-checkout, env={'MOCK_ENVIRON_COPY': '1', 'TERM': 'dumb'} ''', )
def test_patch_not_relevant_jsc(self): self.maxDiff = None mock_options = self._step_options() mock_options.group = "jsc" tool = MockTool(log_executive=True) tool.scm()._mockChangedFiles = [ "Tools/ChangeLog", "Tools/Scripts/webkitpy/tool/steps/steps_unittest.py" ] # FIXME: We shouldn't use a real port-object here, but there is too much to mock at the moment. tool._deprecated_port = DeprecatedPort() step = steps.CheckPatchRelevance(tool, mock_options) with self.assertRaises(ScriptError), OutputCapture( level=logging.INFO) as captured: step.run({}) self.assertEqual( captured.root.log.getvalue(), 'Checking relevance of patch\n', )
def test_runtests_debug_args(self): mock_options = self._step_options() mock_options.non_interactive = False mock_options.build_style = "debug" step = steps.RunTests(MockTool(log_executive=True), mock_options) tool = MockTool(log_executive=True) # FIXME: We shouldn't use a real port-object here, but there is too much to mock at the moment. tool._deprecated_port = DeprecatedPort() step = steps.RunTests(tool, mock_options) with OutputCapture(level=logging.INFO) as captured: step.run({}) self.assertEqual( captured.root.log.getvalue(), '''Running Python unit tests MOCK run_and_throw_if_fail: ['Tools/Scripts/test-webkitpy'], cwd=/mock-checkout Running Perl unit tests MOCK run_and_throw_if_fail: ['Tools/Scripts/test-webkitperl'], cwd=/mock-checkout Running JavaScriptCore tests MOCK run_and_throw_if_fail: ['Tools/Scripts/run-javascriptcore-tests', '--no-fail-fast'], cwd=/mock-checkout Running run-webkit-tests MOCK run_and_throw_if_fail: ['Tools/Scripts/run-webkit-tests', '--debug', '--quiet'], cwd=/mock-checkout ''', )