Title: [230943] trunk/Tools
Revision
230943
Author
[email protected]
Date
2018-04-23 23:33:31 -0700 (Mon, 23 Apr 2018)

Log Message

[GLIB] Make it possible to use a different timeout for slow test cases in GLib tests
https://bugs.webkit.org/show_bug.cgi?id=184816

Reviewed by Michael Catanzaro.

Pass a function from api test runner to glib test runner to check if a test is slow and use the given slow
timeout.

* TestWebKitAPI/glib/TestExpectations.json:
* glib/api_test_runner.py:
(TestRunner._run_test_glib.is_slow_test):
(TestRunner._run_test_glib):
* glib/glib_test_runner.py:
(GLibTestRunner.__init__):
(GLibTestRunner._stop_timeout):
(GLibTestRunner._subtest_start):
(GLibTestRunner._subtest_end):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (230942 => 230943)


--- trunk/Tools/ChangeLog	2018-04-24 03:22:53 UTC (rev 230942)
+++ trunk/Tools/ChangeLog	2018-04-24 06:33:31 UTC (rev 230943)
@@ -1,3 +1,23 @@
+2018-04-23  Carlos Garcia Campos  <[email protected]>
+
+        [GLIB] Make it possible to use a different timeout for slow test cases in GLib tests
+        https://bugs.webkit.org/show_bug.cgi?id=184816
+
+        Reviewed by Michael Catanzaro.
+
+        Pass a function from api test runner to glib test runner to check if a test is slow and use the given slow
+        timeout.
+
+        * TestWebKitAPI/glib/TestExpectations.json:
+        * glib/api_test_runner.py:
+        (TestRunner._run_test_glib.is_slow_test):
+        (TestRunner._run_test_glib):
+        * glib/glib_test_runner.py:
+        (GLibTestRunner.__init__):
+        (GLibTestRunner._stop_timeout):
+        (GLibTestRunner._subtest_start):
+        (GLibTestRunner._subtest_end):
+
 2018-04-23  Wenson Hsieh  <[email protected]>
 
         [Extra zoom mode] REGRESSION(230860) Unable to change time input values using UI

Modified: trunk/Tools/TestWebKitAPI/glib/TestExpectations.json (230942 => 230943)


--- trunk/Tools/TestWebKitAPI/glib/TestExpectations.json	2018-04-24 03:22:53 UTC (rev 230942)
+++ trunk/Tools/TestWebKitAPI/glib/TestExpectations.json	2018-04-24 06:33:31 UTC (rev 230943)
@@ -233,6 +233,10 @@
         }
     },
     "TestJSC": {
-        "expected": {"all@Debug": {"slow": true}}
+        "subtests": {
+            "/jsc/vm": {
+                "expected": {"all@Debug": {"slow": true}}
+            }
+        }
     }
 }

Modified: trunk/Tools/glib/api_test_runner.py (230942 => 230943)


--- trunk/Tools/glib/api_test_runner.py	2018-04-24 03:22:53 UTC (rev 230942)
+++ trunk/Tools/glib/api_test_runner.py	2018-04-24 06:33:31 UTC (rev 230943)
@@ -147,11 +147,12 @@
 
     def _run_test_glib(self, test_program):
         timeout = self._options.timeout
-        test = os.path.join(os.path.basename(os.path.dirname(test_program)), os.path.basename(test_program))
-        if self._expectations.is_slow(os.path.basename(test_program)):
-            timeout *= 10
-        return GLibTestRunner(test_program, timeout).run(skipped=self._test_cases_to_skip(test_program), env=self._test_env)
 
+        def is_slow_test(test, subtest):
+            return self._expectations.is_slow(test, subtest)
+
+        return GLibTestRunner(test_program, timeout, is_slow_test, timeout * 10).run(skipped=self._test_cases_to_skip(test_program), env=self._test_env)
+
     def _get_tests_from_google_test_suite(self, test_program):
         try:
             output = subprocess.check_output([test_program, '--gtest_list_tests'], env=self._test_env)

Modified: trunk/Tools/glib/glib_test_runner.py (230942 => 230943)


--- trunk/Tools/glib/glib_test_runner.py	2018-04-24 03:22:53 UTC (rev 230942)
+++ trunk/Tools/glib/glib_test_runner.py	2018-04-24 06:33:31 UTC (rev 230943)
@@ -92,9 +92,14 @@
 
 class GLibTestRunner(object):
 
-    def __init__(self, test_binary, timeout):
+    def __init__(self, test_binary, timeout, is_slow_function=None, slow_timeout=0):
         self._test_binary = test_binary
         self._timeout = timeout
+        if is_slow_function is not None:
+            self._is_test_slow = is_slow_function
+        else:
+            self._is_test_slow = lambda x, y: False
+        self._slow_timeout = slow_timeout
 
         self._stderr_fd = None
         self._subtest = None
@@ -174,10 +179,7 @@
         alarm(timeout)
 
     @staticmethod
-    def _stop_timeout(timeout):
-        if timeout <= 0:
-            return
-
+    def _stop_timeout():
         alarm(0)
 
     def _subtest_start(self, subtest):
@@ -185,7 +187,10 @@
         message = self._subtest + ':'
         sys.stdout.write('  %-68s' % message)
         sys.stdout.flush()
-        self._start_timeout(self._timeout)
+        timeout = self._timeout
+        if self._is_test_slow(os.path.basename(self._test_binary), self._subtest):
+            timeout = self._slow_timeout
+        self._start_timeout(timeout)
 
     def _subtest_message(self, message):
         if self._subtest is None:
@@ -206,7 +211,7 @@
         sys.stderr.flush()
 
     def _subtest_end(self, result, did_timeout=False):
-        self._stop_timeout(self._timeout)
+        self._stop_timeout()
         if did_timeout:
             self._results[self._subtest] = 'TIMEOUT'
         elif result == TEST_RUN_SUCCESS:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to