[commit: ghc] master: Strip ../ from testdir (fixes #15469) (29dfb63)

git at git.haskell.org git at git.haskell.org
Mon Aug 6 19:29:54 UTC 2018


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/29dfb63624442a27119c1a218fc3dae71afb16de/ghc

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

commit 29dfb63624442a27119c1a218fc3dae71afb16de
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date:   Mon Aug 6 19:48:39 2018 +0200

    Strip ../ from testdir (fixes #15469)
    
    Test Plan: Harbormaster
    
    Reviewers: bgamari
    
    Reviewed By: bgamari
    
    Subscribers: rwbarton, carter
    
    GHC Trac Issues: #15469
    
    Differential Revision: https://phabricator.haskell.org/D5039


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

29dfb63624442a27119c1a218fc3dae71afb16de
 testsuite/driver/testlib.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index f99c6ed..ef2b8dd 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -14,6 +14,7 @@ import copy
 import glob
 import sys
 from math import ceil, trunc
+from pathlib import PurePath
 import collections
 import subprocess
 
@@ -618,8 +619,9 @@ def newTestDir(tempdir, dir):
 testdir_suffix = '.run'
 
 def _newTestDir(name, opts, tempdir, dir):
+    testdir = os.path.join('', *(p for p in PurePath(dir).parts if p != '..'))
     opts.srcdir = os.path.join(os.getcwd(), dir)
-    opts.testdir = os.path.join(tempdir, dir, name + testdir_suffix)
+    opts.testdir = os.path.join(tempdir, testdir, name + testdir_suffix)
     opts.compiler_always_flags = config.compiler_always_flags
 
 # -----------------------------------------------------------------------------



More information about the ghc-commits mailing list