Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions test/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,7 @@ def setUp(self):
super().setUp()
self.js_engines = config.JS_ENGINES.copy()
self.settings_mods = {}
self.skip_exec = None
self.emcc_args = ['-Wclosure', '-Werror', '-Wno-limited-postlink-optimizations']
# TODO(https://github.com/emscripten-core/emscripten/issues/11121)
# For historical reasons emcc compiles and links as C++ by default.
Expand Down Expand Up @@ -1967,6 +1968,8 @@ def assert_out_queue_empty(self, who):
def run_browser(self, html_file, expected=None, message=None, timeout=None, extra_tries=1):
if not has_browser():
return
if self.skip_exec:
self.skipTest('skipping test execution: ' + self.skip_exec)
if BrowserCore.unresponsive_tests >= BrowserCore.MAX_UNRESPONSIVE_TESTS:
self.skipTest('too many unresponsive tests, skipping remaining tests')
self.assert_out_queue_empty('previous test')
Expand Down
21 changes: 18 additions & 3 deletions test/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,24 @@ def decorated(self, *args, **kwargs):
return decorated


requires_graphics_hardware = unittest.skipIf(os.getenv('EMTEST_LACKS_GRAPHICS_HARDWARE'), "This test requires graphics hardware")
requires_sound_hardware = unittest.skipIf(os.getenv('EMTEST_LACKS_SOUND_HARDWARE'), "This test requires sound hardware")
requires_offscreen_canvas = unittest.skipIf(os.getenv('EMTEST_LACKS_OFFSCREEN_CANVAS'), "This test requires a browser with OffscreenCanvas")
def skipExecIf(cond, message):
def decorator(f):
assert callable(f)

@wraps(f)
def decorated(self, *args, **kwargs):
if cond:
self.skip_exec = message
f(self, *args, **kwargs)

return decorated

return decorator


requires_graphics_hardware = skipExecIf(os.getenv('EMTEST_LACKS_GRAPHICS_HARDWARE'), 'This test requires graphics hardware')
requires_sound_hardware = skipExecIf(os.getenv('EMTEST_LACKS_SOUND_HARDWARE'), 'This test requires sound hardware')
requires_offscreen_canvas = skipExecIf(os.getenv('EMTEST_LACKS_OFFSCREEN_CANVAS'), 'This test requires a browser with OffscreenCanvas')


class browser(BrowserCore):
Expand Down