diff --git a/Makefile b/Makefile index df723a504..93933bbbe 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ $(targets): wasm32-update: wasm32-wasi-cabal update -wasm32 = wasm32-build wasm32-build-opt wasm32-configure wasm32-check wasm32-test wasm32-test-opt wasm32-clean +wasm32 = discover-wasm32-tests wasm32-build wasm32-build-opt wasm32-configure wasm32-check wasm32-test wasm32-test-opt wasm32-clean $(wasm32): $(MAKE) -C primer $@ diff --git a/cabal.project b/cabal.project index 89c8f8f6a..d022eb16d 100644 --- a/cabal.project +++ b/cabal.project @@ -1,5 +1,7 @@ index-state: 2024-02-06T00:00:00Z +jobs: $ncpus + packages: primer primer-api @@ -13,11 +15,22 @@ if arch(wasm32) else optimization: 0 +benchmarks: True + +tests: True + +if !arch(wasm32) + documentation: True + haddock-hoogle: True + haddock-html: True + haddock-quickjump: True + haddock-hyperlink-source: True + haddock-internal: True + allow-newer: hedgehog-classes:hedgehog,hedgehog-classes:pretty-show,hedgehog:pretty-show package * ghc-options: -fwrite-ide-info - benchmarks: True package primer test-options: "--size-cutoff=32768" diff --git a/flake.nix b/flake.nix index 67e0748c3..4068a4498 100644 --- a/flake.nix +++ b/flake.nix @@ -326,6 +326,12 @@ # time, because we can't do it via `wasmtime`. (pkgs.haskell-nix.tool ghcVersion "tasty-discover" { }) ]; + + # The wasm32 compile target can't discover its own Tasty + # tests. + shellHook = '' + make discover-wasm32-tests + ''; }; }; diff --git a/primer-api/Makefile b/primer-api/Makefile index ee663a006..bb95112c6 100644 --- a/primer-api/Makefile +++ b/primer-api/Makefile @@ -28,13 +28,14 @@ wasm32-check: wasm32-test test: cabal test -wasm32-test: +discover-wasm32-tests: tasty-discover test/Test.hs _ test/TestsWasm32.hs --tree-display + +wasm32-test: wasm32-build discover-wasm32-tests wasm32-wasi-cabal build test:primer-api-test wasmtime --dir test::test "$(wasm32-primer-api-test)" -wasm32-test-opt: wasm32-build-opt - tasty-discover test/Test.hs _ test/TestsWasm32.hs --tree-display +wasm32-test-opt: wasm32-build-opt discover-wasm32-tests wasm32-wasi-cabal build -O2 test:primer-api-test wasmtime --dir test::test "$(wasm32-primer-api-test-opt)" @@ -53,4 +54,4 @@ realclean: deps: -.PHONY: build bench configure test docs clean realclean deps +.PHONY: build bench configure test docs clean realclean deps discover-wasm32-tests diff --git a/primer/Makefile b/primer/Makefile index 791620a5e..2ea525f66 100644 --- a/primer/Makefile +++ b/primer/Makefile @@ -28,13 +28,14 @@ wasm32-check: wasm32-test test: cabal test -wasm32-test: +discover-wasm32-tests: tasty-discover test/Test.hs _ test/TestsWasm32.hs --tree-display + +wasm32-test: wasm32-build discover-wasm32-tests wasm32-wasi-cabal build test:primer-test wasmtime --dir test::test "$(wasm32-primer-test)" -wasm32-test-opt: wasm32-build-opt - tasty-discover test/Test.hs _ test/TestsWasm32.hs --tree-display +wasm32-test-opt: wasm32-build-opt discover-wasm32-tests wasm32-wasi-cabal build -O2 test:primer-test wasmtime --dir test::test "$(wasm32-primer-test-opt)"