Title: [160274] trunk/Tools
Revision
160274
Author
g...@gnome.org
Date
2013-12-07 09:39:33 -0800 (Sat, 07 Dec 2013)

Log Message

[GTK] Run each gtest subtest separately instead of in one go
https://bugs.webkit.org/show_bug.cgi?id=125386

Reviewed by Martin Robinson.

This is what other ports are doing (except they build each test as a separate binary)
and will help with the timeouts we sometimes hit because it applies to the full test
run.

* Scripts/run-gtk-tests:
(TestRunner._get_tests_from_google_test_suite): get a list of available sub-tests.
(TestRunner._run_google_test): run a single subtest from a gtest binary.
(TestRunner._run_google_test_suite): call the binary once per subtest.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (160273 => 160274)


--- trunk/Tools/ChangeLog	2013-12-07 16:50:25 UTC (rev 160273)
+++ trunk/Tools/ChangeLog	2013-12-07 17:39:33 UTC (rev 160274)
@@ -1,3 +1,19 @@
+2013-12-07  Gustavo Noronha Silva  <g...@gnome.org>
+
+        [GTK] Run each gtest subtest separately instead of in one go
+        https://bugs.webkit.org/show_bug.cgi?id=125386
+
+        Reviewed by Martin Robinson.
+
+        This is what other ports are doing (except they build each test as a separate binary)
+        and will help with the timeouts we sometimes hit because it applies to the full test
+        run.
+
+        * Scripts/run-gtk-tests:
+        (TestRunner._get_tests_from_google_test_suite): get a list of available sub-tests.
+        (TestRunner._run_google_test): run a single subtest from a gtest binary.
+        (TestRunner._run_google_test_suite): call the binary once per subtest.
+
 2013-12-07  Dániel Bátyai  <batyai.dan...@stud.u-szeged.hu>
 
         Move PrettyPatch related code to prettypatch.py

Modified: trunk/Tools/Scripts/run-gtk-tests (160273 => 160274)


--- trunk/Tools/Scripts/run-gtk-tests	2013-12-07 16:50:25 UTC (rev 160273)
+++ trunk/Tools/Scripts/run-gtk-tests	2013-12-07 17:39:33 UTC (rev 160274)
@@ -324,20 +324,45 @@
 
         return self._run_test_command(tester_command, self._options.timeout)
 
-    def _run_test_google(self, test_program):
-        tester_command = [test_program]
-        skipped_tests_cases = self._test_cases_to_skip(test_program)
-        if skipped_tests_cases:
-            tester_command.append("--gtest_filter=-%s" % ":".join(skipped_tests_cases))
+    def _get_tests_from_google_test_suite(self, test_program):
+        try:
+            output = subprocess.check_output([test_program, '--gtest_list_tests'])
+        except subprocess.CalledProcessError:
+            sys.stderr.write("ERROR: could not list available tests for binary %s.\n" % (test_program))
+            sys.stderr.flush()
+            return 1
 
-        return self._run_test_command(tester_command, self._options.timeout)
+        skipped_test_cases = self._test_cases_to_skip(test_program)
 
+        tests = []
+        prefix = None
+        for line in output.split('\n'):
+            if not line.startswith('  '):
+                prefix = line
+                continue
+            else:
+                test_name = prefix + line.strip()
+                if not test_name in skipped_test_cases:
+                    tests.append(test_name)
+        return tests
+
+    def _run_google_test(self, test_program, subtest):
+        test_command = [test_program, '--gtest_filter=%s' % (subtest)]
+        return self._run_test_command(test_command, self._options.timeout)
+
+    def _run_google_test_suite(self, test_program):
+        for subtest in self._get_tests_from_google_test_suite(test_program):
+            retcode = self._run_google_test(test_program, subtest)
+            if retcode:
+                return retcode
+        return 0
+
     def _run_test(self, test_program):
         if "unittests" in test_program or "WebKit2APITests" in test_program:
             return self._run_test_glib(test_program)
 
         if "TestWebKitAPI" in test_program:
-            return self._run_test_google(test_program)
+            return self._run_google_test_suite(test_program)
 
         return 1
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to