From aa6634606fb3fc5270a6e074b76daca849d9c536 Mon Sep 17 00:00:00 2001 From: "dpranke@chromium.org" Date: Tue, 18 Jan 2011 20:32:22 +0000 Subject: [PATCH] 2011-01-18 Dirk Pranke 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 --- Tools/ChangeLog | 13 +++++++++++++ .../layout_tests/layout_package/test_runner.py | 12 ++++++++++-- Tools/Scripts/webkitpy/layout_tests/port/test.py | 2 +- .../layout_tests/run_webkit_tests_unittest.py | 16 ++++++++++++++++ 4 files changed, 40 insertions(+), 3 deletions(-) diff --git a/Tools/ChangeLog b/Tools/ChangeLog index fd18ba00560e..2a97e83a529b 100644 --- a/Tools/ChangeLog +++ b/Tools/ChangeLog @@ -1,3 +1,16 @@ +2011-01-18 Dirk Pranke + + 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 and Martin Robinson Reviewed by Gustavo Noronha Silva. diff --git a/Tools/Scripts/webkitpy/layout_tests/layout_package/test_runner.py b/Tools/Scripts/webkitpy/layout_tests/layout_package/test_runner.py index 5b02a006d98c..2f63ec872a11 100644 --- a/Tools/Scripts/webkitpy/layout_tests/layout_package/test_runner.py +++ b/Tools/Scripts/webkitpy/layout_tests/layout_package/test_runner.py @@ -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): diff --git a/Tools/Scripts/webkitpy/layout_tests/port/test.py b/Tools/Scripts/webkitpy/layout_tests/port/test.py index 935881c276a2..c96466c1f970 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/test.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/test.py @@ -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 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 2bfac2f4cf65..af1c6e16b90a 100644 --- a/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.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 -- 2.36.0