summaryrefslogtreecommitdiff
path: root/testsuite/driver
diff options
context:
space:
mode:
authorThomas Miedema <thomasmiedema@gmail.com>2016-06-21 09:52:36 +0200
committerThomas Miedema <thomasmiedema@gmail.com>2016-06-27 18:45:15 +0200
commitbbf0aa27281d905ac8767fcbc7a26f1bfa38a1b2 (patch)
tree1723148e7896200bd84bbd9507e843bf926440a6 /testsuite/driver
parentafa6e8309e8e7a069abcf7879791d53cdf22f00a (diff)
downloadhaskell-bbf0aa27281d905ac8767fcbc7a26f1bfa38a1b2.tar.gz
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.
Diffstat (limited to 'testsuite/driver')
-rw-r--r--testsuite/driver/runtests.py2
-rw-r--r--testsuite/driver/testlib.py21
2 files changed, 9 insertions, 14 deletions
diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py
index 917003bd8a..b2054fe1dd 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 41e0fce73c..d4fcf13d09 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