2011-01-18 Dirk Pranke <dpranke@chromium.org>
authordpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Jan 2011 20:32:22 +0000 (20:32 +0000)
committerdpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Jan 2011 20:32:22 +0000 (20:32 +0000)
        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
Tools/Scripts/webkitpy/layout_tests/layout_package/test_runner.py
Tools/Scripts/webkitpy/layout_tests/port/test.py
Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py

index fd18ba00560ea943b92fc5825ffc085fe4cfe1d7..2a97e83a529b644f8cd281ca51a411b769cff54d 100644 (file)
@@ -1,3 +1,16 @@
+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.
index 5b02a006d98c50424fb577499b9103868899959a..2f63ec872a1118aa6a60ff4197c45b629931d813 100644 (file)
@@ -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):
index 935881c276a27645562e43e511b2f4f6e1cce911..c96466c1f9705a450f6fab9a58a0a29b07d9c72f 100644 (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
index 2bfac2f4cf65d13953281804716aaf8f05bd135d..af1c6e16b90a535380cc6982228c2e35f4e130af 100644 (file)
@@ -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