summaryrefslogtreecommitdiffstats
path: root/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py')
-rw-r--r--Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py57
1 files changed, 33 insertions, 24 deletions
diff --git a/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py b/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py
index 677becd..84f5718 100644
--- a/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py
+++ b/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py
@@ -45,7 +45,7 @@ import unittest
from webkitpy.common import array_stream
from webkitpy.common.system import outputcapture
from webkitpy.common.system import filesystem_mock
-from webkitpy.common.system import user
+from webkitpy.tool import mocktool
from webkitpy.layout_tests import port
from webkitpy.layout_tests import run_webkit_tests
from webkitpy.layout_tests.layout_package import dump_render_tree_thread
@@ -56,14 +56,6 @@ from webkitpy.test.skip import skip_if
from webkitpy.thirdparty.mock import Mock
-class MockUser():
- def __init__(self):
- self.url = None
-
- def open_url(self, url):
- self.url = url
-
-
def parse_args(extra_args=None, record_results=False, tests_included=False,
print_nothing=True):
extra_args = extra_args or []
@@ -93,7 +85,7 @@ def passing_run(extra_args=None, port_obj=None, record_results=False,
tests_included)
if not port_obj:
port_obj = port.get(port_name=options.platform, options=options,
- user=MockUser(), filesystem=filesystem)
+ user=mocktool.MockUser(), filesystem=filesystem)
res = run_webkit_tests.run(port_obj, options, parsed_args)
return res == 0
@@ -103,7 +95,7 @@ def logging_run(extra_args=None, port_obj=None, record_results=False, tests_incl
record_results=record_results,
tests_included=tests_included,
print_nothing=False)
- user = MockUser()
+ user = mocktool.MockUser()
if not port_obj:
port_obj = port.get(port_name=options.platform, options=options,
user=user, filesystem=filesystem)
@@ -135,7 +127,7 @@ def get_tests_run(extra_args=None, tests_included=False, flatten_batches=False,
extra_args = ['passes', 'failures'] + extra_args
options, parsed_args = parse_args(extra_args, tests_included=True)
- user = MockUser()
+ user = mocktool.MockUser()
test_batches = []
@@ -216,7 +208,8 @@ class MainTest(unittest.TestCase):
def test_full_results_html(self):
# FIXME: verify html?
- self.assertTrue(passing_run(['--full-results-html']))
+ res, out, err, user = logging_run(['--full-results-html'])
+ self.assertEqual(res, 0)
def test_help_printing(self):
res, out, err, user = logging_run(['--help-printing'])
@@ -256,7 +249,7 @@ class MainTest(unittest.TestCase):
def test_lint_test_files__errors(self):
options, parsed_args = parse_args(['--lint-test-files'])
- user = MockUser()
+ user = mocktool.MockUser()
port_obj = port.get(options.platform, options=options, user=user)
port_obj.test_expectations = lambda: "# syntax error"
res, out, err = run_and_capture(port_obj, options, parsed_args)
@@ -352,7 +345,7 @@ class MainTest(unittest.TestCase):
self.assertEqual(res, 3)
self.assertFalse(out.empty())
self.assertFalse(err.empty())
- self.assertEqual(user.url, '/tmp/layout-test-results/results.html')
+ self.assertEqual(user.opened_urls, ['/tmp/layout-test-results/results.html'])
def test_exit_after_n_failures(self):
# Unexpected failures should result in tests stopping.
@@ -414,7 +407,7 @@ class MainTest(unittest.TestCase):
with fs.mkdtemp() as tmpdir:
res, out, err, user = logging_run(['--results-directory=' + str(tmpdir)],
tests_included=True, filesystem=fs)
- self.assertEqual(user.url, fs.join(tmpdir, 'results.html'))
+ self.assertEqual(user.opened_urls, [fs.join(tmpdir, 'results.html')])
def test_results_directory_default(self):
# We run a configuration that should fail, to generate output, then
@@ -422,7 +415,7 @@ class MainTest(unittest.TestCase):
# This is the default location.
res, out, err, user = logging_run(tests_included=True)
- self.assertEqual(user.url, '/tmp/layout-test-results/results.html')
+ self.assertEqual(user.opened_urls, ['/tmp/layout-test-results/results.html'])
def test_results_directory_relative(self):
# We run a configuration that should fail, to generate output, then
@@ -430,7 +423,7 @@ class MainTest(unittest.TestCase):
res, out, err, user = logging_run(['--results-directory=foo'],
tests_included=True)
- self.assertEqual(user.url, '/tmp/foo/results.html')
+ self.assertEqual(user.opened_urls, ['/tmp/foo/results.html'])
def test_tolerance(self):
class ImageDiffTestPort(TestPort):
@@ -441,7 +434,7 @@ class MainTest(unittest.TestCase):
def get_port_for_run(args):
options, parsed_args = run_webkit_tests.parse_args(args)
- test_port = ImageDiffTestPort(options=options, user=MockUser())
+ test_port = ImageDiffTestPort(options=options, user=mocktool.MockUser())
passing_run(args, port_obj=test_port, tests_included=True)
return test_port
@@ -459,11 +452,27 @@ class MainTest(unittest.TestCase):
self.assertEqual(None, test_port.tolerance_used_for_diff_image)
def test_worker_model__inline(self):
+ self.assertTrue(passing_run(['--worker-model', 'inline']))
+
+ def test_worker_model__old_inline_with_child_processes(self):
+ res, out, err, user = logging_run(['--worker-model', 'old-inline',
+ '--child-processes', '2'])
+ self.assertEqual(res, 0)
+ self.assertTrue('--worker-model=old-inline overrides --child-processes\n' in err.get())
+
+ def test_worker_model__old_inline(self):
self.assertTrue(passing_run(['--worker-model', 'old-inline']))
- def test_worker_model__threads(self):
+ def test_worker_model__old_threads(self):
self.assertTrue(passing_run(['--worker-model', 'old-threads']))
+ def test_worker_model__processes(self):
+ if compare_version(sys, '2.6')[0] >= 0:
+ self.assertTrue(passing_run(['--worker-model', 'processes']))
+
+ def test_worker_model__threads(self):
+ self.assertTrue(passing_run(['--worker-model', 'threads']))
+
def test_worker_model__unknown(self):
self.assertRaises(ValueError, logging_run,
['--worker-model', 'unknown'])
@@ -491,7 +500,7 @@ class RebaselineTest(unittest.TestCase):
'failures/expected/missing_image.html'],
tests_included=True, filesystem=fs)
file_list = fs.written_files.keys()
- file_list.remove('/tmp/layout-test-results/tests_run.txt')
+ file_list.remove('/tmp/layout-test-results/tests_run0.txt')
self.assertEqual(len(file_list), 6)
self.assertBaselines(file_list,
"/passes/image")
@@ -508,12 +517,12 @@ class RebaselineTest(unittest.TestCase):
'failures/expected/missing_image.html'],
tests_included=True, filesystem=fs)
file_list = fs.written_files.keys()
- file_list.remove('/tmp/layout-test-results/tests_run.txt')
+ file_list.remove('/tmp/layout-test-results/tests_run0.txt')
self.assertEqual(len(file_list), 6)
self.assertBaselines(file_list,
- "/platform/test/passes/image")
+ "/platform/test-mac/passes/image")
self.assertBaselines(file_list,
- "/platform/test/failures/expected/missing_image")
+ "/platform/test-mac/failures/expected/missing_image")
class DryrunTest(unittest.TestCase):