Skip to content

Commit acbf1d5

Browse files
authored
[Fortran/gfortran] Skip some directories when generating test configurations (#246)
Some directories in the gfortran test suite only contain "dependent" sources. These are sources used in multi-file tests where only the "main" source file contains DejaGNU directives that are used to determine the behavior of the test. A list of such "dependents-only" directories have been added to the update-test-config script so a test configuration is not generated for them.
1 parent 39bdfec commit acbf1d5

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,21 @@ def get_lines(filepath: str) -> list[str]:
163163
finally:
164164
return lines
165165

166+
# Check if a test configuration should be generated for the given directory.
167+
# The directory will be an absolute path.
168+
#
169+
# Multi-file tests consist of a single "main" file and some number of dependent
170+
# sources. Some directories only contain "dependent" sources. A test
171+
# configuration should not be generated for such directories.
172+
def should_generate_config(d: str) -> bool:
173+
# The directories containing only dependent sources. These should be
174+
# relative to the root directory containing the gfortran tests.
175+
skip: list[str] = [os.path.join('regression', 'coarray', 'add_sources')]
176+
for s in skip:
177+
if d.endswith(s):
178+
return False
179+
return True
180+
166181
# Collect the subdirectories of the gfortran directory which may contain tests.
167182
def get_subdirs(gfortran: str) -> list[str]:
168183
regression = os.path.join(gfortran, 'regression')
@@ -174,7 +189,8 @@ def get_subdirs(gfortran: str) -> list[str]:
174189
subdirs.append(torture)
175190
for root, dirs, _ in os.walk(torture):
176191
subdirs.extend([os.path.join(root, d) for d in dirs])
177-
return subdirs
192+
193+
return list(filter(should_generate_config, subdirs))
178194

179195
# Strip any leading and trailing whitespace from the string as well as any
180196
# optional quotes around the string. Then split the string on whitespace and

0 commit comments

Comments
 (0)