diff --git a/testing/mochitest/mach_commands.py b/testing/mochitest/mach_commands.py index cb381dc84065..9cfb0421f3b0 100644 --- a/testing/mochitest/mach_commands.py +++ b/testing/mochitest/mach_commands.py @@ -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", diff --git a/testing/mochitest/runjunit.py b/testing/mochitest/runjunit.py index c2e696cf4ac8..57cd69f8d7f4 100644 --- a/testing/mochitest/runjunit.py +++ b/testing/mochitest/runjunit.py @@ -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 diff --git a/testing/mochitest/runtests.py b/testing/mochitest/runtests.py index 631ede9520b9..c1338d4edc2f 100644 --- a/testing/mochitest/runtests.py +++ b/testing/mochitest/runtests.py @@ -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