From 3ba7e627fabcfc6c7b7240ea5258da676533b0c4 Mon Sep 17 00:00:00 2001 From: Roman Cattaneo Date: Wed, 26 Feb 2025 17:07:57 +0100 Subject: [PATCH] ci: Fail CI if xfails pass unexpectedly (#1888) Be strict about tests marked with xfail. If they pass unexpectedly, fail the testsuite instead of logging an XPASS. --- pyproject.toml | 2 ++ tests/next_tests/definitions.py | 5 +++++ .../feature_tests/ffront_tests/test_execution.py | 4 +--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 1efce6bd29..e182b23878 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -319,6 +319,7 @@ markers = [ 'uses_sparse_fields_as_output: tests that require backend support for writing sparse fields', 'uses_strided_neighbor_offset: tests that require backend support for strided neighbor offset', 'uses_tuple_args: tests that require backend support for tuple arguments', + 'uses_tuple_args_with_different_but_promotable_dims: test that requires backend support for tuple args with different but promotable dims', 'uses_tuple_iterator: tests that require backend support to deref tuple iterators', 'uses_tuple_returns: tests that require backend support for tuple results', 'uses_zero_dimensional_fields: tests that require backend support for zero-dimensional fields', @@ -330,6 +331,7 @@ markers = [ ] norecursedirs = ['dist', 'build', 'cpp_backend_tests/build*', '_local/*', '.*'] testpaths = 'tests' +xfail_strict = true # -- ruff -- [tool.ruff] diff --git a/tests/next_tests/definitions.py b/tests/next_tests/definitions.py index b412c0c273..1f81076abf 100644 --- a/tests/next_tests/definitions.py +++ b/tests/next_tests/definitions.py @@ -116,6 +116,9 @@ class ProgramFormatterId(_PythonObjectIdMixin, str, enum.Enum): USES_REDUCTION_WITH_ONLY_SPARSE_FIELDS = "uses_reduction_with_only_sparse_fields" USES_STRIDED_NEIGHBOR_OFFSET = "uses_strided_neighbor_offset" USES_TUPLE_ARGS = "uses_tuple_args" +USES_TUPLES_ARGS_WITH_DIFFERENT_BUT_PROMOTABLE_DIMS = ( + "uses_tuple_args_with_different_but_promotable_dims" +) USES_TUPLE_ITERATOR = "uses_tuple_iterator" USES_TUPLE_RETURNS = "uses_tuple_returns" USES_ZERO_DIMENSIONAL_FIELDS = "uses_zero_dimensional_fields" @@ -139,6 +142,7 @@ class ProgramFormatterId(_PythonObjectIdMixin, str, enum.Enum): (USES_NEGATIVE_MODULO, XFAIL, UNSUPPORTED_MESSAGE), (USES_REDUCTION_WITH_ONLY_SPARSE_FIELDS, XFAIL, REDUCTION_WITH_ONLY_SPARSE_FIELDS_MESSAGE), (USES_SPARSE_FIELDS_AS_OUTPUT, XFAIL, UNSUPPORTED_MESSAGE), + (USES_TUPLES_ARGS_WITH_DIFFERENT_BUT_PROMOTABLE_DIMS, XFAIL, UNSUPPORTED_MESSAGE), ] # Markers to skip because of missing features in the domain inference DOMAIN_INFERENCE_SKIP_LIST = [ @@ -168,6 +172,7 @@ class ProgramFormatterId(_PythonObjectIdMixin, str, enum.Enum): ] ROUNDTRIP_SKIP_LIST = DOMAIN_INFERENCE_SKIP_LIST + [ (USES_SPARSE_FIELDS_AS_OUTPUT, XFAIL, UNSUPPORTED_MESSAGE), + (USES_TUPLES_ARGS_WITH_DIFFERENT_BUT_PROMOTABLE_DIMS, XFAIL, UNSUPPORTED_MESSAGE), ] GTFN_SKIP_TEST_LIST = ( COMMON_SKIP_TEST_LIST diff --git a/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_execution.py b/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_execution.py index d878d8d3ff..a042c60709 100644 --- a/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_execution.py +++ b/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_execution.py @@ -262,9 +262,7 @@ def testee(a: tuple[int32, tuple[int32, cases.IField, int32]]) -> cases.IField: @pytest.mark.uses_tuple_args -@pytest.mark.xfail( - reason="Not implemented in frontend (implicit size arg handling needs to be adopted) and GTIR embedded backend." -) +@pytest.mark.uses_tuple_args_with_different_but_promotable_dims def test_tuple_arg_with_different_but_promotable_dims(cartesian_case): @gtx.field_operator def testee(a: tuple[cases.IField, cases.IJField]) -> cases.IJField: