UnkindPartition / tasty

Modern and extensible testing framework for Haskell
638 stars 108 forks source link

Only install handlers when `HAVE_SIGNAL_H` #365

Closed amesgen closed 1 year ago

amesgen commented 1 year ago

This allows to run test suites on platforms that do not support signals, such as the new WASM backend in GHC 9.6.

Bodigrim commented 1 year ago

@amesgen would it be possible to add something like https://github.com/haskell/unix/blob/master/.github/workflows/ci-wasm32-wasi.yml ?

amesgen commented 1 year ago

@amesgen would it be possible to add something like https://github.com/haskell/unix/blob/master/.github/workflows/ci-wasm32-wasi.yml ?

Yeah, I will try to add something here :+1:

amesgen commented 1 year ago

I pushed a commit running all tests except the resource-release-test as it depends on signals (which WASM/WASI does not have ATM).

Depends on https://github.com/haskellari/splitmix/pull/73 as splitmix is a transitive test dependency.

@TerrorJack if you want to take a look: Given your blog post, is there a nicer way to treat WASM files as executables in PATH than in this PR?

TerrorJack commented 1 year ago

@amesgen The proot trick described in the blog post is really a huge hack that was only meant to be used before the ghc testsuite didn't support cross emulators, and I think it's better to not use that in this PR.

There is one little potential improvement: instead of your own wrapper script that calls wasmtime, you are recommended to use ~/.ghc-wasm/wasm-run/bin/wasmtime.sh foo.wasm --command_line_args instead. That wrapper script is what I use for the ghc testsuite; it automatically adds wasmtime flags to set up the filesystem, current directory and such.

amesgen commented 1 year ago

There is one little potential improvement: instead of your own wrapper script that calls wasmtime, you are recommended to use ~/.ghc-wasm/wasm-run/bin/wasmtime.sh foo.wasm --command_line_args instead.

This works great locally, but on GHA, exit-status-tests.sh fails:

+ timeout 3 exit-status-test --result=False --slow=3 --fast=0 --num-threads=4 --quiet
+ [ 124 -eq 1 ]

I guess that this is due to one of the additional flags in wasmtime.sh. So I will leave it as is for now.