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)