chore: Update external mochitests, b=no-bug, c=tests, scripts, common

This commit is contained in:
mr. m
2026-02-08 19:20:36 +01:00
parent 466d089fc0
commit 604365dd38
9 changed files with 35 additions and 36 deletions

View File

@@ -18,10 +18,18 @@ FILE_PREFIX = """
# This file is autogenerated by scripts/import_external_tests.py
# Do not edit manually.
"""
BROWSER_MANIFEST_LIST_PREFIX = """
BROWSER_CHROME_MANIFESTS += [
"""
XPCSHELL_MANIFESTS_LIST_PREFIX = """
XPCSHELL_TESTS_MANIFESTS += [
"""
FILE_SUFFIX = "]"
VALID_MANIFEST_FILES = ["browser.toml", "xpcshell.toml"]
def get_tests_manifest():
@@ -38,12 +46,17 @@ def validate_tests_path(path, files, ignore_list):
for ignore in ignore_list:
if ignore not in files:
die_with_error(f"Ignore file '{ignore}' not found in tests folder '{path}'")
if "browser.toml" not in files or "browser.js" in ignore_list:
die_with_error(f"'browser.toml' not found in tests folder '{path}'")
if not any(manifest_file in files for manifest_file in VALID_MANIFEST_FILES):
die_with_error(f"None of the valid manifest files {VALID_MANIFEST_FILES} found in tests folder '{path}'")
def disable_and_replace_manifest(manifest, output_path):
toml_file = os.path.join(output_path, "browser.toml")
toml_file = None
for manifest_file in VALID_MANIFEST_FILES:
candidate = os.path.join(output_path, manifest_file)
if os.path.exists(candidate):
toml_file = candidate
break
disabled_tests = manifest.get("disable", [])
with open(toml_file, "r") as f:
data = f.read()
@@ -90,8 +103,17 @@ def write_moz_build_file(manifest):
print(f"Writing moz.build file to '{moz_build_path}'")
with open(moz_build_path, "w") as f:
f.write(FILE_PREFIX)
f.write(BROWSER_MANIFEST_LIST_PREFIX)
for test_suite in manifest.keys():
f.write(f'\t"{test_suite}/browser.toml",\n')
# add for browser.toml first
if not manifest[test_suite].get("xpcshell", False):
f.write(f'\t"{test_suite}/browser.toml",\n')
f.write(FILE_SUFFIX)
f.write(XPCSHELL_MANIFESTS_LIST_PREFIX)
for test_suite in manifest.keys():
# add for xpcshell.toml
if manifest[test_suite].get("xpcshell", False):
f.write(f'\t"{test_suite}/xpcshell.toml",\n')
f.write(FILE_SUFFIX)

View File

@@ -56,7 +56,7 @@ def main():
os.chdir(engine_dir)
def run_mach_with_paths(test_paths):
command = ['./mach', 'mochitest'] + other_args + test_paths
command = ['./mach', 'test'] + other_args + test_paths
# Replace the current process with the mach command
os.execvp(command[0], command)

View File

@@ -9,7 +9,7 @@
*/
:host(:is(.anonymous-content-host, notification-message)),
:root {
:root:not([windowtype^="Browser:"]) {
/* Default values */
--zen-border-radius: 7px;
--zen-primary-color: AccentColor;

View File

@@ -6,9 +6,12 @@
# This file is autogenerated by scripts/import_external_tests.py
# Do not edit manually.
BROWSER_CHROME_MANIFESTS += [
"safebrowsing/browser.toml",
"sandbox/browser.toml",
"shell/browser.toml",
"tooltiptext/browser.toml",
]
XPCSHELL_TESTS_MANIFESTS += [
]

View File

@@ -682,13 +682,6 @@ async function testFileAccessWindowsOnly() {
let tests = [];
let extDir = GetPerUserExtensionDir();
// We used to unconditionally create this directory from Firefox, but that
// was dropped in bug 2001887. The value of this directory is questionable;
// the test was added in Firefox 56 (bug 1403744) to cover legacy add-ons,
// but legacy add-on support was discontinued in Firefox 57, and we stopped
// sideloading add-ons from this directory on all builds except ESR in
// Firefox 74 (bug 1602840).
await IOUtils.makeDirectory(extDir.path);
tests.push({
desc: "per-user extensions dir",
ok: true,

View File

@@ -22,13 +22,6 @@ add_setup(async function setup() {
const xdgConfigHome = Services.env.get("XDG_CONFIG_HOME");
Assert.greater(xdgConfigHome.length, 1, "XDG_CONFIG_HOME is defined");
// Verify the profile directory is inside XDG_CONFIG_HOME
const profileDir = Services.dirsvc.get("ProfD", Ci.nsIFile);
Assert.ok(
profileDir.path.startsWith(xdgConfigHome),
`Profile directory (${profileDir.path}) should be inside XDG_CONFIG_HOME (${xdgConfigHome})`
);
// If it is there, do actual testing
sanityChecks();
});

View File

@@ -12,14 +12,11 @@ support-files = [
"browser_content_sandbox_utils.js",
"browser_content_sandbox_fs_tests.js",
]
test-directories = [
"/tmp/.xdg_default_test",
"/tmp/.xdg_default_test/.config/mozilla/firefox/xdg_default_profile",
]
# .config needs to exists for the sandbox to properly add it
test-directories = ["/tmp/.xdg_default_test", "/tmp/.xdg_default_test/.config"]
environment = [
"HOME=/tmp/.xdg_default_test",
]
profile-path = "/tmp/.xdg_default_test/.config/mozilla/firefox/xdg_default_profile"
["browser_content_sandbox_fs_xdg_default.js"]
run-if = ["os == 'linux'"]

View File

@@ -12,17 +12,12 @@ support-files = [
"browser_content_sandbox_utils.js",
"browser_content_sandbox_fs_tests.js",
]
test-directories = [
"/tmp/.xdg_mozLegacyHome_test/.config",
"/tmp/.xdg_config_home_test",
"/tmp/.xdg_mozLegacyHome_test/.mozilla/firefox/xdg_mozLegacyHome_profile",
]
test-directories = ["/tmp/.xdg_mozLegacyHome_test/.config", "/tmp/.xdg_config_home_test"]
environment = [
"XDG_CONFIG_HOME=/tmp/.xdg_config_home_test",
"HOME=/tmp/.xdg_mozLegacyHome_test",
"MOZ_LEGACY_HOME=1",
]
profile-path = "/tmp/.xdg_mozLegacyHome_test/.mozilla/firefox/xdg_mozLegacyHome_profile"
["browser_content_sandbox_fs_xdg_mozLegacyHome.js"]
run-if = ["os == 'linux'"]

View File

@@ -11,15 +11,11 @@ support-files = [
"browser_content_sandbox_utils.js",
"browser_content_sandbox_fs_tests.js",
]
test-directories = [
"/tmp/.xdg_config_home_test",
"/tmp/.xdg_config_home_test/mozilla/firefox/xdg_config_home_profile",
]
test-directories = "/tmp/.xdg_config_home_test"
environment = [
"XDG_CONFIG_HOME=/tmp/.xdg_config_home_test",
"MOZ_LEGACY_HOME=0",
]
profile-path = "/tmp/.xdg_config_home_test/mozilla/firefox/xdg_config_home_profile"
["browser_content_sandbox_fs_xdg_xdgConfigHome.js"]
run-if = [