[Git][ghc/ghc][wip/andreask/test_pkg_db] Testsuite: Support for user supplied package dbs
Andreas Klebinger
gitlab at gitlab.haskell.org
Mon Nov 2 14:10:32 UTC 2020
Andreas Klebinger pushed to branch wip/andreask/test_pkg_db at Glasgow Haskell Compiler / GHC
Commits:
0e68813c by Andreas Klebinger at 2020-11-02T15:10:09+01:00
Testsuite: Support for user supplied package dbs
We can now supply additional package dbs to the testsuite.
For make the package db can be supplied by
passing PACKAGE_DB=/path/to/db.
In the testsuite driver it's passed via the --test-package-db
argument.
- - - - -
3 changed files:
- testsuite/driver/runtests.py
- testsuite/driver/testlib.py
- testsuite/mk/test.mk
Changes:
=====================================
testsuite/driver/runtests.py
=====================================
@@ -71,6 +71,7 @@ parser.add_argument("--junit", type=argparse.FileType('wb'), help="output testsu
parser.add_argument("--broken-test", action="append", default=[], help="a test name to mark as broken for this run")
parser.add_argument("--test-env", default='local', help="Override default chosen test-env.")
parser.add_argument("--perf-baseline", type=GitRef, metavar='COMMIT', help="Baseline commit for performance comparsons.")
+parser.add_argument("--test-package-db", dest="test_package_db", action="append", help="Package db providing optional packages used by the testsuite.")
perf_group.add_argument("--skip-perf-tests", action="store_true", help="skip performance tests")
perf_group.add_argument("--only-perf-tests", action="store_true", help="Only do performance tests")
@@ -104,6 +105,8 @@ config.summary_file = args.summary_file
config.no_print_summary = args.no_print_summary
config.baseline_commit = args.perf_baseline
+config.test_package_db = args.test_package_db
+
if args.only:
config.only = args.only
config.run_only_some_tests = True
=====================================
testsuite/driver/testlib.py
=====================================
@@ -165,7 +165,16 @@ def have_library(lib: str) -> bool:
got_it = have_lib_cache[lib]
else:
cmd = strip_quotes(config.ghc_pkg)
- p = subprocess.Popen([cmd, '--no-user-package-db', 'describe', lib],
+ cmd_line = [cmd, '--no-user-package-db']
+
+ for db in config.test_package_db:
+ cmd_line.append("--package-db="+db)
+
+ cmd_line.extend(['describe', lib])
+
+ print(cmd_line)
+
+ p = subprocess.Popen(cmd_line,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
env=ghc_env)
@@ -181,6 +190,10 @@ def have_library(lib: str) -> bool:
def _reqlib( name, opts, lib ):
if not have_library(lib):
opts.expect = 'missing-lib'
+ else:
+ opts.extra_hc_opts = opts.extra_hc_opts + ' -package ' + lib + ' '
+ for db in config.test_package_db:
+ opts.extra_hc_opts = opts.extra_hc_opts + ' -package-db=' + db + ' '
def req_haddock( name, opts ):
if not config.haddock:
=====================================
testsuite/mk/test.mk
=====================================
@@ -216,6 +216,10 @@ ifneq "$(THREADS)" ""
RUNTEST_OPTS += --threads=$(THREADS)
endif
+ifneq "$(PACKAGE_DB)" ""
+RUNTEST_OPTS += --test-package-db=$(PACKAGE_DB)
+endif
+
ifneq "$(VERBOSE)" ""
RUNTEST_OPTS += --verbose=$(VERBOSE)
endif
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0e68813ce47f170c6007597773514f46a3ad50df
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0e68813ce47f170c6007597773514f46a3ad50df
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/2584b0c6/attachment-0001.html>
More information about the ghc-commits
mailing list