@@ -129,7 +129,7 @@ def __str__(self):
129
129
130
130
# Maps from known platforms to triples that LLVM will understand.
131
131
# 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?
133
133
platforms = {'ia32' : 'i386-*-*' }
134
134
135
135
# 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:
225
225
# The target is usually a regular expression. But the regex syntax used by
226
226
# DejaGNU is not exactly the same as that supported by cmake. This translates
227
227
# 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.
228
233
def convert_target_regex (t : str ) -> str :
229
- # XXX: This translation is not strictly correct.
230
234
# 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.
233
238
t = t .replace ('?' , '.' )
234
239
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
237
241
# 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.
239
244
t = t .replace ('*' , '.+' )
240
245
241
246
return t
@@ -569,6 +574,16 @@ def type_error(attr: str, key: str, typ: str) -> None:
569
574
type_error (attr , main , 'boolean' )
570
575
else :
571
576
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
+
572
587
return yml
573
588
574
589
# Override the disabled_on property of the test.
0 commit comments