summaryrefslogtreecommitdiff
path: root/testsuite/driver
diff options
context:
space:
mode:
authorZubin Duggal <zubin.duggal@gmail.com>2021-08-03 13:50:18 +0530
committerZubin Duggal <zubin.duggal@gmail.com>2021-10-13 13:51:00 +0530
commit4536e8ca27e2173af9bc72e2e5992be140ecb2d2 (patch)
tree5cb1b99d618fca8dbc91277102a48036af9595b2 /testsuite/driver
parent58bd0cc1e6dc95328879fc53e9c58b7079d4c292 (diff)
downloadhaskell-4536e8ca27e2173af9bc72e2e5992be140ecb2d2.tar.gz
hadrian, testsuite: Teach Hadrian to query the testsuite driver for dependencies
Issues #19072, #17728, #20176
Diffstat (limited to 'testsuite/driver')
-rw-r--r--testsuite/driver/runtests.py10
-rw-r--r--testsuite/driver/testglobals.py10
-rw-r--r--testsuite/driver/testlib.py16
3 files changed, 36 insertions, 0 deletions
diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py
index 2c76661184..b315e80d09 100644
--- a/testsuite/driver/runtests.py
+++ b/testsuite/driver/runtests.py
@@ -79,6 +79,8 @@ perf_group.add_argument("--skip-perf-tests", action="store_true", help="skip per
perf_group.add_argument("--only-perf-tests", action="store_true", help="Only do performance tests")
parser.add_argument("--ignore-perf-failures", choices=['increases','decreases','all'],
help="Do not fail due to out-of-tolerance perf tests")
+parser.add_argument("--only-report-hadrian-deps", action="store_true",
+ help="Dry run the testsuite and report all extra hadrian depenedencies needed on stderr")
args = parser.parse_args()
@@ -148,6 +150,9 @@ if args.threads:
if args.verbose is not None:
config.verbose = args.verbose
+config.only_report_hadrian_deps = args.only_report_hadrian_deps
+
+
# Note force skip perf tests: skip if this is not a git repo (estimated with inside_git_repo)
# and no metrics file is given. In this case there is no way to read the previous commit's
# perf test results, nor a way to store new perf test results.
@@ -563,6 +568,11 @@ else:
if args.junit:
junit(t).write(args.junit)
+ if config.only_report_hadrian_deps:
+ print("WARNING - skipping all tests and only reporting required hadrian dependencies:", config.hadrian_deps)
+ for d in config.hadrian_deps:
+ print(d,file=sys.stderr)
+
if len(t.unexpected_failures) > 0 or \
len(t.unexpected_stat_failures) > 0 or \
len(t.unexpected_passes) > 0 or \
diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py
index adb2109923..e3df29c980 100644
--- a/testsuite/driver/testglobals.py
+++ b/testsuite/driver/testglobals.py
@@ -210,6 +210,13 @@ class TestConfig:
# I have no idea what this does
self.package_conf_cache_file = None # type: Optional[Path]
+ # The extra hadrian dependencies we need for all configured tests
+ self.hadrian_deps = set() # type: Set[str]
+
+ # Are we only reporting hadrian dependencies?
+ self.only_report_hadrian_deps = False # type: bool
+
+
def validate(self) -> None:
""" Check the TestConfig for self-consistency """
def assert_implies(a: bool, b: bool):
@@ -438,6 +445,9 @@ class TestOptions:
# Should we copy the files of symlink the files for the test?
self.copy_files = False
+ # The extra hadrian dependencies we need for this particular test
+ self.hadrian_deps = set() # type: Set[str]
+
# The default set of options
global default_testopts
default_testopts = TestOptions()
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index 3202bab65c..20b4181004 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -196,7 +196,17 @@ def _reqlib( name, opts, lib ):
for db in config.test_package_db:
opts.extra_hc_opts = opts.extra_hc_opts + ' -package-db=' + db + ' '
+def _req_hadrian_deps(name,opts,deps):
+ opts.hadrian_deps.update(deps)
+
+def req_hadrian_deps(deps):
+ return lambda name, opts: _req_hadrian_deps(name,opts,deps)
+
+# We want the 'docs-haddock' dependency and not just the
+# haddock executable since the haddock tests need documentation
+# for the boot libraries
def req_haddock( name, opts ):
+ _req_hadrian_deps(name,opts,["docs-haddock"])
if not config.haddock:
opts.expect = 'missing-lib'
opts.skip = True
@@ -1079,6 +1089,12 @@ def test_common_work(watcher: testutil.Watcher,
else:
framework_fail(name, None, 'extra_file is empty string')
+ # If we are only reporting hadrian dependencies, then skip the test
+ # and add its dependencies to the global set
+ if do_ways and config.only_report_hadrian_deps:
+ do_ways = []
+ config.hadrian_deps |= getTestOpts().hadrian_deps
+
# Run the required tests...
for way in do_ways:
if stopping():