summaryrefslogtreecommitdiff
path: root/testsuite/driver/runtests.py
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2022-01-31 19:08:01 +0000
committerMatthew Pickering <matthewtpickering@gmail.com>2022-02-03 15:21:46 +0000
commitd29412537467cc4617da5e8859554e9ccd1924b7 (patch)
tree1595803ce81a7b2bcefcc8697fffe7a449452591 /testsuite/driver/runtests.py
parente59446c6a682587c21424e5830f305ab2f8f8cfa (diff)
downloadhaskell-wip/lint-testsuite.tar.gz
testsuite: Run testsuite dependency calculation before GHC is builtwip/lint-testsuite
The main motivation for this patch is to allow tests to be added to the testsuite which test things about the source tree without needing to build GHC. In particular the notes linter can easily start failing and by integrating it into the testsuite the process of observing these changes is caught by normal validation procedures rather than having to run the linter specially. With this patch I can run ``` ./hadrian/build test --flavour=devel2 --only="uniques" ``` In a clean tree to run the checkUniques linter without having to build GHC. Fixes #21029
Diffstat (limited to 'testsuite/driver/runtests.py')
-rw-r--r--testsuite/driver/runtests.py37
1 files changed, 20 insertions, 17 deletions
diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py
index 6858715c7a..f2584e650e 100644
--- a/testsuite/driver/runtests.py
+++ b/testsuite/driver/runtests.py
@@ -274,27 +274,30 @@ def format_path(path):
# On Windows we need to set $PATH to include the paths to all the DLLs
# in order for the dynamic library tests to work.
-if windows:
- pkginfo = getStdout([config.ghc_pkg, 'dump'])
- topdir = config.libdir
+try:
if windows:
+ pkginfo = getStdout([config.ghc_pkg, 'dump'])
+ topdir = config.libdir
mingw = os.path.abspath(os.path.join(topdir, '../mingw/bin'))
mingw = format_path(mingw)
ghc_env['PATH'] = os.pathsep.join([ghc_env.get("PATH", ""), mingw])
- for line in pkginfo.split('\n'):
- if line.startswith('library-dirs:'):
- path = line.rstrip()
- path = re.sub('^library-dirs: ', '', path)
- # Use string.replace instead of re.sub, because re.sub
- # interprets backslashes in the replacement string as
- # escape sequences.
- path = path.replace('$topdir', topdir)
- if path.startswith('"'):
- path = re.sub('^"(.*)"$', '\\1', path)
- path = re.sub('\\\\(.)', '\\1', path)
-
- path = format_path(path)
- ghc_env['PATH'] = os.pathsep.join([path, ghc_env.get("PATH", "")])
+ for line in pkginfo.split('\n'):
+ if line.startswith('library-dirs:'):
+ path = line.rstrip()
+ path = re.sub('^library-dirs: ', '', path)
+ # Use string.replace instead of re.sub, because re.sub
+ # interprets backslashes in the replacement string as
+ # escape sequences.
+ path = path.replace('$topdir', topdir)
+ if path.startswith('"'):
+ path = re.sub('^"(.*)"$', '\\1', path)
+ path = re.sub('\\\\(.)', '\\1', path)
+
+ path = format_path(path)
+ ghc_env['PATH'] = os.pathsep.join([path, ghc_env.get("PATH", "")])
+except FileNotFoundError as err:
+ print (err)
+ print ("Failed to modify PATH for windows... some tests might fail")
testopts_local.x = TestOptions()