[commit: ghc] wip/python3-new: Testsuite driver: Fix findTFiles for Python 3 (8d95768)

git at git.haskell.org git at git.haskell.org
Sat Oct 4 18:27:32 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/python3-new
Link       : http://ghc.haskell.org/trac/ghc/changeset/8d95768c80baf47526d08b89e3beba24233fb448/ghc

>---------------------------------------------------------------

commit 8d95768c80baf47526d08b89e3beba24233fb448
Author: Krzysztof Gogolewski <krz.gogolewski at gmail.com>
Date:   Sat Oct 4 19:22:04 2014 +0200

    Testsuite driver: Fix findTFiles for Python 3
    
    Previous version broke Windows build. I'm unhappy about this code,
    but at least it no longer appends lists in O(n^2)...


>---------------------------------------------------------------

8d95768c80baf47526d08b89e3beba24233fb448
 testsuite/driver/testlib.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index e3562f7..397ff3b 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -2041,14 +2041,17 @@ def pretest_cleanup(name):
    # not interested in the return code
 
 # -----------------------------------------------------------------------------
-# Return a list of all the files ending in '.T' below the directory dir.
+# Return a list of all the files ending in '.T' below directories roots.
 
 def findTFiles(roots):
-    return concat(map(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 = map(lambda x, p=path: p + '/' + x, os.listdir(path))
+        paths = [path + '/' + x for x in os.listdir(path)]
         return findTFiles(paths)
     elif path[-2:] == '.T':
         return [path]



More information about the ghc-commits mailing list