Bug 1674483 - Only use websocketprocessbridge when running tests tagged with 'webrtc'. r=bwc,gbrown

Differential Revision: https://phabricator.services.mozilla.com/D95409
This commit is contained in:
Bryce Seager van Dyk 2020-11-06 22:47:42 +00:00
parent c99ed8ea6e
commit 9a4fa928ac
3 changed files with 34 additions and 2 deletions

View File

@ -382,8 +382,14 @@ class MachCommands(MachCommandBase):
kwargs["subsuite"] = None
suites = defaultdict(list)
is_webrtc_tag_present = False
unsupported = set()
for test in tests:
# Check if we're running a webrtc test so we can enable webrtc
# specific test logic later if needed.
if "webrtc" in test.get("tags", ""):
is_webrtc_tag_present = True
# Filter out non-mochitests and unsupported flavors.
if test["flavor"] not in ALL_FLAVORS:
continue
@ -404,7 +410,8 @@ class MachCommands(MachCommandBase):
suites[key].append(test)
if ("mochitest", "media") in suites:
# Only webrtc mochitests in the media suite need the websocketprocessbridge.
if ("mochitest", "media") in suites and is_webrtc_tag_present:
req = os.path.join(
"testing",
"tools",

View File

@ -89,6 +89,14 @@ class JUnitTestRunner(MochitestDesktop):
self.startServers(self.options, debuggerInfo=None, public=True)
self.log.debug("Servers started")
def needsWebsocketProcessBridge(self, options):
"""
Overrides MochitestDesktop.needsWebsocketProcessBridge and always
returns False as the junit tests do not use the websocket process
bridge. This is needed to satisfy MochitestDesktop.startServers.
"""
return False
def server_init(self):
"""
Additional initialization required to satisfy MochitestDesktop.startServers

View File

@ -1278,6 +1278,20 @@ class MochitestDesktop(object):
"websocket/process bridge startup."
)
def needsWebsocketProcessBridge(self, options):
"""
Returns a bool indicating if the current test configuration needs
to start the websocket process bridge or not. The boils down to if
WebRTC tests that need the bridge are present.
"""
tests = self.getActiveTests(options)
is_webrtc_tag_present = False
for test in tests:
if "webrtc" in test.get("tags", ""):
is_webrtc_tag_present = True
break
return is_webrtc_tag_present and options.subsuite in ["media"]
def startServers(self, options, debuggerInfo, public=None):
# start servers and set ports
# TODO: pass these values, don't set on `self`
@ -1296,7 +1310,8 @@ class MochitestDesktop(object):
self.startWebServer(options)
self.startWebSocketServer(options, debuggerInfo)
if options.subsuite in ["media"]:
# Only webrtc mochitests in the media suite need the websocketprocessbridge.
if self.needsWebsocketProcessBridge(options):
self.startWebsocketProcessBridge(options)
# start SSL pipe
@ -1624,6 +1639,8 @@ toolbar#nav-bar {
testob["expected"] = test["expected"]
if "scheme" in test:
testob["scheme"] = test["scheme"]
if "tags" in test:
testob["tags"] = test["tags"]
if options.failure_pattern_file:
pat_file = os.path.join(
os.path.dirname(test["manifest"]), options.failure_pattern_file