[commit: ghc] master: Testsuite: never pick up .T files in .run directories (bbf0aa2)
git at git.haskell.org
git at git.haskell.org
Tue Jun 28 12:21:29 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/bbf0aa27281d905ac8767fcbc7a26f1bfa38a1b2/ghc
>---------------------------------------------------------------
commit bbf0aa27281d905ac8767fcbc7a26f1bfa38a1b2
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date: Tue Jun 21 09:52:36 2016 +0200
Testsuite: never pick up .T files in .run directories
And use os.walk instead of calling os.listdir many times. The testsuite
driver should be able to handle backward slashes on Windows now.
>---------------------------------------------------------------
bbf0aa27281d905ac8767fcbc7a26f1bfa38a1b2
testsuite/driver/runtests.py | 2 +-
testsuite/driver/testlib.py | 21 ++++++++-------------
2 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py
index 917003b..b2054fe 100644
--- a/testsuite/driver/runtests.py
+++ b/testsuite/driver/runtests.py
@@ -257,7 +257,7 @@ print('Timeout is ' + str(config.timeout))
if config.rootdirs == []:
config.rootdirs = ['.']
-t_files = findTFiles(config.rootdirs)
+t_files = list(findTFiles(config.rootdirs))
print('Found', len(t_files), '.T files...')
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index 41e0fce..d4fcf13 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -1933,19 +1933,14 @@ def cleanup():
# Return a list of all the files ending in '.T' below directories roots.
def findTFiles(roots):
- # It would be better to use os.walk, but that
- # gives backslashes on Windows, which trip the
- # testsuite later :-(
- return [filename for root in roots for filename in findTFiles_(root)]
-
-def findTFiles_(path):
- if os.path.isdir(path):
- paths = [os.path.join(path, x) for x in os.listdir(path)]
- return findTFiles(paths)
- elif path[-2:] == '.T':
- return [path]
- else:
- return []
+ for root in roots:
+ for path, dirs, files in os.walk(root, topdown=True):
+ # Never pick up .T files in uncleaned .run directories.
+ dirs[:] = [dir for dir in sorted(dirs)
+ if not dir.endswith(testdir_suffix)]
+ for filename in files:
+ if filename.endswith('.T'):
+ yield os.path.join(path, filename)
# -----------------------------------------------------------------------------
# Output a test summary to the specified file object
More information about the ghc-commits
mailing list