[testrunner] handle timeout param in file
WebAssembly's specification tests use a timeout annotation. This change allows the shared testrunner to use it to calculate the testcase timeout. Currently, the allowed timeout values are: long. Other values will emit a warning. Change-Id: Id7f453f5fd49854c8f53ff86ef2ec58aa0ae8748 Reviewed-on: https://chromium-review.googlesource.com/c/1480376 Reviewed-by: Michael Achenbach <machenbach@chromium.org> Commit-Queue: Sven Sauleau <ssauleau@igalia.com> Cr-Commit-Position: refs/heads/master@{#59919}
This commit is contained in:
parent
4f62b4bb61
commit
a427f31332
@ -11,6 +11,7 @@ from testrunner.objects import testcase
|
||||
ANY_JS = ".any.js"
|
||||
WPT_ROOT = "/wasm/jsapi/"
|
||||
META_SCRIPT_REGEXP = re.compile(r"META:\s*script=(.*)")
|
||||
META_TIMEOUT_REGEXP = re.compile(r"META:\s*timeout=(.*)")
|
||||
|
||||
|
||||
class TestLoader(testsuite.JSTestLoader):
|
||||
@ -35,6 +36,19 @@ class TestSuite(testsuite.TestSuite):
|
||||
|
||||
|
||||
class TestCase(testcase.D8TestCase):
|
||||
def _get_timeout_param(self):
|
||||
source = self.get_source()
|
||||
timeout_params = META_TIMEOUT_REGEXP.findall(source)
|
||||
if not timeout_params:
|
||||
return None
|
||||
|
||||
if timeout_params[0] in ["long"]:
|
||||
return timeout_params[0]
|
||||
else:
|
||||
print("unknown timeout param %s in %s%s"
|
||||
% (timeout_params[0], self.path, ANY_JS))
|
||||
return None
|
||||
|
||||
def _get_files_params(self):
|
||||
files = [os.path.join(self.suite.mjsunit_js),
|
||||
os.path.join(self.suite.root, "testharness.js")]
|
||||
|
@ -53,6 +53,8 @@ MODULE_RESOURCES_PATTERN_1 = re.compile(
|
||||
MODULE_RESOURCES_PATTERN_2 = re.compile(
|
||||
r"(?:import|export).*from (?:'|\")([^'\"]+)(?:'|\")")
|
||||
|
||||
TIMEOUT_LONG = "long"
|
||||
|
||||
try:
|
||||
cmp # Python 2
|
||||
except NameError:
|
||||
@ -203,6 +205,9 @@ class TestCase(object):
|
||||
def _get_files_params(self):
|
||||
return []
|
||||
|
||||
def _get_timeout_param(self):
|
||||
return None
|
||||
|
||||
def _get_random_seed_flags(self):
|
||||
return ['--random-seed=%d' % self.random_seed]
|
||||
|
||||
@ -241,6 +246,8 @@ class TestCase(object):
|
||||
timeout *= 4
|
||||
if "--noenable-vfp3" in params:
|
||||
timeout *= 2
|
||||
if self._get_timeout_param() == TIMEOUT_LONG:
|
||||
timeout *= 10
|
||||
|
||||
# TODO(majeski): make it slow outcome dependent.
|
||||
timeout *= 2
|
||||
|
Loading…
Reference in New Issue
Block a user