tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 212c86a4b34424194c94cbfe4db503a07764a821
parent 6e70ba5d14db341492fa92c96f49f83193ff6fcc
Author: agoloman <agoloman@mozilla.com>
Date:   Thu, 30 Oct 2025 18:32:11 +0200

Revert (Bug 1994065, Bug 1989470) - for never running some tests.

This reverts commit 6f884204aa2058cc1b8921dedd34628ba9e978ed.

Revert "Bug 1989470 - combine run-if conditions for .toml manifests. r=ci-and-tooling,aryx"

This reverts commit feaf6919f740c88f26d085f75b84fc944b23ecbd.

Diffstat:
Mtesting/mozbase/manifestparser/manifestparser/filters.py | 22+++++++---------------
Mtesting/mozbase/manifestparser/manifestparser/ini.py | 1-
Dtesting/mozbase/manifestparser/tests/default-runif.toml | 8--------
Mtesting/mozbase/manifestparser/tests/test_default_overrides.py | 16----------------
Mtesting/mozbase/manifestparser/tests/test_filters.py | 37++-----------------------------------
5 files changed, 9 insertions(+), 75 deletions(-)

diff --git a/testing/mozbase/manifestparser/manifestparser/filters.py b/testing/mozbase/manifestparser/manifestparser/filters.py @@ -21,11 +21,9 @@ from .util import normsep def _match(exprs, strict, **values): - """Return the first matching expression, or None if no match.""" - for e in exprs.splitlines(): - if e and parse(e, strict=strict, **values): - return e - return None + if any(parse(e, strict=strict, **values) for e in exprs.splitlines() if e): + return True + return False def skip_if(tests, values, strict=False): @@ -35,10 +33,8 @@ def skip_if(tests, values, strict=False): """ tag = "skip-if" for test in tests: - if tag in test: - matching_expr = _match(test[tag], strict, **values) - if matching_expr: - test.setdefault("disabled", f"{tag}: {matching_expr}") + if tag in test and _match(test[tag], strict, **values): + test.setdefault("disabled", f"{tag}: {test[tag]}") yield test @@ -49,12 +45,8 @@ def run_if(tests, values, strict=False): """ tag = "run-if" for test in tests: - if tag in test: - # logical &&, not || - if not all( - parse(e, strict=strict, **values) for e in test[tag].splitlines() if e - ): - test.setdefault("disabled", f"{tag}: {test[tag]}") + if tag in test and not _match(test[tag], strict, **values): + test.setdefault("disabled", f"{tag}: {test[tag]}") yield test diff --git a/testing/mozbase/manifestparser/manifestparser/ini.py b/testing/mozbase/manifestparser/manifestparser/ini.py @@ -190,7 +190,6 @@ def combine_fields(global_vars, local_vars): field_patterns = { "args": "%s %s", "prefs": "%s\n%s", - "run-if": "%s\n%s", # consider implicit logical OR: "%s ||\n%s" "skip-if": "%s\n%s", # consider implicit logical OR: "%s ||\n%s" "support-files": "%s %s", "tags": "%s %s", diff --git a/testing/mozbase/manifestparser/tests/default-runif.toml b/testing/mozbase/manifestparser/tests/default-runif.toml @@ -1,8 +0,0 @@ -[DEFAULT] -run-if = "os != 'android'" # a comment - -[test7] -[test8] -run-if = "!condprof" # another comment -[test9] -foo = "bar" diff --git a/testing/mozbase/manifestparser/tests/test_default_overrides.py b/testing/mozbase/manifestparser/tests/test_default_overrides.py @@ -79,22 +79,6 @@ class TestDefaultSupportFiles(unittest.TestCase): self.assertEqual(test["support-files"], expected) -class TestDefaultRunif(unittest.TestCase): - """Tests combining support-files field in [DEFAULT] with the value for a test""" - - def test_defaults_toml(self): - default = os.path.join(here, "default-runif.toml") - parser = ManifestParser(manifests=(default,), use_toml=True) - expected_supp_files = { - "test7": "os != 'android'", - "test8": "os != 'android'\n!condprof", - "test9": "os != 'android'", - } - for test in parser.tests: - expected = expected_supp_files[test["name"]] - self.assertEqual(test["run-if"], expected) - - class TestOmitDefaults(unittest.TestCase): """Tests passing omit-defaults prevents defaults from propagating to definitions.""" diff --git a/testing/mozbase/manifestparser/tests/test_filters.py b/testing/mozbase/manifestparser/tests/test_filters.py @@ -160,7 +160,7 @@ def tests(create_tests): return create_tests( "test0", ("test1", {"skip-if": "foo == 'bar'\nintermittent&&!debug"}), - ("test2", {"run-if": "foo == 'bar'\nfoo == 'baz'\ndebug"}), + ("test2", {"run-if": "foo == 'bar'"}), ("test3", {"fail-if": "foo == 'bar'"}), ("test4", {"disabled": "some reason"}), ("test5", {"subsuite": "baz"}), @@ -170,10 +170,6 @@ def tests(create_tests): "test8", {"skip-if": "\nbaz\nfoo == 'bar'\nfoo == 'baz'\nintermittent && debug"}, ), - ( - "test9", - {"run-if": "os != 'android'\n!condprof"}, - ), ) @@ -186,45 +182,16 @@ def test_skip_if(tests): tests = list(skip_if(tests, {"foo": "bar"})) assert "disabled" in tests[1] assert "disabled" in tests[8] - # Verify only the matching condition is shown, not all conditions - assert tests[1]["disabled"] == "skip-if: foo == 'bar'" - assert tests[8]["disabled"] == "skip-if: foo == 'bar'" def test_run_if(tests): ref = deepcopy(tests) tests = list(run_if(tests, {})) assert "disabled" in tests[2] - # For run-if with AND logic, show the first condition that didn't match - assert tests[2]["disabled"] == "run-if: foo == 'bar'" tests = deepcopy(ref) tests = list(run_if(tests, {"foo": "bar"})) - # Still disabled because foo == 'baz' fails (AND logic) - assert "disabled" in tests[2] - assert tests[2]["disabled"] == "run-if: foo == 'baz'" - - tests = deepcopy(ref) - tests = list(run_if(tests, {"foo": "bar", "debug": True})) - # Still disabled because foo == 'baz' fails - assert "disabled" in tests[2] - assert tests[2]["disabled"] == "run-if: foo == 'baz'" - - tests = deepcopy(ref) - tests = list(run_if(tests, {"os": "android", "condprof": False})) - assert "disabled" in tests[9] - - tests = deepcopy(ref) - tests = list(run_if(tests, {"os": "win", "condprof": False})) - assert "disabled" not in tests[9] - - tests = deepcopy(ref) - tests = list(run_if(tests, {"os": "android", "condprof": True})) - assert "disabled" in tests[9] - - tests = deepcopy(ref) - tests = list(run_if(tests, {"os": "win", "condprof": True})) - assert "disabled" in tests[9] + assert "disabled" not in tests[2] def test_fail_if(tests):