diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2021-06-18 09:39:10 +0100 |
---|---|---|
committer | Matthew Pickering <matthewtpickering@gmail.com> | 2021-06-18 09:42:17 +0100 |
commit | 2a4a6c14438d71b04a355ab0053249ebfd882fb9 (patch) | |
tree | f197f4c5f64b8243e114e48c9efd106979686642 | |
parent | a0622459f1d9a7068e81b8a707ffc63e153444f8 (diff) | |
download | haskell-2a4a6c14438d71b04a355ab0053249ebfd882fb9.tar.gz |
testsuite: Don't try to run tests with missing librarieswip/t20005
As noticed by sgraf, we were still running reqlib tests, even if the
library was not available. The reasons for this were not clear to me as
they would never work and it was causing some issues with empty stderr
files being generated if you used --test-accept.
Now if the required library is not there, the test is just skipped, and
a counter increased to mark the fact.
Perhaps in the future it would be nicer to explicitly record why certain
tests are skipped. Missing libraries causing a skip is a special case
at the moment.
Fixes #20005
-rw-r--r-- | testsuite/driver/testglobals.py | 2 | ||||
-rw-r--r-- | testsuite/driver/testlib.py | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py index dd063f0c73..f52aec281c 100644 --- a/testsuite/driver/testglobals.py +++ b/testsuite/driver/testglobals.py @@ -255,10 +255,10 @@ class TestRun: self.total_test_cases = 0 self.n_tests_skipped = 0 + self.n_missing_libs = 0 self.n_expected_passes = 0 self.n_expected_failures = 0 - self.missing_libs = [] # type: List[TestResult] self.framework_failures = [] # type: List[TestResult] self.framework_warnings = [] # type: List[TestResult] diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index 9fa61bc280..8d71d1de46 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -190,6 +190,7 @@ def have_library(lib: str) -> bool: def _reqlib( name, opts, lib ): if not have_library(lib): opts.expect = 'missing-lib' + opts.skip = True else: opts.extra_hc_opts = opts.extra_hc_opts + ' -package ' + lib + ' ' for db in config.test_package_db: @@ -198,6 +199,7 @@ def _reqlib( name, opts, lib ): def req_haddock( name, opts ): if not config.haddock: opts.expect = 'missing-lib' + opts.skip = True def req_profiling( name, opts ): '''Require the profiling libraries (add 'GhcLibWays += p' to mk/build.mk)''' @@ -1077,6 +1079,7 @@ def test_common_work(watcher: testutil.Watcher, framework_fail(name, way, traceback.format_exc()) t.n_tests_skipped += len(set(all_ways) - set(do_ways)) + if getTestOpts().expect == 'missing-lib': t.n_missing_libs += 1 if config.cleanup and do_ways: try: @@ -1212,10 +1215,7 @@ def do_test(name: TestName, stderr=result.stderr) t.unexpected_failures.append(tr) else: - if opts.expect == 'missing-lib': - t.missing_libs.append(TestResult(directory, name, 'missing-lib', way)) - else: - t.n_expected_failures += 1 + t.n_expected_failures += 1 # Make is often invoked with -s, which means if it fails, we get # no feedback at all. This is annoying. So let's remove the option @@ -2642,9 +2642,9 @@ def summary(t: TestRun, file: TextIO, short=False, color=False) -> None: + ' test cases, of which\n' + repr(t.n_tests_skipped).rjust(8) + ' were skipped\n' - + '\n' - + repr(len(t.missing_libs)).rjust(8) + + repr(t.n_missing_libs).rjust(8) + ' had missing libraries\n' + + '\n' + repr(t.n_expected_passes).rjust(8) + ' expected passes\n' + repr(t.n_expected_failures).rjust(8) |