summaryrefslogtreecommitdiff
path: root/Tools/Scripts/webkitpy/test
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/Scripts/webkitpy/test')
-rw-r--r--Tools/Scripts/webkitpy/test/main.py16
-rw-r--r--Tools/Scripts/webkitpy/test/main_unittest.py62
2 files changed, 68 insertions, 10 deletions
diff --git a/Tools/Scripts/webkitpy/test/main.py b/Tools/Scripts/webkitpy/test/main.py
index 852413299..e639a4578 100644
--- a/Tools/Scripts/webkitpy/test/main.py
+++ b/Tools/Scripts/webkitpy/test/main.py
@@ -178,17 +178,19 @@ class Tester(object):
return True
def _test_names(self, loader, names):
+ parallel_test_method_prefixes = ['test_']
+ serial_test_method_prefixes = ['serial_test_']
if self._options.integration_tests:
- loader.test_method_prefixes.append('integration_test_')
+ parallel_test_method_prefixes.append('integration_test_')
+ serial_test_method_prefixes.append('serial_integration_test_')
parallel_tests = []
- if self._options.child_processes > 1:
- for name in names:
- parallel_tests.extend(self._all_test_names(loader.loadTestsFromName(name, None)))
- loader.test_method_prefixes = []
+ loader.test_method_prefixes = parallel_test_method_prefixes
+ for name in names:
+ parallel_tests.extend(self._all_test_names(loader.loadTestsFromName(name, None)))
serial_tests = []
- loader.test_method_prefixes = ['serial_test_', 'serial_integration_test_']
+ loader.test_method_prefixes = serial_test_method_prefixes
for name in names:
serial_tests.extend(self._all_test_names(loader.loadTestsFromName(name, None)))
@@ -216,7 +218,7 @@ class Tester(object):
class _Loader(unittest.TestLoader):
- test_method_prefixes = ['test_']
+ test_method_prefixes = []
def getTestCaseNames(self, testCaseClass):
def isTestMethod(attrname, testCaseClass=testCaseClass):
diff --git a/Tools/Scripts/webkitpy/test/main_unittest.py b/Tools/Scripts/webkitpy/test/main_unittest.py
index 2020f5b60..4fa6ef384 100644
--- a/Tools/Scripts/webkitpy/test/main_unittest.py
+++ b/Tools/Scripts/webkitpy/test/main_unittest.py
@@ -21,13 +21,33 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import logging
+import sys
import unittest
import StringIO
+from webkitpy.common.system.filesystem import FileSystem
+from webkitpy.common.system.executive import Executive
from webkitpy.common.system.outputcapture import OutputCapture
from webkitpy.test.main import Tester, _Loader
+STUBS_CLASS = __name__ + ".TestStubs"
+
+
+class TestStubs(unittest.TestCase):
+ def test_empty(self):
+ pass
+
+ def integration_test_empty(self):
+ pass
+
+ def serial_test_empty(self):
+ pass
+
+ def serial_integration_test_empty(self):
+ pass
+
+
class TesterTest(unittest.TestCase):
def test_no_tests_found(self):
@@ -53,9 +73,45 @@ class TesterTest(unittest.TestCase):
self.assertTrue('No tests to run' in errors.getvalue())
self.assertTrue('No tests to run' in logs)
- def test_individual_names_are_not_run_twice(self):
+ def _find_test_names(self, args):
tester = Tester()
- tester._options, args = tester._parse_args(["webkitpy.test.main_unittest.TesterTest.test_no_tests_found"])
- parallel_tests, serial_tests = tester._test_names(_Loader(), args)
+ tester._options, args = tester._parse_args(args)
+ return tester._test_names(_Loader(), args)
+
+ def test_individual_names_are_not_run_twice(self):
+ args = [STUBS_CLASS + '.test_empty']
+ parallel_tests, serial_tests = self._find_test_names(args)
self.assertEquals(parallel_tests, args)
self.assertEquals(serial_tests, [])
+
+ def test_integration_tests_are_not_found_by_default(self):
+ parallel_tests, serial_tests = self._find_test_names([STUBS_CLASS])
+ self.assertEquals(parallel_tests, [
+ STUBS_CLASS + '.test_empty',
+ ])
+ self.assertEquals(serial_tests, [
+ STUBS_CLASS + '.serial_test_empty',
+ ])
+
+ def test_integration_tests_are_found(self):
+ parallel_tests, serial_tests = self._find_test_names(['--integration-tests', STUBS_CLASS])
+ self.assertEquals(parallel_tests, [
+ STUBS_CLASS + '.integration_test_empty',
+ STUBS_CLASS + '.test_empty',
+ ])
+ self.assertEquals(serial_tests, [
+ STUBS_CLASS + '.serial_integration_test_empty',
+ STUBS_CLASS + '.serial_test_empty',
+ ])
+
+ def integration_test_coverage_works(self):
+ filesystem = FileSystem()
+ executive = Executive()
+ module_path = filesystem.path_to_module(self.__module__)
+ script_dir = module_path[0:module_path.find('webkitpy') - 1]
+ proc = executive.popen([sys.executable, filesystem.join(script_dir, 'test-webkitpy'), '-c', STUBS_CLASS + '.test_empty'],
+ stdout=executive.PIPE, stderr=executive.PIPE)
+ out, _ = proc.communicate()
+ retcode = proc.returncode
+ self.assertEquals(retcode, 0)
+ self.assertTrue('Cover' in out)