[Git][ghc/ghc][wip/req_smp] test the compiler in a try block
doyougnu (@doyougnu)
gitlab at gitlab.haskell.org
Tue Dec 27 00:27:44 UTC 2022
doyougnu pushed to branch wip/req_smp at Glasgow Haskell Compiler / GHC
Commits:
f18375b2 by doyougnu at 2022-12-26T19:27:23-05:00
test the compiler in a try block
- - - - -
1 changed file:
- testsuite/config/ghc
Changes:
=====================================
testsuite/config/ghc
=====================================
@@ -219,20 +219,30 @@ def get_compiler_info():
"""
import tempfile
import textwrap
+
+ res = False
+
with tempfile.TemporaryDirectory() as d:
src = Path(d) / 'test.hs'
src.write_text(textwrap.dedent('''
module Main where
main = putStrLn "Hello World!"
'''))
- p = subprocess.run(
+ try:
+ p = subprocess.run(
'{} -v0 {} -o test '.format(config.compiler, src) + ' '.join(flags),
shell=True,
cwd=d,
stderr=None if config.verbose >= 3 else subprocess.DEVNULL
- )
- return p # return the subprocess result. Consumers may have different
- # needs
+ )
+
+ except Exception as err:
+ print("Exception thrown in testsuite/config/ghc.get_compiler_info: %s", err)
+
+ else:
+ res = p.returncode == 0
+
+ return res
def compiler_supports_way(flags):
return test_compile(flags).returncode == 0
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f18375b25146f19fdf07e85213e64417485799a4
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f18375b25146f19fdf07e85213e64417485799a4
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/20221226/6395e8bf/attachment-0001.html>
More information about the ghc-commits
mailing list