Skip to content

Commit 21891e1

Browse files
author
Tarun Prabhu
committed
Using * as a wildcard match is not allowed in CMake. This is correctly handled
when parsing the target specifications from the test, but the same needs to be done when parsing the override files since we allow the use of these wildcards in those files as well.
1 parent 0e9b5a3 commit 21891e1

File tree

2 files changed

+26
-11
lines changed

2 files changed

+26
-11
lines changed

Fortran/gfortran/regression/tests.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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;;aarch64-*-* loongarch64-*-*
2674+
compile;pr91497.f90;;-Wall;;aarch64-.+-.+ loongarch64-.+-.+
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;;;;aarch64-*-* loongarch64-*-*
4704+
run;entry_23.f;;;;aarch64-.+-.+ loongarch64-.+-.+
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;;;;aarch64-*-* loongarch64-*-*
4809+
run;findloc_8.f90;;;;aarch64-.+-.+ loongarch64-.+-.+
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;;;;aarch64-*-*
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: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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)