summaryrefslogtreecommitdiff
path: root/testsuite/driver/testlib.py
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/driver/testlib.py')
-rw-r--r--testsuite/driver/testlib.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index a0f97098ab..39ba7d8b31 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -137,6 +137,18 @@ def no_deps( name, opts):
def skip( name, opts ):
opts.skip = True
+# disable test on JS arch
+def js_skip( name, opts ):
+ if arch("js"):
+ skip(name,opts)
+
+# expect broken for the JS backend
+def js_broken( bug: IssueNumber ):
+ if arch("js"):
+ return expect_broken(bug);
+ else:
+ return normal;
+
def expect_fail( name, opts ):
# The compiler, testdriver, OS or platform is missing a certain
# feature, and we don't plan to or can't fix it now or in the
@@ -250,15 +262,28 @@ def req_dynamic_hs( name, opts ):
def req_interp( name, opts ):
if not config.have_interp:
opts.expect = 'fail'
+ # JS backend doesn't provide an interpreter yet
+ js_skip(name, opts)
def req_rts_linker( name, opts ):
if not config.have_RTS_linker:
opts.expect = 'fail'
+ # JS backend doesn't provide the RTS linker
+ js_skip(name, opts)
def req_c( name, opts ):
"""
Mark a test as requiring C source file support
"""
+ # JS backend doesn't support C (yet)
+ js_skip(name, opts)
+
+def req_ffi_exports( name, opts):
+ """
+ Mark a test as requiring FFI exports
+ """
+ # JS backend doesn't support FFI exports (yet)
+ js_skip(name, opts)
def req_th( name, opts ):
"""
@@ -739,6 +764,8 @@ def objcpp_src( name, opts ):
def cmm_src( name, opts ):
opts.cmm_src = True
+ # JS backend doesn't support Cmm
+ js_skip(name, opts)
def outputdir( odir ):
return lambda name, opts, d=odir: _outputdir(name, opts, d)
@@ -2313,6 +2340,8 @@ def normalise_errmsg(s: str) -> str:
# hacky solution is used in place of more sophisticated filename
# mangling
s = re.sub('([^\\s])\\.exe', '\\1', s)
+ # Same thing for .jsexe directories generated by the JS backend
+ s = re.sub('([^\\s])\\.jsexe', '\\1', s)
# normalise slashes, minimise Windows/Unix filename differences
s = re.sub('\\\\', '/', s)
@@ -2320,6 +2349,10 @@ def normalise_errmsg(s: str) -> str:
# The inplace ghc's are called ghc-stage[123] to avoid filename
# collisions, so we need to normalise that to just "ghc"
s = re.sub('ghc-stage[123]', 'ghc', s)
+ # Remove platform prefix (e.g. js-unknown-ghcjs) for cross-compiled tools
+ # (ghc, ghc-pkg, unlit, etc.)
+ s = re.sub('\\w+-\\w+-\\w+-ghc', 'ghc', s)
+ s = re.sub('\\w+-\\w+-\\w+-unlit', 'unlit', s)
# On windows error messages can mention versioned executables
s = re.sub('ghc-[0-9.]+', 'ghc', s)
@@ -2428,6 +2461,7 @@ def normalise_slashes_( s: str ) -> str:
def normalise_exe_( s: str ) -> str:
s = re.sub('\.exe', '', s)
+ s = re.sub('\.jsexe', '', s)
return s
def normalise_output( s: str ) -> str:
@@ -2436,8 +2470,10 @@ def normalise_output( s: str ) -> str:
s = modify_lines(s, lambda l: re.sub(' error:', '', l))
s = modify_lines(s, lambda l: re.sub(' Warning:', ' warning:', l))
# Remove a .exe extension (for Windows)
+ # and .jsexe extension (for the JS backend)
# This can occur in error messages generated by the program.
s = re.sub('([^\\s])\\.exe', '\\1', s)
+ s = re.sub('([^\\s])\\.jsexe', '\\1', s)
s = normalise_callstacks(s)
s = normalise_type_reps(s)
# ghci outputs are pretty unstable with -fexternal-dynamic-refs, which is