Skip to content

Commit

Permalink
68.14.0 - testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Fedor committed Apr 22, 2024
1 parent 8d3bf7e commit 2da2788
Show file tree
Hide file tree
Showing 1,866 changed files with 41,826 additions and 37,492 deletions.
2 changes: 1 addition & 1 deletion testing/cppunittest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
[TestCasting]
[TestCeilingFloor]
[TestCheckedInt]
[TestCompactPair]
[TestCountPopulation]
[TestCountZeroes]
[TestDefineEnum]
Expand Down Expand Up @@ -40,7 +41,6 @@ skip-if = os != 'win'
[TestNotNull]
[TestParseFTPList]
[TestPLDHash]
[TestPair]
[TestPoisonArea]
skip-if = os == 'android' # Bug 1147630
[TestRange]
Expand Down
17 changes: 13 additions & 4 deletions testing/gtest/remotegtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class RemoteGTests(object):
def __init__(self):
self.device = None

def build_environment(self, shuffle, test_filter):
def build_environment(self, shuffle, test_filter, enable_webrender):
"""
Create and return a dictionary of all the appropriate env variables
and values.
Expand All @@ -54,11 +54,15 @@ def build_environment(self, shuffle, test_filter):
env["GTEST_SHUFFLE"] = "True"
if test_filter:
env["GTEST_FILTER"] = test_filter
if enable_webrender:
env["MOZ_WEBRENDER"] = "1"
else:
env["MOZ_WEBRENDER"] = "0"

return env

def run_gtest(self, test_dir, shuffle, test_filter, package, adb_path, device_serial,
remote_test_root, libxul_path, symbols_path):
remote_test_root, libxul_path, symbols_path, enable_webrender):
"""
Launch the test app, run gtest, collect test results and wait for completion.
Return False if a crash or other failure is detected, else True.
Expand Down Expand Up @@ -94,7 +98,7 @@ def run_gtest(self, test_dir, shuffle, test_filter, package, adb_path, device_se
if not os.path.isdir(f):
self.device.push(f, self.remote_profile)

env = self.build_environment(shuffle, test_filter)
env = self.build_environment(shuffle, test_filter, enable_webrender)
args = ["-unittest", "--gtest_death_test_style=threadsafe",
"-profile %s" % self.remote_profile]
if 'geckoview' in self.package:
Expand Down Expand Up @@ -349,6 +353,11 @@ def __init__(self):
self.add_option("--tests-path",
default=None,
help="Path to gtest directory containing test support files.")
self.add_option("--enable-webrender",
action="store_true",
dest="enable_webrender",
default=False,
help="Enable the WebRender compositor in Gecko.")


def update_mozinfo():
Expand Down Expand Up @@ -383,7 +392,7 @@ def main():
options.shuffle, test_filter, options.package,
options.adb_path, options.device_serial,
options.remote_test_root, options.libxul_path,
options.symbols_path)
options.symbols_path, options.enable_webrender)
except KeyboardInterrupt:
log.info("gtest | Received keyboard interrupt")
except Exception as e:
Expand Down
20 changes: 16 additions & 4 deletions testing/gtest/rungtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class GTests(object):
TEST_PROC_NO_OUTPUT_TIMEOUT = 300

def run_gtest(self, prog, xre_path, cwd, symbols_path=None,
utility_path=None):
utility_path=None, enable_webrender=False):
"""
Run a single C++ unit test program.
Expand All @@ -44,7 +44,7 @@ def run_gtest(self, prog, xre_path, cwd, symbols_path=None,
Return True if the program exits with a zero status, False otherwise.
"""
self.xre_path = xre_path
env = self.build_environment()
env = self.build_environment(enable_webrender)
log.info("Running gtest")

if cwd and not os.path.isdir(cwd):
Expand Down Expand Up @@ -110,7 +110,7 @@ def build_core_environment(self, env={}):

return env

def build_environment(self):
def build_environment(self, enable_webrender):
"""
Create and return a dictionary of all the appropriate env variables
and values. On a remote system, we overload this to set different
Expand Down Expand Up @@ -149,6 +149,12 @@ def build_environment(self):
# This should be |testFail| instead of |info|. See bug 1050891.
log.info("gtest | Failed to find ASan symbolizer at %s", llvmsym)

if enable_webrender:
env["MOZ_WEBRENDER"] = "1"
env["MOZ_ACCELERATED"] = "1"
else:
env["MOZ_WEBRENDER"] = "0"

return env


Expand All @@ -175,6 +181,11 @@ def __init__(self):
dest="utility_path",
default=None,
help="path to a directory containing utility program binaries")
self.add_option("--enable-webrender",
action="store_true",
dest="enable_webrender",
default=False,
help="Enable the WebRender compositor in Gecko.")


def update_mozinfo():
Expand Down Expand Up @@ -209,7 +220,8 @@ def main():
result = tester.run_gtest(prog, options.xre_path,
options.cwd,
symbols_path=options.symbols_path,
utility_path=options.utility_path)
utility_path=options.utility_path,
enable_webrender=options.enable_webrender)
except Exception as e:
log.error(str(e))
result = False
Expand Down
2 changes: 0 additions & 2 deletions testing/marionette/transport.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

"use strict";

/* global Pipe, ScriptableInputStream */

const CC = Components.Constructor;

const { EventEmitter } = ChromeUtils.import(
Expand Down
21 changes: 20 additions & 1 deletion testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

// This file uses ContentTask & frame scripts, where these are available.
/* global addEventListener, removeEventListener, sendAsyncMessage,
addMessageListener, removeMessageListener, privateNoteIntentionalCrash */
addMessageListener, removeMessageListener, ContentTaskUtils */

"use strict";

Expand Down Expand Up @@ -747,6 +747,25 @@ var BrowserTestUtils = {
}
},

/**
* Maybe create a preloaded browser and ensure it's finished loading.
*
* @param gBrowser (<xul:tabbrowser>)
* The tabbrowser in which to preload a browser.
*/
async maybeCreatePreloadedBrowser(gBrowser) {
let win = gBrowser.ownerGlobal;
win.NewTabPagePreloading.maybeCreatePreloadedBrowser(win);

// We cannot use the regular BrowserTestUtils helper for waiting here, since that
// would try to insert the preloaded browser, which would only break things.
await ContentTask.spawn(gBrowser.preloadedBrowser, null, async () => {
await ContentTaskUtils.waitForCondition(() => {
return content.document && content.document.readyState == "complete";
});
});
},

/**
* @param win (optional)
* The window we should wait to have "domwindowopened" sent through
Expand Down
1 change: 1 addition & 0 deletions testing/mochitest/tests/browser/dummy.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<html>
<meta http-equiv="Content-Security-Policy" content="default-src 'none'"></meta>
<title>This is a dummy page</title>
<meta charset="utf-8">
<body>This is a dummy page</body>
Expand Down
4 changes: 2 additions & 2 deletions testing/mozbase/manifestparser/manifestparser/ini.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ def read_ini(fp, variables=None, default='DEFAULT', defaults_only=False,
while comment_start == sys.maxsize and inline_prefixes:
next_prefixes = {}
for prefix, index in inline_prefixes.items():
index = line.find(prefix, index+1)
index = stripped.find(prefix, index+1)
if index == -1:
continue
next_prefixes[prefix] = index
if index == 0 or (index > 0 and line[index-1].isspace()):
if index == 0 or (index > 0 and stripped[index-1].isspace()):
comment_start = min(comment_start, index)
inline_prefixes = next_prefixes

Expand Down
8 changes: 8 additions & 0 deletions testing/mozbase/mozproxy/mozproxy/backends/mitm/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# flake8: noqa
# This Source Code Form is subject to the terms of the Mozilla Public
# 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/.

from __future__ import absolute_import

from .mitm import *
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,51 @@ def start_mitmproxy_playback(self, mitmdump_path, browser_path):
command = [mitmdump_path]

if "playback_tool_args" in self.config:
LOG.info("Staring Proxy using provided command line!")
command.extend(self.config["playback_tool_args"])
elif "playback_files" in self.config:
script = os.path.join(
os.path.dirname(os.path.realpath(__file__)), "scripts",
"alternate-server-replay-{}.py".format(
self.config["playback_version"]))
recording_paths = self.config["playback_files"]
# this part is platform-specific
if mozinfo.os == "win":
script = script.replace("\\", "\\\\\\")
recording_paths = [recording_path.replace("\\", "\\\\\\")
for recording_path in recording_paths]

if self.config["playback_version"] == "2.0.2":
args = [
"--replay-kill-extra",
"-v",
"--script",
'""{} {}""'.format(script, " ".join(recording_paths)),
]

if not self.config["playback_upstream_cert"]:
LOG.info("No upstream certificate sniffing")
args.insert(0, "--no-upstream-cert")
self.playback.config["playback_tool_args"] = args
elif self.config["playback_version"] == "4.0.4":
args = [
"-v",
"--set",
"websocket=false",
"--set",
"server_replay_files={}".format(" ".join(recording_paths)),
"--scripts",
script,
]
if not self.config["playback_upstream_cert"]:
LOG.info("No upstream certificate sniffing")
args = ["--set", "upstream_cert=false"] + args
command.extend(args)
else:
raise Exception("Mitmproxy version is unknown!")

else:
raise Exception("Mitmproxy can't start playback! Playback settings missing.")

LOG.info("Starting mitmproxy playback using env path: %s" % env["PATH"])
LOG.info("Starting mitmproxy playback using command: %s" % " ".join(command))
Expand Down
Loading

0 comments on commit 2da2788

Please sign in to comment.