[Git][ghc/ghc][wip/is-cross] testsuite: Rename isCross() predicate to needsTargetWrapper()
Matthew Pickering (@mpickering)
gitlab at gitlab.haskell.org
Tue Mar 5 11:02:31 UTC 2024
Matthew Pickering pushed to branch wip/is-cross at Glasgow Haskell Compiler / GHC
Commits:
66e5e45a by Matthew Pickering at 2024-03-05T11:02:19+00:00
testsuite: Rename isCross() predicate to needsTargetWrapper()
isCross() was a misnamed because it assumed that all cross targets would
provide a target wrapper, but the two most common cross targets
(javascript, wasm) don't need a target wrapper.
Therefore we rename this predicate to `needsTargetWrapper()` so
situations in the testsuite where we can check whether running
executables requires a target wrapper or not.
- - - - -
2 changed files:
- testsuite/driver/testglobals.py
- testsuite/driver/testlib.py
Changes:
=====================================
testsuite/driver/testglobals.py
=====================================
@@ -182,8 +182,6 @@ class TestConfig:
self.threads = 1
# An optional executable used to wrap target code execution
- # When set tests which aren't marked with TestConfig.cross_okay
- # are skipped.
self.target_wrapper = None
# tests which should be considered to be broken during this testsuite
@@ -460,12 +458,6 @@ class TestOptions:
# Should we copy the files of symlink the files for the test?
self.copy_files = False
- # Should the test be run in a cross-compiled tree?
- # None: infer from test function
- # True: run when --target-wrapper is set
- # False: do not run in cross-compiled trees
- self.cross_okay = None # type: Optional[bool]
-
# The extra hadrian dependencies we need for this particular test
self.hadrian_deps = set(["test:ghc"]) # type: Set[str]
=====================================
testsuite/driver/testlib.py
=====================================
@@ -91,8 +91,8 @@ def setLocalTestOpts(opts: TestOptions) -> None:
global testopts_ctx_var
testopts_ctx_var.set(opts)
-def isCross() -> bool:
- """ Are we testing a cross-compiler? """
+def needsTargetWrapper() -> bool:
+ """ Do we need to use a target wrapper? """
return config.target_wrapper is not None
def isCompilerStatsTest() -> bool:
@@ -240,7 +240,7 @@ def req_dynamic_hs( name, opts ):
opts.expect = 'fail'
def req_interp( name, opts ):
- if not config.have_interp or isCross():
+ if not config.have_interp or needsTargetWrapper():
opts.expect = 'fail'
# skip on wasm32, otherwise they show up as unexpected passes
if arch('wasm32'):
@@ -346,11 +346,10 @@ def req_host_target_ghc( name, opts ):
"""
When testing a cross GHC, some test cases require a host GHC as well (e.g.
for compiling custom Setup.hs). This is not supported yet (#23236), so for
- the time being we skip them when testing cross GHCs. However, this is not
- the case for the JS backend. The JS backend is a cross-compiler that
- produces code that the host can run.
+ the time being we skip them when testing cross GHCs. However, for cross targets
+ which don't need a target wrapper (e.g. javascript), we can still run these testcases.
"""
- if isCross() and not js_arch():
+ if needsTargetWrapper():
opts.skip = True
has_ls_files = None
@@ -1290,21 +1289,18 @@ async def test_common_work(name: TestName, opts,
all_ways = [WayName('ghci'), WayName('ghci-opt')]
else:
all_ways = []
- if isCross():
- opts.cross_okay = False
+ if needsTargetWrapper():
+ opts.skip = True
elif func in [makefile_test, run_command]:
# makefile tests aren't necessarily runtime or compile-time
# specific. Assume we can run them in all ways. See #16042 for what
# happened previously.
all_ways = config.compile_ways + config.run_ways
- if isCross():
- opts.cross_okay = False
+ if needsTargetWrapper():
+ opts.skip = True
else:
all_ways = [WayName('normal')]
- if isCross() and opts.cross_okay is False:
- opts.skip = True
-
# A test itself can request extra ways by setting opts.extra_ways
all_ways = list(OrderedDict.fromkeys(all_ways + [way for way in opts.extra_ways if way not in all_ways]))
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/66e5e45a745695ebf5b3fa01bad26dc467d33857
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/66e5e45a745695ebf5b3fa01bad26dc467d33857
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/20240305/d124fd8d/attachment-0001.html>
More information about the ghc-commits
mailing list