From 16455890f2823fc1fcda4afce58a607322040871 Mon Sep 17 00:00:00 2001 From: Tarun Prabhu Date: Mon, 16 Dec 2024 08:58:32 -0700 Subject: [PATCH] [Fortran/gfortran] Disable tests on some platforms, but enable them elsewhere Some tests fail only on certain platforms, but pass on others. Previously, these were disabled everywhere, but now they can be disabled only on the platforms on which they fail and enabled elsewhere. In addition, some tests that were failing only on AArch64 now pass, so they are enabled everywhere. The static test configuration has been updated to reflect these changes. Some bugs were exposed in the update script during this process. These have been fixed. Primarily, * is now allowed as a wildcard in the override.yaml file. Earlier, this would not work correctly since * is not a valid matcher in CMake regexes. This is now correctly translated to the equivalent .+ in CMake. --- Fortran/gfortran/README.md | 2 +- .../gfortran/regression/DisabledFiles.cmake | 26 +---------- Fortran/gfortran/regression/override.yaml | 44 +++++++++++++++++-- Fortran/gfortran/regression/tests.cmake | 10 ++--- Fortran/gfortran/utils/update-test-config.py | 31 +++++++++---- 5 files changed, 72 insertions(+), 41 deletions(-) diff --git a/Fortran/gfortran/README.md b/Fortran/gfortran/README.md index 96a4ccfbd..1d73da79b 100644 --- a/Fortran/gfortran/README.md +++ b/Fortran/gfortran/README.md @@ -312,7 +312,7 @@ In order to enable this test on cygwin, the following must be added to ``` "chmod_1.f90": - enable_on: ["*-*-cygwin*"] + enabled_on: ["*-*-cygwin*"] ``` Note that the string in the value of `enabled_on` exactly matches the string diff --git a/Fortran/gfortran/regression/DisabledFiles.cmake b/Fortran/gfortran/regression/DisabledFiles.cmake index ef2a9416c..026fb4d84 100644 --- a/Fortran/gfortran/regression/DisabledFiles.cmake +++ b/Fortran/gfortran/regression/DisabledFiles.cmake @@ -137,7 +137,7 @@ file(GLOB UNSUPPORTED_FILES CONFIGURE_DEPENDS # Test is not conformant: reference to f() in tobias::sub1 violates Fortran # 2023 (and before) 15.5.2.14 point (4). `f()` references the actual argument - # of `x` while `x` does not have the TARGET or POINTER attribute. + # of `x` while `x` does not have the TARGET or POINTER attribute. aliasing_array_result_1.f90 ) @@ -829,19 +829,6 @@ file(GLOB SKIPPED_FILES CONFIGURE_DEPENDS quad_1.f90 internal_dummy_3.f08 - # -------------------------------------------------------------------------- - # - # These tests are skipped because they fail on AArch64 but not x86. These - # will be disabled until we allow tests to be selectively enabled on certain - # platforms. - - large_integer_kind.f90 - maxlocval_1.f90 - pr91497.f90 - - alloc_comp_class_4.f03 # TODO: This also fails on X86, so recategorize - unpack_bounds_1.f90 # TODO: This also fails on X86, so recategorize - # -------------------------------------------------------------------------- # # These are skipped almost certainly because of a bug in the way multi-file @@ -925,6 +912,7 @@ file(GLOB FAILING_FILES CONFIGURE_DEPENDS stop_shouldfail.f90 # STOP stops program # require further analysis + alloc_comp_class_4.f03 bounds_check_10.f90 bounds_check_7.f90 bounds_check_array_ctor_1.f90 @@ -1026,12 +1014,6 @@ file(GLOB FAILING_FILES CONFIGURE_DEPENDS do_check_1.f90 random_3.f90 - # These tests fail at runtime on AArch64 (but pass on x86). Disable them - # anyway so the test-suite passes by default on AArch64. - entry_23.f - findloc_8.f90 - pr99210.f90 - # These tests go into an infinite loop printing "Hello World" pointer_check_1.f90 pointer_check_2.f90 @@ -1864,8 +1846,4 @@ file(GLOB FAILING_FILES CONFIGURE_DEPENDS # Tests expect semantic errors that are not raised. c_sizeof_7.f90 - - # Tests that use "PRINT namelistname" - namelist_print_2.f - print_fmt_2.f90 ) diff --git a/Fortran/gfortran/regression/override.yaml b/Fortran/gfortran/regression/override.yaml index fd68e3af1..73010bd9b 100644 --- a/Fortran/gfortran/regression/override.yaml +++ b/Fortran/gfortran/regression/override.yaml @@ -5,12 +5,50 @@ # # Please see gfortran/README.md for instructions on editing this file. # +# This file is broadly divided into two. The first section contains tests that +# are "temporarily" overridden. These are usually tests that fail on certain +# platforms, but pass on others, but are intended to pass everywhere. When the +# underlying issue is addressed, the tests should be removed. Eventually, there +# should be no tests at all in this section. The second section contains tests +# that are "permanently" overridden - usually because flang's behavior deviates +# from gfortran, but we want the tests to run anyway. +# # When adding a test to this file, please leave a comment describing why the # behavior of the test is being overridden. -# The following two tests use ```print ```. This is a -# non-standard extension that is not supported in certain cases in gfortran, -# but, for now, is always supported in flang, + +# ------------------------ TEMPORARILY OVERRIDDEN TESTS ------------------------ + +# findloc_8.f90 currently causes an assertion failure in SelectionDAG.cpp on +# some platforms. +# +# Assertion `Elt->getBitWidth() == EltVT.getSizeInBits() && "APInt size does not match type size!"' failed. +# +"findloc_8.f90": + disabled_on: ["aarch64-*-*", "loongarch64-*-*", "ppc64le-*-*"] + +# entry_23.f raises a segmentation fault at runtime, on some platforms. +"entry_23.f": + disabled_on: ["aarch64-*-*", "loongarch64-*-*", "ppc64le-*-*"] + +# pr91497.f90 fails to compile on some platforms with the following message: +# error: 'kind=' argument must be a constant scalar integer whose value is a +# supported kind for the intrinsic result type. +"pr91497.f90": + disabled_on: ["aarch64-*-*", "loongarch64-*-*", "ppc64le-*-*"] + +# maxlocval_1.f90 fails at runtime with "STOP: code 1" on AArch64. This is not +# expected and does not occur on other targets. +"maxlocval_1.f90": + disabled_on: ["aarch64-*-*"] + + +# ------------------------ PERMANENTLY OVERRIDDEN TESTS ------------------------ + +# namelist_print_2.f and print_fmt_2.f90 use ```print ```. This +# is a non-standard extension that is not supported in certain cases in +# gfortran, but is always supported in flang. + "namelist_print_2.f": xfail: false diff --git a/Fortran/gfortran/regression/tests.cmake b/Fortran/gfortran/regression/tests.cmake index ca9c21cb0..c093a7dbc 100644 --- a/Fortran/gfortran/regression/tests.cmake +++ b/Fortran/gfortran/regression/tests.cmake @@ -44,6 +44,7 @@ preprocess;warning-directive-2.F90;xfail;-std=f95 -fdiagnostics-show-option -Wer preprocess;warning-directive-3.F90;;-std=f95 -fdiagnostics-show-option -Werror -Wno-error=cpp;; preprocess;warning-directive-4.F90;;-std=f95 -fdiagnostics-show-option -Wno-cpp;; assemble;module_naming_1.f90;;;; +assemble;pr88833.f90;;-O3 -march=armv8.2-a+sve --save-temps;; assemble;same_name_1.f90;;;; compile;20181025-1.f;;-Ofast;; compile;20231103-1.f90;;-Ofast;; @@ -2635,7 +2636,6 @@ compile;pr88379.f90;;-fcoarray=single;; compile;pr88467.f90;xfail;;; compile;pr88552.f90;xfail;;; compile;pr88624.f90;;-fcoarray=lib;; -compile;pr88833.f90;;-O3 -march=armv8.2-a+sve --save-temps;; compile;pr88902.f90;;-flto --param ggc-min-heapsize=0;; compile;pr88932.f90;;-O1 -fpredictive-commoning -fno-tree-ch -fno-tree-dominator-opts -fno-tree-fre;; compile;pr88934.f90;;-O -ftree-vectorize;; @@ -2671,7 +2671,7 @@ compile;pr91372.f90;;;; compile;pr91471.f90;;;; compile;pr91485.f90;;;; compile;pr91496.f90;;-fdump-tree-original;; -compile;pr91497.f90;;-Wall;; +compile;pr91497.f90;;-Wall;;aarch64-.+-.+ loongarch64-.+-.+ ppc64le-.+-.+ compile;pr91497_2.f90;;-Wall;; compile;pr91564.f90;xfail;;; compile;pr91565.f90;xfail;;; @@ -4701,7 +4701,7 @@ run;entry_12.f90;;;; run;entry_13.f90;;;; run;entry_14.f90;;;; run;entry_16.f90;;;; -run;entry_23.f;;;; +run;entry_23.f;;;;aarch64-.+-.+ loongarch64-.+-.+ ppc64le-.+-.+ run;entry_26.f90;;-fno-f2c;; run;entry_27.f90;;-ff2c;; run;entry_3.f90;;;; @@ -4806,7 +4806,7 @@ run;findloc_3.f90;;;; run;findloc_4.f90;;;; run;findloc_5.f90;;;; run;findloc_6.f90;;;; -run;findloc_8.f90;;;; +run;findloc_8.f90;;;;aarch64-.+-.+ loongarch64-.+-.+ ppc64le-.+-.+ run;float_1.f90;;;; run;flush_1.f90;;;; run;fmt_bz_bn.f;;;; @@ -5248,7 +5248,7 @@ run;maxloc_bounds_6.f90;xfail;-fbounds-check;; run;maxloc_bounds_7.f90;xfail;-fbounds-check;; run;maxloc_bounds_8.f90;xfail;-fbounds-check;; run;maxloc_string_1.f90;;;; -run;maxlocval_1.f90;;;; +run;maxlocval_1.f90;;;;aarch64-.+-.+ run;maxlocval_2.f90;;;; run;maxlocval_3.f90;;;; run;maxlocval_4.f90;;;; diff --git a/Fortran/gfortran/utils/update-test-config.py b/Fortran/gfortran/utils/update-test-config.py index 1cab0c7bd..f42424ce7 100755 --- a/Fortran/gfortran/utils/update-test-config.py +++ b/Fortran/gfortran/utils/update-test-config.py @@ -108,7 +108,7 @@ def __str__(self): re_btxt = re.compile('[{][ ]*(.+?)[ ]*[}]') re_fortran = re.compile('^.+[.][Ff].*$') -re_assemble = re.compile(f'{pfx}dg-(lto-)?do[ ]*assemble{sfx}') +re_assemble = re.compile(f'{pfx}dg-(lto-)?do[ ]*assemble[ ]*{tgt}{sfx}') re_preprocess = re.compile(f'{pfx}dg-do[ ]*preprocess{sfx}') re_compile = re.compile(f'{pfx}dg-do[ ]*compile[ ]*{tgt}{sfx}') re_link = re.compile(f'{pfx}dg-(lto-)?do[ ]*link[ ]*{tgt}{sfx}') @@ -129,7 +129,7 @@ def __str__(self): # Maps from known platforms to triples that LLVM will understand. # FIXME: The ia32 target probably does not always correspond to i386. Does it -# means that it will be enabled on other non-X86 platforms? +# mean that it will be enabled on other non-X86 platforms? platforms = {'ia32': 'i386-*-*'} # Get the n-th level ancestor of the given file. The 1st level ancestor is @@ -225,17 +225,22 @@ def error(fmt: str, *args) -> None: # The target is usually a regular expression. But the regex syntax used by # DejaGNU is not exactly the same as that supported by cmake. This translates # the DejaGNU regex to a cmake-compatible regex. +# +# WARNING: This function is not intended to be a faithful translation of all +# DejaGNU regexes to equivalent CMake regexes. The target specifications used in +# the gfortran test suite happen to use a subset of the regex language, so we +# can get away with doing quick and easy replacements. def convert_target_regex(t: str) -> str: - # XXX: This translation is not strictly correct. # In DejaGNU, the ? character matches a single character unless it follows - # an atom. In the target specifications in the gfortran test suite, this is - # only used as a single character match. + # an atom. In the target specifications in the gfortran test suite, however, + # it is only used as a single character match, so just replace it with the + # cmake equivalent. t = t.replace('?', '.') - # XXX: This translation is not strictly correct. - # in DejaGNU, the * character can also be a wildcard match for zero or more + # In DejaGNU, the * character can also be a wildcard match for zero or more # characters unless it follows an atom. In the target specifications in the - # gfortran test suite, it is only used as a wildcard. + # gfortran test suite, however, it is only used as a wildcard match, so just + # replace it with the cmake equivalent. t = t.replace('*', '.+') return t @@ -569,6 +574,16 @@ def type_error(attr: str, key: str, typ: str) -> None: type_error(attr, main, 'boolean') else: error('Unknown attribute "{}" in key "{}"', attr, main) + + # We allow the target specifications in the `enabled_on` and `disabled_on` + # lists to use * as a wildcard match. This is to keep it consistent with + # the DejaGNU specifications in the tests. But that syntax is not + # compatible with CMake regexes, so they need to be converted before use. + for _, attrs in yml.items(): + for k in ['enabled_on', 'disabled_on']: + if k in attrs: + attrs[k] = [convert_target_regex(r) for r in attrs[k]] + return yml # Override the disabled_on property of the test.