summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorCheng Shao <terrorjack@type.dance>2023-04-02 12:09:24 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-04-27 16:00:35 -0400
commitbd2bfdecc8040a9a70478cd8d646a34b5fa77c35 (patch)
tree87174be2a5bb1849099fa88f9bc2d3c13773b032 /testsuite
parentb174a1101289f2287d9194a229314badcb72ca1f (diff)
downloadhaskell-bd2bfdecc8040a9a70478cd8d646a34b5fa77c35.tar.gz
testsuite: wasm32-specific fixes
This patch includes all wasm32-specific testsuite fixes.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/config/ghc1
-rw-r--r--testsuite/driver/testlib.py7
-rw-r--r--testsuite/tests/codeGen/should_run/all.T6
-rw-r--r--testsuite/tests/concurrent/should_run/all.T11
-rw-r--r--testsuite/tests/ffi/should_run/all.T4
-rw-r--r--testsuite/tests/lib/base/all.T2
-rw-r--r--testsuite/tests/perf/compiler/all.T3
-rw-r--r--testsuite/tests/profiling/should_run/all.T4
-rw-r--r--testsuite/tests/rts/all.T19
-rw-r--r--testsuite/tests/rts/flags/all.T5
-rw-r--r--testsuite/tests/typecheck/testeq1/test.T2
11 files changed, 49 insertions, 15 deletions
diff --git a/testsuite/config/ghc b/testsuite/config/ghc
index 77c7e0a151..2a3ad2177d 100644
--- a/testsuite/config/ghc
+++ b/testsuite/config/ghc
@@ -81,6 +81,7 @@ if not config.arch == "javascript":
if config.arch == "wasm32":
config.have_process = False
+ config.supports_dynamic_libs = False
config.way_flags = {
'normal' : [],
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index 613e785e6e..9cb3a924ab 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -256,6 +256,9 @@ def req_dynamic_hs( name, opts ):
def req_interp( name, opts ):
if not config.have_interp or isCross():
opts.expect = 'fail'
+ # skip on wasm32, otherwise they show up as unexpected passes
+ if arch('wasm32'):
+ skip(name, opts)
# JS backend doesn't provide an interpreter yet
js_skip(name, opts)
@@ -491,6 +494,10 @@ def _exit_code( name, opts, v ):
def signal_exit_code( val: int ):
if opsys('solaris2'):
return exit_code( val )
+ elif arch('wasm32'):
+ # wasmtime always exits with 1 when wasm program exits with a
+ # non-zero exit code
+ return exit_code(1)
else:
# When application running on Linux receives fatal error
# signal, then its exit code is encoded as 128 + signal
diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T
index 0e11ac8628..2fed5e0a5c 100644
--- a/testsuite/tests/codeGen/should_run/all.T
+++ b/testsuite/tests/codeGen/should_run/all.T
@@ -29,7 +29,7 @@ test('cgrun021', extra_ways(['nursery_chunks']), compile_and_run, [''])
test('cgrun022', normal, compile_and_run, [''])
test('cgrun024', normal, compile_and_run, [''])
test('cgrun025',
- [ extra_run_opts('cgrun025.hs < /dev/null'), exit_code(1)],
+ [ extra_run_opts('cgrun025.hs < /dev/null'), exit_code(1), when(arch('wasm32'), fragile(23275))],
compile_and_run, [''])
test('cgrun026', normal, compile_and_run, [''])
test('cgrun027', normal, compile_and_run, [''])
@@ -74,7 +74,7 @@ test('cgrun065', normal, compile_and_run, [''])
test('cgrun066', normal, compile_and_run, [''])
test('cgrun067', [extra_files(['Cgrun067A.hs'])], compile_and_run, [''])
test('cgrun069',
- [ omit_ways(['ghci']), req_cmm],
+ [ omit_ways(['ghci']), req_cmm, when(arch('wasm32'), fragile(22854))],
multi_compile_and_run,
['cgrun069', [('cgrun069_cmm.cmm', '')], ''])
test('cgrun070', normal, compile_and_run, [''])
@@ -212,7 +212,7 @@ test('T16617', normal, compile_and_run, [''])
test('T16449_2', exit_code(0), compile_and_run, [''])
test('T16846', [only_ways(['optasm']), exit_code(1)], compile_and_run, [''])
-test('T17920', cmm_src, compile_and_run, [''])
+test('T17920', [cmm_src, when(arch('wasm32'), fragile(22854))], compile_and_run, [''])
test('T18527', req_c, compile_and_run, ['T18527FFI.c'])
test('T19149', [req_c,only_ways('sanity')], compile_and_run, ['T19149_c.c'])
test('T20275', normal, compile_and_run, [''])
diff --git a/testsuite/tests/concurrent/should_run/all.T b/testsuite/tests/concurrent/should_run/all.T
index 3e238e7cff..ce3cad38a7 100644
--- a/testsuite/tests/concurrent/should_run/all.T
+++ b/testsuite/tests/concurrent/should_run/all.T
@@ -25,7 +25,11 @@ test('conc072', only_ways(concurrent_ways), compile_and_run, [''])
test('conc073', normal, compile_and_run, [''])
test('T367_letnoescape',
- [run_timeout_multiplier(0.02), expect_broken_for(7297,['optllvm'])],
+ [run_timeout_multiplier(0.02), expect_broken_for(7297,['optllvm']),
+ # wasm32 rts has no timer and scheduler always behaves as -C0,
+ # see Note [No timer on wasm32] in rts. It'll be stuck in the
+ # thread that infinitely loops, which is the expected behavior.
+ when(arch('wasm32'), skip)],
compile_and_run, ['-fno-omit-yields'])
test('T1980', normal, compile_and_run, [''])
@@ -86,7 +90,10 @@ test('T7970', normal, compile_and_run, [''])
test('AtomicPrimops', normal, compile_and_run, [''])
# test uses 2 threads and yield, scheduling can vary with threaded2
-test('threadstatus-9333', [fragile_for(16555, ['ghci', 'profthreaded']), omit_ways(concurrent_ways)], compile_and_run, [''])
+test('threadstatus-9333', [fragile_for(16555, ['ghci', 'profthreaded']), omit_ways(concurrent_ways),
+# wasm32 rts has no timer and scheduler always behaves as -C0. See
+# Note [No timer on wasm32] in rts
+when(arch('wasm32'), skip)], compile_and_run, [''])
test('T9379', normal, compile_and_run, [''])
diff --git a/testsuite/tests/ffi/should_run/all.T b/testsuite/tests/ffi/should_run/all.T
index 85bef4d775..3bed1cd279 100644
--- a/testsuite/tests/ffi/should_run/all.T
+++ b/testsuite/tests/ffi/should_run/all.T
@@ -144,9 +144,9 @@ if config.os == 'mingw32':
flagsForT4038 = ['-optl-Wl,--stack,10485760']
else:
flagsForT4038 = ['']
-test('T4038', js_broken(22261), compile_and_run, flagsForT4038)
+test('T4038', [js_broken(22261), when(arch('wasm32'), fragile(22606))], compile_and_run, flagsForT4038)
-test('T4221', [omit_ways(['ghci']),req_c], compile_and_run, ['T4221_c.c'])
+test('T4221', [omit_ways(['ghci']),req_c, when(arch('wasm32'), fragile(22606))], compile_and_run, ['T4221_c.c'])
test('T5402', [ omit_ways(['ghci']),
exit_code(42),
diff --git a/testsuite/tests/lib/base/all.T b/testsuite/tests/lib/base/all.T
index e04bb27eae..a23fb4cdcc 100644
--- a/testsuite/tests/lib/base/all.T
+++ b/testsuite/tests/lib/base/all.T
@@ -4,7 +4,7 @@ test('T16586', normal, compile_and_run, ['-O2'])
test('T16916', [when(opsys('mingw32'), skip), js_broken(22261), fragile(16966), req_ghc_with_threaded_rts], compile_and_run, ['-O2 -threaded -with-rtsopts="-I0" -rtsopts'])
test('T17310', normal, compile, [''])
test('T19691', normal, compile, [''])
-test('executablePath', [extra_run_opts(config.os), js_broken(22261)], compile_and_run, [''])
+test('executablePath', [extra_run_opts(config.os), js_broken(22261), when(arch('wasm32'), fragile(23248))], compile_and_run, [''])
test('T17472', normal, compile_and_run, [''])
test('T19569b', normal, compile_and_run, [''])
test('Monoid_ByteArray', normal, compile_and_run, [''])
diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T
index 37a6fdb2f9..14cd4cce94 100644
--- a/testsuite/tests/perf/compiler/all.T
+++ b/testsuite/tests/perf/compiler/all.T
@@ -42,6 +42,7 @@ test('T4801',
[collect_compiler_stats('bytes allocated',2),
only_ways(['normal']),
extra_hc_opts('-static'),
+ when(arch('wasm32') and unregisterised(), fragile(23290))
],
compile,
[''])
@@ -657,7 +658,7 @@ test('T21839c',
['-O'])
test ('InfiniteListFusion',
- [collect_stats('bytes allocated',2), when(arch('i386'), skip), js_broken(22576)],
+ [collect_stats('bytes allocated',2), when(wordsize(32), skip), js_broken(22576)],
compile_and_run,
['-O2 -package ghc'])
diff --git a/testsuite/tests/profiling/should_run/all.T b/testsuite/tests/profiling/should_run/all.T
index 34d0f5d879..c9e147ca1f 100644
--- a/testsuite/tests/profiling/should_run/all.T
+++ b/testsuite/tests/profiling/should_run/all.T
@@ -60,7 +60,9 @@ test('heapprof001',
compile_and_run, [''])
test('T2592',
- [only_ways(['profasm']), extra_run_opts('+RTS -M1m -A1m -RTS'), exit_code(251)],
+ [only_ways(['profasm']), extra_run_opts('+RTS -M1m -A1m -RTS'),
+ exit_code(1 if arch('wasm32') else 251),
+ when(arch('wasm32'), ignore_stderr)],
compile_and_run, [''])
test('T3001', [only_ways(['prof_hb']), extra_ways(['prof_hb'])],
diff --git a/testsuite/tests/rts/all.T b/testsuite/tests/rts/all.T
index 57920ec4da..371a315786 100644
--- a/testsuite/tests/rts/all.T
+++ b/testsuite/tests/rts/all.T
@@ -3,7 +3,8 @@ test('testblockalloc',
compile_and_run, [''])
test('testmblockalloc',
- [c_src, only_ways(['normal','threaded1']), extra_run_opts('+RTS -I0')],
+ [c_src, only_ways(['normal','threaded1']), extra_run_opts('+RTS -I0'),
+ when(arch('wasm32'), skip)], # MBlocks can't be freed on wasm32, see Note [Megablock allocator on wasm] in rts
compile_and_run, [''])
# -I0 is important: the idle GC will run the memory leak detector,
# which will crash because the mblocks we allocate are not in a state
@@ -349,8 +350,12 @@ test('ListStaticPointers', [when(doing_ghci(), extra_hc_opts('-fobject-code'))],
# 251 = RTS exit code for "out of memory"
test('overflow1', [ js_skip, exit_code(251), when(wordsize(32), expect_broken(15255)) ],
compile_and_run, [''])
-test('overflow2', [ js_skip, exit_code(251) ], compile_and_run, [''])
-test('overflow3', [ js_skip, exit_code(251) ], compile_and_run, [''])
+test('overflow2', [ js_skip,
+ exit_code(1 if arch('wasm32') else 251),
+ when(arch('wasm32'), ignore_stderr) ], compile_and_run, [''])
+test('overflow3', [ js_skip,
+ exit_code(1 if arch('wasm32') else 251),
+ when(arch('wasm32'), ignore_stderr) ], compile_and_run, [''])
def grep_stderr(pattern):
def wrapper(cmd, pattern=pattern):
@@ -497,7 +502,7 @@ test('keep-cafs',
# Test proper functioning of C++ exceptions within a C++ program.
# On darwin, this requires -fcompact-unwind.
-test('T11829', [ req_c, check_errmsg("This is a test") ], compile_and_run,
+test('T11829', [ req_c, check_errmsg("This is a test"), when(arch('wasm32'), fragile(23244)) ], compile_and_run,
['T11829_c.cpp -package system-cxx-std-lib'])
test('T16514', req_c, compile_and_run, ['T16514_c.c'])
@@ -527,12 +532,18 @@ test('T15427', js_broken(22374), compile_and_run, [''])
test('T19481',
[extra_run_opts('+RTS -T -RTS'),
js_broken(22374),
+ # MBlocks can't be freed on wasm32, see Note [Megablock
+ # allocator on wasm] in rts
+ when(arch('wasm32'), skip),
# memory behavior changes appreciably with the nonmoving collector
omit_ways(['nonmoving', 'nonmoving_thr', 'nonmoving_thr_sanity'])],
compile_and_run, [''])
test('T19381',
[extra_run_opts('+RTS -T -RTS'),
js_broken(22374),
+ # MBlocks can't be freed on wasm32, see Note [Megablock
+ # allocator on wasm] in rts
+ when(arch('wasm32'), skip),
# memory behavior changes appreciably with the nonmoving collector
omit_ways(['nonmoving', 'nonmoving_thr', 'nonmoving_thr_sanity'])],
compile_and_run, [''])
diff --git a/testsuite/tests/rts/flags/all.T b/testsuite/tests/rts/flags/all.T
index 65de43681a..b7505cd2d3 100644
--- a/testsuite/tests/rts/flags/all.T
+++ b/testsuite/tests/rts/flags/all.T
@@ -44,7 +44,10 @@ test('T12870f',
# Check handling of env variables
test('T12870g',
[extra_files(['T12870g.hs']), cmd_prefix('GHCRTS=-G7 '), extra_files(['T12870g.hs']),
- only_ways(['normal'])],
+ only_ways(['normal']),
+ # cross emulator for wasm32 always clears host environment
+ # variables
+ when(arch('wasm32'), skip)],
multimod_compile_and_run,
['T12870g', '-rtsopts -with-rtsopts="-G3"'])
diff --git a/testsuite/tests/typecheck/testeq1/test.T b/testsuite/tests/typecheck/testeq1/test.T
index 9000e8f640..58dfc33e16 100644
--- a/testsuite/tests/typecheck/testeq1/test.T
+++ b/testsuite/tests/typecheck/testeq1/test.T
@@ -2,5 +2,7 @@
test('typecheck.testeq1', [ extra_files(['FakePrelude.hs', 'Main.hs', 'TypeCast.hs', 'TypeEq.hs'])
, when(fast(), skip)
, js_broken(22355)
+ # https://gitlab.haskell.org/ghc/ghc/-/issues/23238
+ , when(arch('wasm32'), skip)
], multimod_compile_and_run,
['Main', '-v0'])