Skip to content

[Fortran/gfortran] Skip some directories when generating test configurations #246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion Fortran/gfortran/utils/update-test-config.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,21 @@ def get_lines(filepath: str) -> list[str]:
finally:
return lines

# Check if a test configuration should be generated for the given directory.
# The directory will be an absolute path.
#
# Multi-file tests consist of a single "main" file and some number of dependent
# sources. Some directories only contain "dependent" sources. A test
# configuration should not be generated for such directories.
def should_generate_config(d: str) -> bool:
# The directories containing only dependent sources. These should be
# relative to the root directory containing the gfortran tests.
skip: list[str] = [os.path.join('regression', 'coarray', 'add_sources')]
for s in skip:
if d.endswith(s):
return False
return True

# Collect the subdirectories of the gfortran directory which may contain tests.
def get_subdirs(gfortran: str) -> list[str]:
regression = os.path.join(gfortran, 'regression')
Expand All @@ -174,7 +189,8 @@ def get_subdirs(gfortran: str) -> list[str]:
subdirs.append(torture)
for root, dirs, _ in os.walk(torture):
subdirs.extend([os.path.join(root, d) for d in dirs])
return subdirs

return list(filter(should_generate_config, subdirs))

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