Title: [124504] trunk/Tools
Revision
124504
Author
[email protected]
Date
2012-08-02 14:38:16 -0700 (Thu, 02 Aug 2012)

Log Message

test-webkitpy: some tests need to run by themselves
https://bugs.webkit.org/show_bug.cgi?id=92926

Reviewed by Ojan Vafai.

Due to timing issues some of the executive tests will collide
and fail if they're run concurrently. This patch adds support
for writing tests that will be executed one at a time
(serially); to get them, add "serial_" to the front of the test
method name.

* Scripts/webkitpy/common/system/executive_unittest.py:
(ExecutiveTest.serial_test_kill_process):
(ExecutiveTest.serial_test_kill_all):
(ExecutiveTest.serial_test_check_running_pid):
(ExecutiveTest.serial_test_running_pids):
(ExecutiveTest.serial_test_run_in_parallel):
* Scripts/webkitpy/test/main.py:
(Tester._run_tests):
(Tester._test_names):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (124503 => 124504)


--- trunk/Tools/ChangeLog	2012-08-02 21:36:45 UTC (rev 124503)
+++ trunk/Tools/ChangeLog	2012-08-02 21:38:16 UTC (rev 124504)
@@ -1,5 +1,28 @@
 2012-08-02  Dirk Pranke  <[email protected]>
 
+        test-webkitpy: some tests need to run by themselves
+        https://bugs.webkit.org/show_bug.cgi?id=92926
+
+        Reviewed by Ojan Vafai.
+
+        Due to timing issues some of the executive tests will collide
+        and fail if they're run concurrently. This patch adds support
+        for writing tests that will be executed one at a time
+        (serially); to get them, add "serial_" to the front of the test
+        method name. 
+
+        * Scripts/webkitpy/common/system/executive_unittest.py:
+        (ExecutiveTest.serial_test_kill_process):
+        (ExecutiveTest.serial_test_kill_all):
+        (ExecutiveTest.serial_test_check_running_pid):
+        (ExecutiveTest.serial_test_running_pids):
+        (ExecutiveTest.serial_test_run_in_parallel):
+        * Scripts/webkitpy/test/main.py:
+        (Tester._run_tests):
+        (Tester._test_names):
+
+2012-08-02  Dirk Pranke  <[email protected]>
+
         test-webkitpy: integrate proper support for integration tests
         https://bugs.webkit.org/show_bug.cgi?id=92925
 

Modified: trunk/Tools/Scripts/webkitpy/common/system/executive_unittest.py (124503 => 124504)


--- trunk/Tools/Scripts/webkitpy/common/system/executive_unittest.py	2012-08-02 21:36:45 UTC (rev 124503)
+++ trunk/Tools/Scripts/webkitpy/common/system/executive_unittest.py	2012-08-02 21:38:16 UTC (rev 124504)
@@ -152,7 +152,7 @@
         output = executive.run_and_throw_if_fail(command_line('echo', unicode_tor_input), quiet=True, decode_output=False)
         self.assertEquals(output, encoded_tor)
 
-    def test_kill_process(self):
+    def serial_test_kill_process(self):
         executive = Executive()
         process = subprocess.Popen(never_ending_command(), stdout=subprocess.PIPE)
         self.assertEqual(process.poll(), None)  # Process is running
@@ -169,8 +169,8 @@
         # Killing again should fail silently.
         executive.kill_process(process.pid)
 
-        # Now test kill_all ; we do this in the same test as kill
-        # so that we don't collide when running tests in parallel.
+    def serial_test_kill_all(self):
+        executive = Executive()
         process = subprocess.Popen(never_ending_command(), stdout=subprocess.PIPE)
         self.assertEqual(process.poll(), None)  # Process is running
         executive.kill_all(never_ending_command()[0])
@@ -202,13 +202,13 @@
         self._assert_windows_image_name("foo.baz", "foo.baz")
         self._assert_windows_image_name("foo.baz.exe", "foo.baz.exe")
 
-    def test_check_running_pid(self):
+    def serial_test_check_running_pid(self):
         executive = Executive()
         self.assertTrue(executive.check_running_pid(os.getpid()))
         # Maximum pid number on Linux is 32768 by default
         self.assertFalse(executive.check_running_pid(100000))
 
-    def test_running_pids(self):
+    def serial_test_running_pids(self):
         if sys.platform in ("win32", "cygwin"):
             return  # This function isn't implemented on Windows yet.
 
@@ -216,7 +216,9 @@
         pids = executive.running_pids()
         self.assertTrue(os.getpid() in pids)
 
-    def test_run_in_parallel(self):
+    def serial_test_run_in_parallel(self):
+        # We run this test serially to avoid overloading the machine and throwing off the timing.
+
         if sys.platform in ("win32", "cygwin"):
             return  # This function isn't implemented properly on windows yet.
         import multiprocessing

Modified: trunk/Tools/Scripts/webkitpy/test/main.py (124503 => 124504)


--- trunk/Tools/Scripts/webkitpy/test/main.py	2012-08-02 21:36:45 UTC (rev 124503)
+++ trunk/Tools/Scripts/webkitpy/test/main.py	2012-08-02 21:38:16 UTC (rev 124504)
@@ -137,13 +137,14 @@
 
         self.printer.write_update("Finding the individual test methods ...")
         loader = _Loader()
-        test_names = self._test_names(loader, names)
+        parallel_tests, serial_tests = self._test_names(loader, names)
 
         self.printer.write_update("Running the tests ...")
-        self.printer.num_tests = len(test_names)
+        self.printer.num_tests = len(parallel_tests) + len(serial_tests)
         start = time.time()
         test_runner = Runner(self.printer, loader)
-        test_runner.run(test_names, self._options.child_processes)
+        test_runner.run(parallel_tests, self._options.child_processes)
+        test_runner.run(serial_tests, 1)
 
         self.printer.print_result(time.time() - start)
 
@@ -172,11 +173,18 @@
         if self._options.integration_tests:
             loader.test_method_prefixes.append('integration_test_')
 
-        test_names = []
+        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 = []
+
+        serial_tests = []
+        loader.test_method_prefixes.extend(['serial_test_', 'serial_integration_test_'])
         for name in names:
-            test_names.extend(self._all_test_names(loader.loadTestsFromName(name, None)))
+            serial_tests.extend(self._all_test_names(loader.loadTestsFromName(name, None)))
 
-        return test_names
+        return (parallel_tests, serial_tests)
 
     def _all_test_names(self, suite):
         names = []
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to