[Git][ghc/ghc][wip/testsuite-error] testsuite: Handle exceptions in framework_fail when testdir is not initialised
Zubin (@wz1000)
gitlab at gitlab.haskell.org
Tue Apr 23 11:57:19 UTC 2024
Zubin pushed to branch wip/testsuite-error at Glasgow Haskell Compiler / GHC
Commits:
35560664 by Zubin Duggal at 2024-04-23T17:27:12+05:30
testsuite: Handle exceptions in framework_fail when testdir is not initialised
When `framework_fail` is called before initialising testdir, it would fail with
an exception reporting the testdir not being initialised instead of the actual failure.
Ensure we report the actual reason for the failure instead of failing in this way.
One way this can manifest is when trying to run a test that doesn't exist using `--only`
- - - - -
1 changed file:
- testsuite/driver/testlib.py
Changes:
=====================================
testsuite/driver/testlib.py
=====================================
@@ -1542,7 +1542,13 @@ def override_options(pre_cmd):
def framework_fail(name: Optional[TestName], way: Optional[WayName], reason: str) -> None:
opts = getTestOpts()
- directory = re.sub(r'^\.[/\\]', '', str(opts.testdir))
+ # framework_fail can be called before testdir is initialised,
+ # so we need to take care not to blow up with the wrong way
+ # and report the actual reason for the failure.
+ try:
+ directory = re.sub(r'^\.[/\\]', '', str(opts.testdir))
+ except:
+ directory = ''
full_name = '%s(%s)' % (name, way)
if_verbose(1, '*** framework failure for %s %s ' % (full_name, reason))
name2 = name if name is not None else TestName('none')
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/355606641f44557342d6d66af9089dad2af72a5d
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/355606641f44557342d6d66af9089dad2af72a5d
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/20240423/fb75a165/attachment-0001.html>
More information about the ghc-commits
mailing list