Commit aa663460 authored by dpranke@chromium.org's avatar dpranke@chromium.org
Browse files

2011-01-18 Dirk Pranke <dpranke@chromium.org>

        Reviewed by Mihai Parparita.

        new-run-webkit-tests shouldn't crash when you try to run a
        directory containing only skipped files.

        https://bugs.webkit.org/show_bug.cgi?id=52478

        * Scripts/webkitpy/layout_tests/layout_package/test_runner.py:
        * Scripts/webkitpy/layout_tests/port/test.py:
        * Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76045 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 99abb088
2011-01-18 Dirk Pranke <dpranke@chromium.org>
Reviewed by Mihai Parparita.
new-run-webkit-tests shouldn't crash when you try to run a
directory containing only skipped files.
https://bugs.webkit.org/show_bug.cgi?id=52478
* Scripts/webkitpy/layout_tests/layout_package/test_runner.py:
* Scripts/webkitpy/layout_tests/port/test.py:
* Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py:
2011-01-18 Adam Bergkvist <adam.bergkvist@ericsson.com> and Martin Robinson <mrobinson@igalia.com>
 
Reviewed by Gustavo Noronha Silva.
......@@ -199,12 +199,15 @@ class TestRunner:
last_unexpected_results: list of unexpected results to retest, if any
"""
paths = [self._strip_test_dir_prefix(arg) for arg in args if arg and arg != '']
paths = self._strip_test_dir_prefixes(args)
paths += last_unexpected_results
if self._options.test_list:
paths += read_test_files(self._options.test_list)
paths += self._strip_test_dir_prefixes(read_test_files(self._options.test_list))
self._test_files = self._port.tests(paths)
def _strip_test_dir_prefixes(self, paths):
return [self._strip_test_dir_prefix(path) for path in paths if path]
def _strip_test_dir_prefix(self, path):
if path.startswith(LAYOUT_TESTS_DIRECTORY):
return path[len(LAYOUT_TESTS_DIRECTORY):]
......@@ -390,6 +393,11 @@ class TestRunner:
result_summary.add(result, expected=True)
self._printer.print_expected('')
# Check to make sure we didn't filter out all of the tests.
if not len(self._test_files):
_log.info("All tests are being skipped")
return None
return result_summary
def _get_dir_for_test_file(self, test_file):
......
......@@ -213,7 +213,7 @@ class TestPort(base.Port):
def layout_tests_dir(self):
return self.path_from_webkit_base('Tools', 'Scripts',
'webkitpy', 'layout_tests', 'data')
'webkitpy', 'layout_tests', 'data', 'LayoutTests')
def path_isdir(self, path):
# Used by test_expectations.py
......
......@@ -315,6 +315,14 @@ class MainTest(unittest.TestCase):
tests_run = get_tests_run(['passes/text.html'], tests_included=True, flatten_batches=True)
self.assertEquals(['passes/text.html'], tests_run)
def test_single_file_with_prefix(self):
tests_run = get_tests_run(['LayoutTests/passes/text.html'], tests_included=True, flatten_batches=True)
self.assertEquals(['passes/text.html'], tests_run)
def test_single_skipped_file(self):
tests_run = get_tests_run(['failures/expected/keybaord.html'], tests_included=True, flatten_batches=True)
self.assertEquals([], tests_run)
def test_test_list(self):
filename = tempfile.mktemp()
tmpfile = file(filename, mode='w+')
......@@ -328,6 +336,14 @@ class MainTest(unittest.TestCase):
self.assertEqual(res, -1)
self.assertFalse(err.empty())
def test_test_list_with_prefix(self):
filename = tempfile.mktemp()
tmpfile = file(filename, mode='w+')
tmpfile.write('LayoutTests/passes/text.html')
tmpfile.close()
tests_run = get_tests_run(['--test-list=%s' % filename], tests_included=True, flatten_batches=True)
self.assertEquals(['passes/text.html'], tests_run)
def test_unexpected_failures(self):
# Run tests including the unexpected failures.
self._url_opened = None
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment