Skip to content

Commit 1645589

Browse files
authored
[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.
1 parent 4d1cd7c commit 1645589

File tree

5 files changed

+72
-41
lines changed

5 files changed

+72
-41
lines changed

Fortran/gfortran/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ In order to enable this test on cygwin, the following must be added to
312312

313313
```
314314
"chmod_1.f90":
315-
enable_on: ["*-*-cygwin*"]
315+
enabled_on: ["*-*-cygwin*"]
316316
```
317317

318318
Note that the string in the value of `enabled_on` exactly matches the string

Fortran/gfortran/regression/DisabledFiles.cmake

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ file(GLOB UNSUPPORTED_FILES CONFIGURE_DEPENDS
137137

138138
# Test is not conformant: reference to f() in tobias::sub1 violates Fortran
139139
# 2023 (and before) 15.5.2.14 point (4). `f()` references the actual argument
140-
# of `x` while `x` does not have the TARGET or POINTER attribute.
140+
# of `x` while `x` does not have the TARGET or POINTER attribute.
141141
aliasing_array_result_1.f90
142142
)
143143

@@ -829,19 +829,6 @@ file(GLOB SKIPPED_FILES CONFIGURE_DEPENDS
829829
quad_1.f90
830830
internal_dummy_3.f08
831831

832-
# --------------------------------------------------------------------------
833-
#
834-
# These tests are skipped because they fail on AArch64 but not x86. These
835-
# will be disabled until we allow tests to be selectively enabled on certain
836-
# platforms.
837-
838-
large_integer_kind.f90
839-
maxlocval_1.f90
840-
pr91497.f90
841-
842-
alloc_comp_class_4.f03 # TODO: This also fails on X86, so recategorize
843-
unpack_bounds_1.f90 # TODO: This also fails on X86, so recategorize
844-
845832
# --------------------------------------------------------------------------
846833
#
847834
# These are skipped almost certainly because of a bug in the way multi-file
@@ -925,6 +912,7 @@ file(GLOB FAILING_FILES CONFIGURE_DEPENDS
925912
stop_shouldfail.f90 # STOP stops program
926913

927914
# require further analysis
915+
alloc_comp_class_4.f03
928916
bounds_check_10.f90
929917
bounds_check_7.f90
930918
bounds_check_array_ctor_1.f90
@@ -1026,12 +1014,6 @@ file(GLOB FAILING_FILES CONFIGURE_DEPENDS
10261014
do_check_1.f90
10271015
random_3.f90
10281016

1029-
# These tests fail at runtime on AArch64 (but pass on x86). Disable them
1030-
# anyway so the test-suite passes by default on AArch64.
1031-
entry_23.f
1032-
findloc_8.f90
1033-
pr99210.f90
1034-
10351017
# These tests go into an infinite loop printing "Hello World"
10361018
pointer_check_1.f90
10371019
pointer_check_2.f90
@@ -1864,8 +1846,4 @@ file(GLOB FAILING_FILES CONFIGURE_DEPENDS
18641846

18651847
# Tests expect semantic errors that are not raised.
18661848
c_sizeof_7.f90
1867-
1868-
# Tests that use "PRINT namelistname"
1869-
namelist_print_2.f
1870-
print_fmt_2.f90
18711849
)

Fortran/gfortran/regression/override.yaml

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,50 @@
55
#
66
# Please see gfortran/README.md for instructions on editing this file.
77
#
8+
# This file is broadly divided into two. The first section contains tests that
9+
# are "temporarily" overridden. These are usually tests that fail on certain
10+
# platforms, but pass on others, but are intended to pass everywhere. When the
11+
# underlying issue is addressed, the tests should be removed. Eventually, there
12+
# should be no tests at all in this section. The second section contains tests
13+
# that are "permanently" overridden - usually because flang's behavior deviates
14+
# from gfortran, but we want the tests to run anyway.
15+
#
816
# When adding a test to this file, please leave a comment describing why the
917
# behavior of the test is being overridden.
1018

11-
# The following two tests use ```print <namelist name>```. This is a
12-
# non-standard extension that is not supported in certain cases in gfortran,
13-
# but, for now, is always supported in flang,
19+
20+
# ------------------------ TEMPORARILY OVERRIDDEN TESTS ------------------------
21+
22+
# findloc_8.f90 currently causes an assertion failure in SelectionDAG.cpp on
23+
# some platforms.
24+
#
25+
# Assertion `Elt->getBitWidth() == EltVT.getSizeInBits() && "APInt size does not match type size!"' failed.
26+
#
27+
"findloc_8.f90":
28+
disabled_on: ["aarch64-*-*", "loongarch64-*-*", "ppc64le-*-*"]
29+
30+
# entry_23.f raises a segmentation fault at runtime, on some platforms.
31+
"entry_23.f":
32+
disabled_on: ["aarch64-*-*", "loongarch64-*-*", "ppc64le-*-*"]
33+
34+
# pr91497.f90 fails to compile on some platforms with the following message:
35+
# error: 'kind=' argument must be a constant scalar integer whose value is a
36+
# supported kind for the intrinsic result type.
37+
"pr91497.f90":
38+
disabled_on: ["aarch64-*-*", "loongarch64-*-*", "ppc64le-*-*"]
39+
40+
# maxlocval_1.f90 fails at runtime with "STOP: code 1" on AArch64. This is not
41+
# expected and does not occur on other targets.
42+
"maxlocval_1.f90":
43+
disabled_on: ["aarch64-*-*"]
44+
45+
46+
# ------------------------ PERMANENTLY OVERRIDDEN TESTS ------------------------
47+
48+
# namelist_print_2.f and print_fmt_2.f90 use ```print <namelist name>```. This
49+
# is a non-standard extension that is not supported in certain cases in
50+
# gfortran, but is always supported in flang.
51+
1452
"namelist_print_2.f":
1553
xfail: false
1654

Fortran/gfortran/regression/tests.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ preprocess;warning-directive-2.F90;xfail;-std=f95 -fdiagnostics-show-option -Wer
4444
preprocess;warning-directive-3.F90;;-std=f95 -fdiagnostics-show-option -Werror -Wno-error=cpp;;
4545
preprocess;warning-directive-4.F90;;-std=f95 -fdiagnostics-show-option -Wno-cpp;;
4646
assemble;module_naming_1.f90;;;;
47+
assemble;pr88833.f90;;-O3 -march=armv8.2-a+sve --save-temps;;
4748
assemble;same_name_1.f90;;;;
4849
compile;20181025-1.f;;-Ofast;;
4950
compile;20231103-1.f90;;-Ofast;;
@@ -2635,7 +2636,6 @@ compile;pr88379.f90;;-fcoarray=single;;
26352636
compile;pr88467.f90;xfail;;;
26362637
compile;pr88552.f90;xfail;;;
26372638
compile;pr88624.f90;;-fcoarray=lib;;
2638-
compile;pr88833.f90;;-O3 -march=armv8.2-a+sve --save-temps;;
26392639
compile;pr88902.f90;;-flto --param ggc-min-heapsize=0;;
26402640
compile;pr88932.f90;;-O1 -fpredictive-commoning -fno-tree-ch -fno-tree-dominator-opts -fno-tree-fre;;
26412641
compile;pr88934.f90;;-O -ftree-vectorize;;
@@ -2671,7 +2671,7 @@ compile;pr91372.f90;;;;
26712671
compile;pr91471.f90;;;;
26722672
compile;pr91485.f90;;;;
26732673
compile;pr91496.f90;;-fdump-tree-original;;
2674-
compile;pr91497.f90;;-Wall;;
2674+
compile;pr91497.f90;;-Wall;;aarch64-.+-.+ loongarch64-.+-.+ ppc64le-.+-.+
26752675
compile;pr91497_2.f90;;-Wall;;
26762676
compile;pr91564.f90;xfail;;;
26772677
compile;pr91565.f90;xfail;;;
@@ -4701,7 +4701,7 @@ run;entry_12.f90;;;;
47014701
run;entry_13.f90;;;;
47024702
run;entry_14.f90;;;;
47034703
run;entry_16.f90;;;;
4704-
run;entry_23.f;;;;
4704+
run;entry_23.f;;;;aarch64-.+-.+ loongarch64-.+-.+ ppc64le-.+-.+
47054705
run;entry_26.f90;;-fno-f2c;;
47064706
run;entry_27.f90;;-ff2c;;
47074707
run;entry_3.f90;;;;
@@ -4806,7 +4806,7 @@ run;findloc_3.f90;;;;
48064806
run;findloc_4.f90;;;;
48074807
run;findloc_5.f90;;;;
48084808
run;findloc_6.f90;;;;
4809-
run;findloc_8.f90;;;;
4809+
run;findloc_8.f90;;;;aarch64-.+-.+ loongarch64-.+-.+ ppc64le-.+-.+
48104810
run;float_1.f90;;;;
48114811
run;flush_1.f90;;;;
48124812
run;fmt_bz_bn.f;;;;
@@ -5248,7 +5248,7 @@ run;maxloc_bounds_6.f90;xfail;-fbounds-check;;
52485248
run;maxloc_bounds_7.f90;xfail;-fbounds-check;;
52495249
run;maxloc_bounds_8.f90;xfail;-fbounds-check;;
52505250
run;maxloc_string_1.f90;;;;
5251-
run;maxlocval_1.f90;;;;
5251+
run;maxlocval_1.f90;;;;aarch64-.+-.+
52525252
run;maxlocval_2.f90;;;;
52535253
run;maxlocval_3.f90;;;;
52545254
run;maxlocval_4.f90;;;;

Fortran/gfortran/utils/update-test-config.py

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def __str__(self):
108108

109109
re_btxt = re.compile('[{][ ]*(.+?)[ ]*[}]')
110110
re_fortran = re.compile('^.+[.][Ff].*$')
111-
re_assemble = re.compile(f'{pfx}dg-(lto-)?do[ ]*assemble{sfx}')
111+
re_assemble = re.compile(f'{pfx}dg-(lto-)?do[ ]*assemble[ ]*{tgt}{sfx}')
112112
re_preprocess = re.compile(f'{pfx}dg-do[ ]*preprocess{sfx}')
113113
re_compile = re.compile(f'{pfx}dg-do[ ]*compile[ ]*{tgt}{sfx}')
114114
re_link = re.compile(f'{pfx}dg-(lto-)?do[ ]*link[ ]*{tgt}{sfx}')
@@ -129,7 +129,7 @@ def __str__(self):
129129

130130
# Maps from known platforms to triples that LLVM will understand.
131131
# FIXME: The ia32 target probably does not always correspond to i386. Does it
132-
# means that it will be enabled on other non-X86 platforms?
132+
# mean that it will be enabled on other non-X86 platforms?
133133
platforms = {'ia32': 'i386-*-*'}
134134

135135
# 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:
225225
# The target is usually a regular expression. But the regex syntax used by
226226
# DejaGNU is not exactly the same as that supported by cmake. This translates
227227
# the DejaGNU regex to a cmake-compatible regex.
228+
#
229+
# WARNING: This function is not intended to be a faithful translation of all
230+
# DejaGNU regexes to equivalent CMake regexes. The target specifications used in
231+
# the gfortran test suite happen to use a subset of the regex language, so we
232+
# can get away with doing quick and easy replacements.
228233
def convert_target_regex(t: str) -> str:
229-
# XXX: This translation is not strictly correct.
230234
# In DejaGNU, the ? character matches a single character unless it follows
231-
# an atom. In the target specifications in the gfortran test suite, this is
232-
# only used as a single character match.
235+
# an atom. In the target specifications in the gfortran test suite, however,
236+
# it is only used as a single character match, so just replace it with the
237+
# cmake equivalent.
233238
t = t.replace('?', '.')
234239

235-
# XXX: This translation is not strictly correct.
236-
# in DejaGNU, the * character can also be a wildcard match for zero or more
240+
# In DejaGNU, the * character can also be a wildcard match for zero or more
237241
# characters unless it follows an atom. In the target specifications in the
238-
# gfortran test suite, it is only used as a wildcard.
242+
# gfortran test suite, however, it is only used as a wildcard match, so just
243+
# replace it with the cmake equivalent.
239244
t = t.replace('*', '.+')
240245

241246
return t
@@ -569,6 +574,16 @@ def type_error(attr: str, key: str, typ: str) -> None:
569574
type_error(attr, main, 'boolean')
570575
else:
571576
error('Unknown attribute "{}" in key "{}"', attr, main)
577+
578+
# We allow the target specifications in the `enabled_on` and `disabled_on`
579+
# lists to use * as a wildcard match. This is to keep it consistent with
580+
# the DejaGNU specifications in the tests. But that syntax is not
581+
# compatible with CMake regexes, so they need to be converted before use.
582+
for _, attrs in yml.items():
583+
for k in ['enabled_on', 'disabled_on']:
584+
if k in attrs:
585+
attrs[k] = [convert_target_regex(r) for r in attrs[k]]
586+
572587
return yml
573588

574589
# Override the disabled_on property of the test.

0 commit comments

Comments
 (0)