diff options
author | Andreas Klebinger <klebinger.andreas@gmx.at> | 2020-11-02 13:23:58 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-11-04 16:47:59 -0500 |
commit | b790b7f91104197429cd80e2c192a6fcda9dd6b4 (patch) | |
tree | 777dc5a4bfce5ca7016b8845ba57e829c2c596d7 /testsuite | |
parent | bb100805337adc666867da300ee5b0b11c18fe00 (diff) | |
download | haskell-b790b7f91104197429cd80e2c192a6fcda9dd6b4.tar.gz |
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.
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/driver/runtests.py | 4 | ||||
-rw-r--r-- | testsuite/driver/testglobals.py | 3 | ||||
-rw-r--r-- | testsuite/driver/testlib.py | 15 | ||||
-rw-r--r-- | testsuite/mk/test.mk | 4 |
4 files changed, 25 insertions, 1 deletions
diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index 6151e5e9ca..b9d6fff859 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -73,6 +73,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") @@ -109,6 +110,9 @@ config.baseline_commit = args.perf_baseline if args.top: config.top = args.top +if args.test_package_db: + config.test_package_db = args.test_package_db + if args.only: config.only = args.only config.run_only_some_tests = True diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py index 1cfa451cca..71a81bf509 100644 --- a/testsuite/driver/testglobals.py +++ b/testsuite/driver/testglobals.py @@ -169,6 +169,9 @@ class TestConfig: # Baseline commit for performane metric comparisons. self.baseline_commit = None # type: Optional[GitRef] + # Additional package dbs to inspect for test dependencies. + self.test_package_db = [] # type: [PathToPackageDb] + # Should we skip performance tests self.skip_perf_tests = False diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index a54532c58e..348c198d56 100644 --- a/testsuite/driver/testlib.py +++ b/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: diff --git a/testsuite/mk/test.mk b/testsuite/mk/test.mk index 64c8550ce7..cc30266829 100644 --- a/testsuite/mk/test.mk +++ b/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 |