[Git][ghc/ghc][master] testsuite: Add --top flag to driver

Marge Bot gitlab at gitlab.haskell.org
Tue Nov 3 04:45:12 UTC 2020



 Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
4ce2f7d6 by GHC GitLab CI at 2020-11-02T23:45:06-05:00
testsuite: Add --top flag to driver

This allows us to make `config.top` a proper Path. Previously it was a
str, which caused the Ghostscript detection logic to break.

- - - - -


5 changed files:

- hadrian/src/Settings/Builders/RunTest.hs
- testsuite/driver/runtests.py
- testsuite/driver/testglobals.py
- testsuite/driver/testlib.py
- testsuite/mk/test.mk


Changes:

=====================================
hadrian/src/Settings/Builders/RunTest.hs
=====================================
@@ -102,6 +102,7 @@ runTestBuilderArgs = builder RunTest ? do
     -- TODO: set CABAL_MINIMAL_BUILD/CABAL_PLUGIN_BUILD
     mconcat [ arg $ "testsuite/driver/runtests.py"
             , pure [ "--rootdir=" ++ testdir | testdir <- rootdirs ]
+            , arg "--top", arg (top -/- "testsuite")
             , arg "-e", arg $ "windows=" ++ show windowsHost
             , arg "-e", arg $ "darwin=" ++ show osxHost
             , arg "-e", arg $ "config.local=False"
@@ -129,7 +130,6 @@ runTestBuilderArgs = builder RunTest ? do
             , arg "-e", arg $ "config.ghc_dynamic_by_default=" ++ show hasDynamicByDefault
             , arg "-e", arg $ "config.ghc_dynamic=" ++ show hasDynamic
 
-            , arg "-e", arg $ "config.top=" ++ show (top -/- "testsuite")
             , arg "-e", arg $ "config.wordsize=" ++ show wordsize
             , arg "-e", arg $ "config.os="       ++ show os
             , arg "-e", arg $ "config.arch="     ++ show arch


=====================================
testsuite/driver/runtests.py
=====================================
@@ -14,6 +14,7 @@ import tempfile
 import time
 import re
 import traceback
+from pathlib import Path
 
 # We don't actually need subprocess in runtests.py, but:
 # * We do need it in testlibs.py
@@ -56,6 +57,7 @@ parser = argparse.ArgumentParser(description="GHC's testsuite driver")
 perf_group = parser.add_mutually_exclusive_group()
 
 parser.add_argument("-e", action='append', help="A string to execute from the command line.")
+parser.add_argument("--top", type=Path, help="path to top of testsuite/ tree")
 parser.add_argument("--config-file", action="append", help="config file")
 parser.add_argument("--config", action='append', help="config field")
 parser.add_argument("--rootdir", action='append', help="root of tree containing tests (default: .)")
@@ -104,6 +106,9 @@ config.summary_file = args.summary_file
 config.no_print_summary = args.no_print_summary
 config.baseline_commit = args.perf_baseline
 
+if args.top:
+    config.top = args.top
+
 if args.only:
     config.only = args.only
     config.run_only_some_tests = True
@@ -277,7 +282,7 @@ testopts_local.x = TestOptions()
 
 # if timeout == -1 then we try to calculate a sensible value
 if config.timeout == -1:
-    config.timeout = int(read_no_crs(config.top + '/timeout/calibrate.out'))
+    config.timeout = int(read_no_crs(config.top / 'timeout' / 'calibrate.out'))
 
 print('Timeout is ' + str(config.timeout))
 print('Known ways: ' + ', '.join(config.other_ways))


=====================================
testsuite/driver/testglobals.py
=====================================
@@ -22,7 +22,7 @@ class TestConfig:
     def __init__(self):
 
         # Where the testsuite root is
-        self.top = ''
+        self.top = Path('.')
 
         # Directories below which to look for test description files (foo.T)
         self.rootdirs = []


=====================================
testsuite/driver/testlib.py
=====================================
@@ -1110,7 +1110,7 @@ def do_test(name: TestName,
         dst_makefile = in_testdir('Makefile')
         if src_makefile.exists():
             makefile = src_makefile.read_text(encoding='UTF-8')
-            makefile = re.sub('TOP=.*', 'TOP=' + config.top, makefile, 1)
+            makefile = re.sub('TOP=.*', 'TOP=%s' % config.top, makefile, 1)
             dst_makefile.write_text(makefile, encoding='UTF-8')
 
     if opts.pre_cmd:


=====================================
testsuite/mk/test.mk
=====================================
@@ -256,13 +256,13 @@ endif
 RUNTEST_OPTS +=  \
 	--rootdir=. \
 	--config-file=$(CONFIG) \
+	--top="$(TOP_ABS)" \
 	-e 'config.platform="$(TARGETPLATFORM)"' \
 	-e 'config.os="$(TargetOS_CPP)"' \
 	-e 'config.arch="$(TargetARCH_CPP)"' \
 	-e 'config.wordsize="$(WORDSIZE)"' \
 	-e 'config.timeout=int($(TIMEOUT)) or config.timeout' \
-	-e 'config.exeext="$(exeext)"' \
-	-e 'config.top="$(TOP_ABS)"'
+	-e 'config.exeext="$(exeext)"'
 
 # Wrap non-empty program paths in quotes, because they may contain spaces. Do
 # it here, so we don't have to (and don't forget to do it) in the .T test



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4ce2f7d6e6a516173750b1d740f345e90992ffce

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4ce2f7d6e6a516173750b1d740f345e90992ffce
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20201102/dfe29a39/attachment-0001.html>


More information about the ghc-commits mailing list