зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1352463 - Define WPT timeouts on the test type level; r=jgraham
Certain test types have a need for other defaults than the wpttest.DEFAULT_TIMEOUT and wpttest.LONG_TIMEOUT values. This patch changes wptrunner to define default- and long timeouts on a test type level. This allows a test type to override the default durations defined in the abstract Test.default_timeout and Test.long_timeout. Concrete classes, such as ReftestTest and WdspecTest, may override these class properties. MozReview-Commit-ID: IS6df5vuIDC --HG-- extra : rebase_source : a3f37d4524902f2b0d54e14126b57da327f0ec06
This commit is contained in:
Родитель
545cdbc891
Коммит
6564760558
|
@ -92,8 +92,8 @@ class EqualTimeChunker(TestChunker):
|
||||||
by_dir[test_dir] = PathData(test_dir)
|
by_dir[test_dir] = PathData(test_dir)
|
||||||
|
|
||||||
data = by_dir[test_dir]
|
data = by_dir[test_dir]
|
||||||
time = sum(wpttest.DEFAULT_TIMEOUT if test.timeout !=
|
time = sum(test.default_timeout if test.timeout !=
|
||||||
"long" else wpttest.LONG_TIMEOUT for test in tests)
|
"long" else test.long_timeout for test in tests)
|
||||||
data.time += time
|
data.time += time
|
||||||
total_time += time
|
total_time += time
|
||||||
data.tests.append((test_type, test_path, tests))
|
data.tests.append((test_type, test_path, tests))
|
||||||
|
|
|
@ -2,9 +2,6 @@
|
||||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
DEFAULT_TIMEOUT = 10 # seconds
|
|
||||||
LONG_TIMEOUT = 60 # seconds
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import mozinfo
|
import mozinfo
|
||||||
|
@ -99,17 +96,21 @@ class RunInfo(dict):
|
||||||
|
|
||||||
|
|
||||||
class Test(object):
|
class Test(object):
|
||||||
|
|
||||||
result_cls = None
|
result_cls = None
|
||||||
subtest_result_cls = None
|
subtest_result_cls = None
|
||||||
test_type = None
|
test_type = None
|
||||||
|
|
||||||
|
default_timeout = 10 # seconds
|
||||||
|
long_timeout = 60 # seconds
|
||||||
|
|
||||||
def __init__(self, tests_root, url, inherit_metadata, test_metadata,
|
def __init__(self, tests_root, url, inherit_metadata, test_metadata,
|
||||||
timeout=DEFAULT_TIMEOUT, path=None, protocol="http"):
|
timeout=None, path=None, protocol="http"):
|
||||||
self.tests_root = tests_root
|
self.tests_root = tests_root
|
||||||
self.url = url
|
self.url = url
|
||||||
self._inherit_metadata = inherit_metadata
|
self._inherit_metadata = inherit_metadata
|
||||||
self._test_metadata = test_metadata
|
self._test_metadata = test_metadata
|
||||||
self.timeout = timeout
|
self.timeout = timeout if timeout is not None else self.default_timeout
|
||||||
self.path = path
|
self.path = path
|
||||||
self.environment = {"protocol": protocol, "prefs": self.prefs}
|
self.environment = {"protocol": protocol, "prefs": self.prefs}
|
||||||
|
|
||||||
|
@ -118,7 +119,7 @@ class Test(object):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_manifest(cls, manifest_item, inherit_metadata, test_metadata):
|
def from_manifest(cls, manifest_item, inherit_metadata, test_metadata):
|
||||||
timeout = LONG_TIMEOUT if manifest_item.timeout == "long" else DEFAULT_TIMEOUT
|
timeout = cls.long_timeout if manifest_item.timeout == "long" else cls.default_timeout
|
||||||
protocol = "https" if hasattr(manifest_item, "https") and manifest_item.https else "http"
|
protocol = "https" if hasattr(manifest_item, "https") and manifest_item.https else "http"
|
||||||
return cls(manifest_item.source_file.tests_root,
|
return cls(manifest_item.source_file.tests_root,
|
||||||
manifest_item.url,
|
manifest_item.url,
|
||||||
|
@ -249,8 +250,7 @@ class ReftestTest(Test):
|
||||||
test_type = "reftest"
|
test_type = "reftest"
|
||||||
|
|
||||||
def __init__(self, tests_root, url, inherit_metadata, test_metadata, references,
|
def __init__(self, tests_root, url, inherit_metadata, test_metadata, references,
|
||||||
timeout=DEFAULT_TIMEOUT, path=None, viewport_size=None,
|
timeout=None, path=None, viewport_size=None, dpi=None, protocol="http"):
|
||||||
dpi=None, protocol="http"):
|
|
||||||
Test.__init__(self, tests_root, url, inherit_metadata, test_metadata, timeout,
|
Test.__init__(self, tests_root, url, inherit_metadata, test_metadata, timeout,
|
||||||
path, protocol)
|
path, protocol)
|
||||||
|
|
||||||
|
@ -270,7 +270,7 @@ class ReftestTest(Test):
|
||||||
nodes=None,
|
nodes=None,
|
||||||
references_seen=None):
|
references_seen=None):
|
||||||
|
|
||||||
timeout = LONG_TIMEOUT if manifest_test.timeout == "long" else DEFAULT_TIMEOUT
|
timeout = cls.long_timeout if manifest_test.timeout == "long" else cls.default_timeout
|
||||||
|
|
||||||
if nodes is None:
|
if nodes is None:
|
||||||
nodes = {}
|
nodes = {}
|
||||||
|
@ -334,10 +334,14 @@ class ReftestTest(Test):
|
||||||
|
|
||||||
|
|
||||||
class WdspecTest(Test):
|
class WdspecTest(Test):
|
||||||
|
|
||||||
result_cls = WdspecResult
|
result_cls = WdspecResult
|
||||||
subtest_result_cls = WdspecSubtestResult
|
subtest_result_cls = WdspecSubtestResult
|
||||||
test_type = "wdspec"
|
test_type = "wdspec"
|
||||||
|
|
||||||
|
default_timeout = 10
|
||||||
|
long_timeout = 60
|
||||||
|
|
||||||
|
|
||||||
manifest_test_cls = {"reftest": ReftestTest,
|
manifest_test_cls = {"reftest": ReftestTest,
|
||||||
"testharness": TestharnessTest,
|
"testharness": TestharnessTest,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче