[Git][ghc/ghc][wip/torsten.schmits/fix-linters-file-collection] test driver: fix file collection for regex linters
Torsten Schmits (@torsten.schmits)
gitlab at gitlab.haskell.org
Fri Nov 1 20:32:12 UTC 2024
Torsten Schmits pushed to branch wip/torsten.schmits/fix-linters-file-collection at Glasgow Haskell Compiler / GHC
Commits:
8e122905 by Torsten Schmits at 2024-11-01T21:31:18+01:00
test driver: fix file collection for regex linters
When a testsuite linter is executed with the `tracked` strategy, the
driver runs `git ls-tree` to collect eligible files.
This appears to have ceased producing any paths – `ls-tree` restricts
its results to the current working directory, which is
`testsuite/tests/linters` in this case.
As a quick fix, this patch changes the working directory to match
expectations.
- - - - -
2 changed files:
- testsuite/tests/linters/Makefile
- testsuite/tests/linters/regex-linters/linter.py
Changes:
=====================================
testsuite/tests/linters/Makefile
=====================================
@@ -12,16 +12,16 @@ uniques:
python3 checkUniques/check-uniques.py $(TOP)/..
makefiles:
- (cd $(TOP)/tests/linters/ && python3 regex-linters/check-makefiles.py tracked)
+ (cd $(TOP)/.. && python3 testsuite/tests/linters/regex-linters/check-makefiles.py tracked)
version-number:
regex-linters/check-version-number.sh ${TOP}/..
cpp:
- (cd $(TOP)/tests/linters/ && python3 regex-linters/check-cpp.py tracked)
+ (cd $(TOP)/.. && python3 testsuite/tests/linters/regex-linters/check-cpp.py tracked)
rts-includes:
- (cd $(TOP)/tests/linters/ && python3 regex-linters/check-rts-includes.py tracked)
+ (cd $(TOP)/.. && python3 testsuite/tests/linters/regex-linters/check-rts-includes.py tracked)
changelogs:
regex-linters/check-changelogs.sh $(TOP)/..
=====================================
testsuite/tests/linters/regex-linters/linter.py
=====================================
@@ -40,6 +40,8 @@ def get_changed_files(base_commit: str, head_commit: str,
def get_tracked_files(subdir: str = '.'):
""" Get the files tracked by git in the given subdirectory. """
+ if not Path(subdir).exists():
+ raise Exception("Regex linter executed with nonexistent target directory '{}'".format(subdir))
cmd = ['git', 'ls-tree', '--name-only', '-r', 'HEAD', subdir]
files = subprocess.check_output(cmd)
return files.decode('UTF-8').split('\n')
@@ -124,7 +126,7 @@ def run_linters(linters: Sequence[Linter],
linted_files = args.get_linted_files(args)
for path in linted_files:
- if path.startswith('linters'):
+ if path.startswith('testsuite/tests/linters'):
continue
for linter in linters:
linter.do_lint(Path(path))
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8e122905111ae973df455b3a7799373ae26cd1c1
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8e122905111ae973df455b3a7799373ae26cd1c1
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20241101/02158561/attachment-0001.html>
More information about the ghc-commits
mailing list