From 9e5006fcaa7a609af3facfb1fe3b7c848ad0cb91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Vouillon?= Date: Thu, 31 Oct 2024 17:46:08 +0100 Subject: [PATCH 1/4] Revised dune support --- compiler/tests-env/dune | 6 +---- compiler/tests-io/dune | 17 ++++++++++++++ compiler/tests-jsoo/bin/dune | 18 ++++++++++++++- compiler/tests-jsoo/dune | 8 +++---- compiler/tests-jsoo/lib-effects/dune | 2 +- compiler/tests-linkall/dune | 4 +++- compiler/tests-ocaml/basic-modules/dune | 2 +- compiler/tests-ocaml/lib-atomic/dune | 2 +- compiler/tests-ocaml/lib-bigarray/dune | 2 +- compiler/tests-ocaml/lib-bool/dune | 2 +- compiler/tests-ocaml/lib-buffer/dune | 2 +- compiler/tests-ocaml/lib-bytes-utf/dune | 1 + compiler/tests-ocaml/lib-bytes/dune | 2 +- compiler/tests-ocaml/lib-digest/dune | 8 +++---- compiler/tests-ocaml/lib-effects/dune | 4 ++-- compiler/tests-ocaml/lib-filename/dune | 2 +- compiler/tests-ocaml/lib-float/dune | 2 +- compiler/tests-ocaml/lib-floatarray/dune | 2 +- compiler/tests-ocaml/lib-format/dune | 2 +- compiler/tests-ocaml/lib-fun/dune | 2 +- compiler/tests-ocaml/lib-gc/dune | 2 +- compiler/tests-ocaml/lib-hashtbl/dune | 4 ++-- compiler/tests-ocaml/lib-int/dune | 2 +- compiler/tests-ocaml/lib-int64/dune | 2 +- compiler/tests-ocaml/lib-list/dune | 2 +- compiler/tests-ocaml/lib-option/dune | 2 +- compiler/tests-ocaml/lib-printf/dune | 1 + compiler/tests-ocaml/lib-queue/dune | 2 +- compiler/tests-ocaml/lib-random/dune | 1 + compiler/tests-ocaml/lib-result/dune | 2 +- compiler/tests-ocaml/lib-seq/dune | 2 +- compiler/tests-ocaml/lib-set/dune | 2 +- compiler/tests-ocaml/lib-stack/dune | 2 +- compiler/tests-ocaml/lib-str/dune | 2 +- compiler/tests-ocaml/lib-string/dune | 2 +- compiler/tests-ocaml/lib-uchar/dune | 2 +- compiler/tests-ocaml/prim-bigstring/dune | 2 +- compiler/tests-ocaml/prim-bswap/dune | 2 +- compiler/tests-ocaml/prim-revapply/dune | 2 +- compiler/tests-re/dune | 2 +- compiler/tests-runtime-events/dune | 2 +- compiler/tests-sourcemap/dune | 8 ------- compiler/tests-wasm_of_ocaml/dune | 4 +++- dune | 14 ++++++++---- examples/graphics/dune | 2 +- examples/test_wheel/dune | 2 +- lib/deriving_json/tests/dune | 2 +- lib/tests/dune.inc | 28 ++++++++++++------------ lib/tests/gen-rules/gen.ml | 2 +- tools/ci_setup.ml | 13 +++++++++-- 50 files changed, 124 insertions(+), 83 deletions(-) diff --git a/compiler/tests-env/dune b/compiler/tests-env/dune index 5975060fa..0ec8080c7 100644 --- a/compiler/tests-env/dune +++ b/compiler/tests-env/dune @@ -1,9 +1,5 @@ (test - (modes js) - (build_if - (and - (<> %{profile} wasm) - (<> %{profile} wasm-effects))) + (modes js) ; No env support in wasm_of_ocaml yet (js_of_ocaml (javascript_files setup.js) (flags :standard --setenv JSOO_C=from-jsoo-args)) diff --git a/compiler/tests-io/dune b/compiler/tests-io/dune index a2dcef1a3..fb661ce37 100644 --- a/compiler/tests-io/dune +++ b/compiler/tests-io/dune @@ -2,6 +2,7 @@ (names cat md5) (modes js + wasm (best exe))) (rule @@ -27,6 +28,14 @@ (action (diff cat-js.stdout cat-native.stdout))) +(rule + (action + (copy cat.bc.wasm.js cat.bc.js)) + (enabled_if + (or + (= %{profile} wasm) + (= %{profile} wasm-effects)))) + (rule (target md5-native.stdout) (action @@ -69,3 +78,11 @@ (alias runtest) (action (diff md5-js.stdout md5-native.stdout))) + +(rule + (action + (copy md5.bc.wasm.js md5.bc.js)) + (enabled_if + (or + (= %{profile} wasm) + (= %{profile} wasm-effects)))) diff --git a/compiler/tests-jsoo/bin/dune b/compiler/tests-jsoo/bin/dune index 3cadcdb3e..04ffca1b8 100644 --- a/compiler/tests-jsoo/bin/dune +++ b/compiler/tests-jsoo/bin/dune @@ -1,6 +1,6 @@ (executables (names error1 error2) - (modes exe js) + (modes exe js wasm) (foreign_stubs (language c) (names named_value_stubs)) @@ -55,6 +55,14 @@ (action (diff %{dep:error1-unregister.expected} %{dep:error1-unregister.js.actual}))) +(rule + (action + (copy error1.bc.wasm.js error1.bc.js)) + (enabled_if + (or + (= %{profile} wasm) + (= %{profile} wasm-effects)))) + (rule (target error2.js.actual) (deps error2.html) @@ -105,3 +113,11 @@ (alias runtest) (action (diff %{dep:error2-unregister.expected} %{dep:error2-unregister.js.actual}))) + +(rule + (action + (copy error2.bc.wasm.js error2.bc.js)) + (enabled_if + (or + (= %{profile} wasm) + (= %{profile} wasm-effects)))) diff --git a/compiler/tests-jsoo/dune b/compiler/tests-jsoo/dune index 38594fa36..ab6d5dfd4 100644 --- a/compiler/tests-jsoo/dune +++ b/compiler/tests-jsoo/dune @@ -5,7 +5,7 @@ (enabled_if (>= %{ocaml_version} 4.14)) (inline_tests - (modes js best)) + (modes js wasm best)) (preprocess (pps ppx_expect))) @@ -16,7 +16,7 @@ (enabled_if (>= %{ocaml_version} 5.1.1)) (inline_tests - (modes js best)) + (modes js wasm best)) (preprocess (pps ppx_expect))) @@ -27,7 +27,7 @@ (enabled_if (>= %{ocaml_version} 5.1.1)) (inline_tests - (modes js best)) + (modes js wasm best)) (preprocess (pps ppx_expect))) @@ -41,7 +41,7 @@ (language c) (names bigarray_stubs)) (inline_tests - (modes js best)) + (modes js wasm best)) (preprocess (pps ppx_expect))) diff --git a/compiler/tests-jsoo/lib-effects/dune b/compiler/tests-jsoo/lib-effects/dune index 0ac00bf21..db1dba7b4 100644 --- a/compiler/tests-jsoo/lib-effects/dune +++ b/compiler/tests-jsoo/lib-effects/dune @@ -9,6 +9,6 @@ (inline_tests ;; This requires the unreleased dune 3.7 to work (enabled_if true) - (modes js best)) + (modes js wasm best)) (preprocess (pps ppx_expect))) diff --git a/compiler/tests-linkall/dune b/compiler/tests-linkall/dune index 4b1df9f69..5d1fd7d45 100644 --- a/compiler/tests-linkall/dune +++ b/compiler/tests-linkall/dune @@ -3,11 +3,13 @@ (env (_ (js_of_ocaml + (compilation_mode separate)) + (wasm_of_ocaml (compilation_mode separate)))) (test (name test) - (modes byte js) + (modes byte js wasm) (libraries dynlink) ;; It doesn't seem possible to create a pack-ed module with dune. ;; However, dynlink uses pack to embed a copy diff --git a/compiler/tests-ocaml/basic-modules/dune b/compiler/tests-ocaml/basic-modules/dune index d5bfb9f8a..f0add0749 100644 --- a/compiler/tests-ocaml/basic-modules/dune +++ b/compiler/tests-ocaml/basic-modules/dune @@ -1,4 +1,4 @@ (tests (names recursive_module_init) (libraries) - (modes js)) + (modes js wasm)) diff --git a/compiler/tests-ocaml/lib-atomic/dune b/compiler/tests-ocaml/lib-atomic/dune index ca4c49b45..2976592d3 100644 --- a/compiler/tests-ocaml/lib-atomic/dune +++ b/compiler/tests-ocaml/lib-atomic/dune @@ -1,3 +1,3 @@ (test (name test_atomic) - (modes js)) + (modes js wasm)) diff --git a/compiler/tests-ocaml/lib-bigarray/dune b/compiler/tests-ocaml/lib-bigarray/dune index 38ac683d5..559c82ecd 100644 --- a/compiler/tests-ocaml/lib-bigarray/dune +++ b/compiler/tests-ocaml/lib-bigarray/dune @@ -1,4 +1,4 @@ (tests (names bigarrays change_layout fftba pr5115 weak_bigarray) (libraries) - (modes js)) + (modes js wasm)) diff --git a/compiler/tests-ocaml/lib-bool/dune b/compiler/tests-ocaml/lib-bool/dune index 9047167ba..16342d641 100644 --- a/compiler/tests-ocaml/lib-bool/dune +++ b/compiler/tests-ocaml/lib-bool/dune @@ -1,4 +1,4 @@ (tests (names test) (libraries) - (modes js)) + (modes js wasm)) diff --git a/compiler/tests-ocaml/lib-buffer/dune b/compiler/tests-ocaml/lib-buffer/dune index 9047167ba..16342d641 100644 --- a/compiler/tests-ocaml/lib-buffer/dune +++ b/compiler/tests-ocaml/lib-buffer/dune @@ -1,4 +1,4 @@ (tests (names test) (libraries) - (modes js)) + (modes js wasm)) diff --git a/compiler/tests-ocaml/lib-bytes-utf/dune b/compiler/tests-ocaml/lib-bytes-utf/dune index 9b2db1c33..717f83e0e 100644 --- a/compiler/tests-ocaml/lib-bytes-utf/dune +++ b/compiler/tests-ocaml/lib-bytes-utf/dune @@ -5,4 +5,5 @@ (:standard \ -strict-sequence)) (modes js + wasm (best exe))) diff --git a/compiler/tests-ocaml/lib-bytes/dune b/compiler/tests-ocaml/lib-bytes/dune index 10725957d..4af2ae612 100644 --- a/compiler/tests-ocaml/lib-bytes/dune +++ b/compiler/tests-ocaml/lib-bytes/dune @@ -1,4 +1,4 @@ (tests (names test_bytes binary) (libraries) - (modes js)) + (modes js wasm)) diff --git a/compiler/tests-ocaml/lib-digest/dune b/compiler/tests-ocaml/lib-digest/dune index ebf76eddb..550ca1046 100644 --- a/compiler/tests-ocaml/lib-digest/dune +++ b/compiler/tests-ocaml/lib-digest/dune @@ -2,15 +2,13 @@ (names md5) (libraries) (modules md5) - (modes js)) + (modes js wasm)) (tests (names digests) (libraries) (build_if - (and - (>= %{ocaml_version} 5.2) - (<> %{profile} wasm) - (<> %{profile} wasm-effects))) + (>= %{ocaml_version} 5.2)) (modules digests) + ; blake2b not supported by wasm_of_ocaml yet (modes js)) diff --git a/compiler/tests-ocaml/lib-effects/dune b/compiler/tests-ocaml/lib-effects/dune index 95fe01b0a..9f9a1dc98 100644 --- a/compiler/tests-ocaml/lib-effects/dune +++ b/compiler/tests-ocaml/lib-effects/dune @@ -28,7 +28,7 @@ test5 test6 test_lazy used_cont) (modules (:standard \ unhandled_unlinked)) - (modes js)) + (modes js wasm)) (tests (build_if @@ -41,4 +41,4 @@ 2 (run node %{test})) (run cat))) - (modes js)) + (modes js wasm)) diff --git a/compiler/tests-ocaml/lib-filename/dune b/compiler/tests-ocaml/lib-filename/dune index 407a53e55..1f8a908a9 100644 --- a/compiler/tests-ocaml/lib-filename/dune +++ b/compiler/tests-ocaml/lib-filename/dune @@ -1,4 +1,4 @@ (tests (names suffix extension) (libraries) - (modes js)) + (modes js wasm)) diff --git a/compiler/tests-ocaml/lib-float/dune b/compiler/tests-ocaml/lib-float/dune index 9047167ba..16342d641 100644 --- a/compiler/tests-ocaml/lib-float/dune +++ b/compiler/tests-ocaml/lib-float/dune @@ -1,4 +1,4 @@ (tests (names test) (libraries) - (modes js)) + (modes js wasm)) diff --git a/compiler/tests-ocaml/lib-floatarray/dune b/compiler/tests-ocaml/lib-floatarray/dune index b3af4c6d5..de31de0d2 100644 --- a/compiler/tests-ocaml/lib-floatarray/dune +++ b/compiler/tests-ocaml/lib-floatarray/dune @@ -1,4 +1,4 @@ (tests (names floatarray) (libraries) - (modes js)) + (modes js wasm)) diff --git a/compiler/tests-ocaml/lib-format/dune b/compiler/tests-ocaml/lib-format/dune index 94c4cfe76..a5860c384 100644 --- a/compiler/tests-ocaml/lib-format/dune +++ b/compiler/tests-ocaml/lib-format/dune @@ -3,4 +3,4 @@ (libraries) (flags (:standard -no-strict-formats \ -strict-formats)) - (modes js)) + (modes js wasm)) diff --git a/compiler/tests-ocaml/lib-fun/dune b/compiler/tests-ocaml/lib-fun/dune index 9047167ba..16342d641 100644 --- a/compiler/tests-ocaml/lib-fun/dune +++ b/compiler/tests-ocaml/lib-fun/dune @@ -1,4 +1,4 @@ (tests (names test) (libraries) - (modes js)) + (modes js wasm)) diff --git a/compiler/tests-ocaml/lib-gc/dune b/compiler/tests-ocaml/lib-gc/dune index 13e636f3e..0237c30eb 100644 --- a/compiler/tests-ocaml/lib-gc/dune +++ b/compiler/tests-ocaml/lib-gc/dune @@ -2,4 +2,4 @@ (names test_gc) (libraries) (flags -w -69) - (modes js)) + (modes js wasm)) diff --git a/compiler/tests-ocaml/lib-hashtbl/dune b/compiler/tests-ocaml/lib-hashtbl/dune index 2a260ec2f..01bbb96b6 100644 --- a/compiler/tests-ocaml/lib-hashtbl/dune +++ b/compiler/tests-ocaml/lib-hashtbl/dune @@ -3,7 +3,7 @@ (deps ../../../LICENSE) (modules hfun) (libraries) - (modes js)) + (modes js wasm)) (tests (names htbl) @@ -12,7 +12,7 @@ (build_if (>= %{ocaml_version} 5)) (libraries) - (modes js)) + (modes js wasm)) (rule (action diff --git a/compiler/tests-ocaml/lib-int/dune b/compiler/tests-ocaml/lib-int/dune index 9047167ba..16342d641 100644 --- a/compiler/tests-ocaml/lib-int/dune +++ b/compiler/tests-ocaml/lib-int/dune @@ -1,4 +1,4 @@ (tests (names test) (libraries) - (modes js)) + (modes js wasm)) diff --git a/compiler/tests-ocaml/lib-int64/dune b/compiler/tests-ocaml/lib-int64/dune index 4ff01bc02..6987384f8 100644 --- a/compiler/tests-ocaml/lib-int64/dune +++ b/compiler/tests-ocaml/lib-int64/dune @@ -1,4 +1,4 @@ (tests (names test issue9460) (libraries) - (modes js)) + (modes js wasm)) diff --git a/compiler/tests-ocaml/lib-list/dune b/compiler/tests-ocaml/lib-list/dune index 9047167ba..16342d641 100644 --- a/compiler/tests-ocaml/lib-list/dune +++ b/compiler/tests-ocaml/lib-list/dune @@ -1,4 +1,4 @@ (tests (names test) (libraries) - (modes js)) + (modes js wasm)) diff --git a/compiler/tests-ocaml/lib-option/dune b/compiler/tests-ocaml/lib-option/dune index 9047167ba..16342d641 100644 --- a/compiler/tests-ocaml/lib-option/dune +++ b/compiler/tests-ocaml/lib-option/dune @@ -1,4 +1,4 @@ (tests (names test) (libraries) - (modes js)) + (modes js wasm)) diff --git a/compiler/tests-ocaml/lib-printf/dune b/compiler/tests-ocaml/lib-printf/dune index 69defbd4e..2a15a0ace 100644 --- a/compiler/tests-ocaml/lib-printf/dune +++ b/compiler/tests-ocaml/lib-printf/dune @@ -5,4 +5,5 @@ (:standard -no-strict-formats \ -strict-formats)) (modes js + wasm (best exe))) diff --git a/compiler/tests-ocaml/lib-queue/dune b/compiler/tests-ocaml/lib-queue/dune index 9047167ba..16342d641 100644 --- a/compiler/tests-ocaml/lib-queue/dune +++ b/compiler/tests-ocaml/lib-queue/dune @@ -1,4 +1,4 @@ (tests (names test) (libraries) - (modes js)) + (modes js wasm)) diff --git a/compiler/tests-ocaml/lib-random/dune b/compiler/tests-ocaml/lib-random/dune index 840bec2a7..6c1c5e29e 100644 --- a/compiler/tests-ocaml/lib-random/dune +++ b/compiler/tests-ocaml/lib-random/dune @@ -5,4 +5,5 @@ (libraries) (modes js + wasm (best exe))) diff --git a/compiler/tests-ocaml/lib-result/dune b/compiler/tests-ocaml/lib-result/dune index 9047167ba..16342d641 100644 --- a/compiler/tests-ocaml/lib-result/dune +++ b/compiler/tests-ocaml/lib-result/dune @@ -1,4 +1,4 @@ (tests (names test) (libraries) - (modes js)) + (modes js wasm)) diff --git a/compiler/tests-ocaml/lib-seq/dune b/compiler/tests-ocaml/lib-seq/dune index 9047167ba..16342d641 100644 --- a/compiler/tests-ocaml/lib-seq/dune +++ b/compiler/tests-ocaml/lib-seq/dune @@ -1,4 +1,4 @@ (tests (names test) (libraries) - (modes js)) + (modes js wasm)) diff --git a/compiler/tests-ocaml/lib-set/dune b/compiler/tests-ocaml/lib-set/dune index 9e8fed86d..c0602be25 100644 --- a/compiler/tests-ocaml/lib-set/dune +++ b/compiler/tests-ocaml/lib-set/dune @@ -1,4 +1,4 @@ (tests (names testmap testset) (libraries) - (modes js)) + (modes js wasm)) diff --git a/compiler/tests-ocaml/lib-stack/dune b/compiler/tests-ocaml/lib-stack/dune index 9047167ba..16342d641 100644 --- a/compiler/tests-ocaml/lib-stack/dune +++ b/compiler/tests-ocaml/lib-stack/dune @@ -1,4 +1,4 @@ (tests (names test) (libraries) - (modes js)) + (modes js wasm)) diff --git a/compiler/tests-ocaml/lib-str/dune b/compiler/tests-ocaml/lib-str/dune index 18b732190..fe1e7b18c 100644 --- a/compiler/tests-ocaml/lib-str/dune +++ b/compiler/tests-ocaml/lib-str/dune @@ -1,4 +1,4 @@ (tests (names t01) (libraries str) - (modes js)) + (modes js wasm)) diff --git a/compiler/tests-ocaml/lib-string/dune b/compiler/tests-ocaml/lib-string/dune index f1b08d6ad..e3f41537b 100644 --- a/compiler/tests-ocaml/lib-string/dune +++ b/compiler/tests-ocaml/lib-string/dune @@ -3,4 +3,4 @@ (build_if (>= %{ocaml_version} 5)) (libraries) - (modes js)) + (modes js wasm)) diff --git a/compiler/tests-ocaml/lib-uchar/dune b/compiler/tests-ocaml/lib-uchar/dune index 9047167ba..16342d641 100644 --- a/compiler/tests-ocaml/lib-uchar/dune +++ b/compiler/tests-ocaml/lib-uchar/dune @@ -1,4 +1,4 @@ (tests (names test) (libraries) - (modes js)) + (modes js wasm)) diff --git a/compiler/tests-ocaml/prim-bigstring/dune b/compiler/tests-ocaml/prim-bigstring/dune index 2e162bd45..880fb9cd7 100644 --- a/compiler/tests-ocaml/prim-bigstring/dune +++ b/compiler/tests-ocaml/prim-bigstring/dune @@ -1,4 +1,4 @@ (tests (names bigstring_access string_access) (libraries) - (modes js)) + (modes js wasm)) diff --git a/compiler/tests-ocaml/prim-bswap/dune b/compiler/tests-ocaml/prim-bswap/dune index 36c5b217b..a0328d664 100644 --- a/compiler/tests-ocaml/prim-bswap/dune +++ b/compiler/tests-ocaml/prim-bswap/dune @@ -1,4 +1,4 @@ (tests (names bswap) (libraries) - (modes js)) + (modes js wasm)) diff --git a/compiler/tests-ocaml/prim-revapply/dune b/compiler/tests-ocaml/prim-revapply/dune index bf4e90bb6..017e60f37 100644 --- a/compiler/tests-ocaml/prim-revapply/dune +++ b/compiler/tests-ocaml/prim-revapply/dune @@ -1,4 +1,4 @@ (tests (names apply revapply) (libraries) - (modes js)) + (modes js wasm)) diff --git a/compiler/tests-re/dune b/compiler/tests-re/dune index 10c45d2c5..e86d9c934 100644 --- a/compiler/tests-re/dune +++ b/compiler/tests-re/dune @@ -6,4 +6,4 @@ (tests (names test_str) (libraries str re) - (modes js)) + (modes js wasm)) diff --git a/compiler/tests-runtime-events/dune b/compiler/tests-runtime-events/dune index f387de95e..a8a208145 100644 --- a/compiler/tests-runtime-events/dune +++ b/compiler/tests-runtime-events/dune @@ -8,4 +8,4 @@ (build_if (>= %{ocaml_version} 5.1.0)) (libraries runtime_events) - (modes js)) + (modes js wasm)) diff --git a/compiler/tests-sourcemap/dune b/compiler/tests-sourcemap/dune index 22b448809..76618354b 100644 --- a/compiler/tests-sourcemap/dune +++ b/compiler/tests-sourcemap/dune @@ -7,10 +7,6 @@ (name test) (modules test) (modes js) - (enabled_if - (and - (<> %{profile} wasm) - (<> %{profile} wasm-effects))) (js_of_ocaml (link_flags (:standard --source-map-root /my/sourceRoot))) @@ -18,10 +14,6 @@ (library (name testlib) - (enabled_if - (and - (<> %{profile} wasm) - (<> %{profile} wasm-effects))) (modules a b c d)) (test diff --git a/compiler/tests-wasm_of_ocaml/dune b/compiler/tests-wasm_of_ocaml/dune index fc33f1658..0ae81f799 100644 --- a/compiler/tests-wasm_of_ocaml/dune +++ b/compiler/tests-wasm_of_ocaml/dune @@ -1,5 +1,7 @@ (tests (names gh38 gh46 gh107 gh112) - (modes js) + (modes js wasm) (js_of_ocaml + (flags :standard --disable optcall --no-inline)) + (wasm_of_ocaml (flags :standard --disable optcall --no-inline))) diff --git a/dune b/dune index 85596593f..01946378d 100644 --- a/dune +++ b/dune @@ -1,8 +1,12 @@ (env (dev + (wasm_of_ocaml + (enabled_if false)) (flags (:standard -w +a-4-40-41-42-44-48-58-66-70))) (using-effects + (wasm_of_ocaml + (enabled_if false)) (js_of_ocaml (compilation_mode separate) (flags @@ -13,16 +17,18 @@ (binaries (tools/node_wrapper.sh as node)) (js_of_ocaml - (compilation_mode separate) - (submodes wasm))) + (enabled_if false)) + (wasm_of_ocaml + (compilation_mode separate))) (wasm-effects (binaries (tools/node_wrapper.sh as node)) (js_of_ocaml + (enabled_if false)) + (wasm_of_ocaml (compilation_mode separate) (flags - (:standard --enable effects)) - (submodes wasm))) + (:standard --enable effects)))) (bench_no_debug (flags (:standard \ -g)) diff --git a/examples/graphics/dune b/examples/graphics/dune index a563ee773..cecdf2462 100644 --- a/examples/graphics/dune +++ b/examples/graphics/dune @@ -1,6 +1,6 @@ (executable (name main) - (modes js) + (modes js wasm) (libraries js_of_ocaml-lwt.graphics) (preprocess (pps js_of_ocaml-ppx))) diff --git a/examples/test_wheel/dune b/examples/test_wheel/dune index cd729978b..ba4be3c0a 100644 --- a/examples/test_wheel/dune +++ b/examples/test_wheel/dune @@ -1,6 +1,6 @@ (executables (names test_wheel) (libraries js_of_ocaml) - (modes js) + (modes js wasm) (preprocess (pps js_of_ocaml-ppx))) diff --git a/lib/deriving_json/tests/dune b/lib/deriving_json/tests/dune index 8834c5913..c1e0147b3 100644 --- a/lib/deriving_json/tests/dune +++ b/lib/deriving_json/tests/dune @@ -2,6 +2,6 @@ (name deriving_expect_tests) (libraries unix js_of_ocaml js_of_ocaml.deriving) (inline_tests - (modes js)) + (modes js wasm)) (preprocess (pps ppx_expect ppx_deriving_json))) diff --git a/lib/tests/dune.inc b/lib/tests/dune.inc index b16a266b6..c944536e8 100644 --- a/lib/tests/dune.inc +++ b/lib/tests/dune.inc @@ -5,7 +5,7 @@ (enabled_if true) (modules test_css_angle) (libraries js_of_ocaml unix) - (inline_tests (modes js)) + (inline_tests (modes js wasm)) (preprocess (pps ppx_js_internal ppx_expect))) @@ -15,7 +15,7 @@ (enabled_if true) (modules test_css_color) (libraries js_of_ocaml unix) - (inline_tests (modes js)) + (inline_tests (modes js wasm)) (preprocess (pps ppx_js_internal ppx_expect))) @@ -25,7 +25,7 @@ (enabled_if true) (modules test_css_length) (libraries js_of_ocaml unix) - (inline_tests (modes js)) + (inline_tests (modes js wasm)) (preprocess (pps ppx_js_internal ppx_expect))) @@ -35,7 +35,7 @@ (enabled_if (and (<> %{profile} using-effects) (<> %{profile} wasm) (<> %{profile} wasm-effects))) (modules test_fun_call) (libraries js_of_ocaml unix) - (inline_tests (modes js)) + (inline_tests (modes js wasm)) (preprocess (pps ppx_js_internal ppx_expect))) @@ -45,7 +45,7 @@ (enabled_if true) (modules test_fun_call_2) (libraries js_of_ocaml unix) - (inline_tests (modes js)) + (inline_tests (modes js wasm)) (preprocess (pps ppx_js_internal ppx_expect))) @@ -55,7 +55,7 @@ (enabled_if (and (<> %{profile} wasm) (<> %{profile} wasm-effects))) (modules test_json) (libraries js_of_ocaml unix) - (inline_tests (modes js)) + (inline_tests (modes js wasm)) (preprocess (pps ppx_js_internal ppx_expect))) @@ -65,7 +65,7 @@ (enabled_if true) (modules test_nodejs_filesystem_errors) (libraries js_of_ocaml unix) - (inline_tests (modes js)) + (inline_tests (modes js wasm)) (preprocess (pps ppx_js_internal ppx_expect))) @@ -75,7 +75,7 @@ (enabled_if (and (<> %{profile} wasm) (<> %{profile} wasm-effects))) (modules test_poly_compare) (libraries js_of_ocaml unix) - (inline_tests (modes js)) + (inline_tests (modes js wasm)) (preprocess (pps ppx_js_internal ppx_expect))) @@ -85,7 +85,7 @@ (enabled_if true) (modules test_poly_equal) (libraries js_of_ocaml unix) - (inline_tests (modes js)) + (inline_tests (modes js wasm)) (preprocess (pps ppx_js_internal ppx_expect))) @@ -95,7 +95,7 @@ (enabled_if true) (modules test_regexp) (libraries js_of_ocaml unix) - (inline_tests (modes js)) + (inline_tests (modes js wasm)) (preprocess (pps ppx_js_internal ppx_expect))) @@ -105,7 +105,7 @@ (enabled_if (and (>= %{ocaml_version} 5) (<> %{profile} wasm) (<> %{profile} wasm-effects))) (modules test_sys) (libraries js_of_ocaml unix) - (inline_tests (modes js)) + (inline_tests (modes js wasm)) (preprocess (pps ppx_js_internal ppx_expect))) @@ -115,7 +115,7 @@ (enabled_if true) (modules test_typed_array) (libraries js_of_ocaml unix) - (inline_tests (modes js)) + (inline_tests (modes js wasm)) (preprocess (pps ppx_js_internal ppx_expect))) @@ -125,7 +125,7 @@ (enabled_if true) (modules test_unsafe_set_get) (libraries js_of_ocaml unix) - (inline_tests (modes js)) + (inline_tests (modes js wasm)) (preprocess (pps ppx_js_internal ppx_expect))) @@ -135,6 +135,6 @@ (enabled_if true) (modules test_url) (libraries js_of_ocaml unix) - (inline_tests (modes js)) + (inline_tests (modes js wasm)) (preprocess (pps ppx_js_internal ppx_expect))) diff --git a/lib/tests/gen-rules/gen.ml b/lib/tests/gen-rules/gen.ml index eda5eea71..257fecc0d 100644 --- a/lib/tests/gen-rules/gen.ml +++ b/lib/tests/gen-rules/gen.ml @@ -71,7 +71,7 @@ let () = (enabled_if %s) (modules %s) (libraries js_of_ocaml unix) - (inline_tests (modes js)) + (inline_tests (modes js wasm)) (preprocess (pps ppx_js_internal ppx_expect))) |} diff --git a/tools/ci_setup.ml b/tools/ci_setup.ml index dc94596a4..d3a08f6c1 100644 --- a/tools/ci_setup.ml +++ b/tools/ci_setup.ml @@ -29,7 +29,7 @@ let dune_workspace = (env (_ (env-vars (TESTING_FRAMEWORK inline-test)) - (js_of_ocaml (submodes wasm)) + (js_of_ocaml (enabled_if false)) (flags :standard -warn-error -8-32-34-49-52-55 -w -67-69))) |} @@ -54,6 +54,15 @@ index 91933ec..849e4d7 100644 ) ; ( "bignum" , {bignum| +diff --git a/dune-project b/dune-project +index e563d7e..b87e356 100644 +--- a/dune-project ++++ b/dune-project +@@ -1,3 +1,3 @@ +-(lang dune 2.0) ++(lang dune 3.17) + + (formatting disabled) diff --git a/test/src/dune b/test/src/dune index f93ae3f..3f00557 100644 --- a/test/src/dune @@ -62,7 +71,7 @@ index f93ae3f..3f00557 100644 (name bignum_test) (libraries bigint bignum core expect_test_helpers_core sexp_grammar_validation) -+ (inline_tests (flags -drop-tag no-js -drop-tag no-wasm -drop-tag 64-bits-only) (modes js)) ++ (inline_tests (flags -drop-tag no-js -drop-tag no-wasm -drop-tag 64-bits-only) (modes js wasm)) (preprocess (pps ppx_jane))) diff --git a/test/src/test_bignum.ml b/test/src/test_bignum.ml From 47f0707ee2ba8ca1ad6e543771ee416753cc2968 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Vouillon?= Date: Mon, 4 Nov 2024 17:32:47 +0100 Subject: [PATCH 2/4] Library tests: lighter conditions --- lib/tests/dune.inc | 16 ++++++++-------- lib/tests/gen-rules/gen.ml | 20 +++++++++----------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/lib/tests/dune.inc b/lib/tests/dune.inc index c944536e8..b7f107eb2 100644 --- a/lib/tests/dune.inc +++ b/lib/tests/dune.inc @@ -32,10 +32,10 @@ (library ;; lib/tests/test_fun_call.ml (name test_fun_call_75) - (enabled_if (and (<> %{profile} using-effects) (<> %{profile} wasm) (<> %{profile} wasm-effects))) + (enabled_if (<> %{profile} using-effects)) (modules test_fun_call) (libraries js_of_ocaml unix) - (inline_tests (modes js wasm)) + (inline_tests (modes js)) (preprocess (pps ppx_js_internal ppx_expect))) @@ -52,10 +52,10 @@ (library ;; lib/tests/test_json.ml (name test_json_75) - (enabled_if (and (<> %{profile} wasm) (<> %{profile} wasm-effects))) + (enabled_if true) (modules test_json) (libraries js_of_ocaml unix) - (inline_tests (modes js wasm)) + (inline_tests (modes js)) (preprocess (pps ppx_js_internal ppx_expect))) @@ -72,10 +72,10 @@ (library ;; lib/tests/test_poly_compare.ml (name test_poly_compare_75) - (enabled_if (and (<> %{profile} wasm) (<> %{profile} wasm-effects))) + (enabled_if true) (modules test_poly_compare) (libraries js_of_ocaml unix) - (inline_tests (modes js wasm)) + (inline_tests (modes js)) (preprocess (pps ppx_js_internal ppx_expect))) @@ -102,10 +102,10 @@ (library ;; lib/tests/test_sys.ml (name test_sys_75) - (enabled_if (and (>= %{ocaml_version} 5) (<> %{profile} wasm) (<> %{profile} wasm-effects))) + (enabled_if (>= %{ocaml_version} 5)) (modules test_sys) (libraries js_of_ocaml unix) - (inline_tests (modes js wasm)) + (inline_tests (modes js)) (preprocess (pps ppx_js_internal ppx_expect))) diff --git a/lib/tests/gen-rules/gen.ml b/lib/tests/gen-rules/gen.ml index 257fecc0d..ef2ec73e5 100644 --- a/lib/tests/gen-rules/gen.ml +++ b/lib/tests/gen-rules/gen.ml @@ -71,7 +71,7 @@ let () = (enabled_if %s) (modules %s) (libraries js_of_ocaml unix) - (inline_tests (modes js wasm)) + (inline_tests (modes js%s)) (preprocess (pps ppx_js_internal ppx_expect))) |} @@ -80,13 +80,11 @@ let () = basename (Hashtbl.hash prefix mod 100) (match enabled_if basename with - | Any -> "true" - | GE5 -> - (* ZZZ /static not yet implemented *) - "(and (>= %{ocaml_version} 5) (<> %{profile} wasm) (<> %{profile} \ - wasm-effects))" - | Not_wasm -> "(and (<> %{profile} wasm) (<> %{profile} wasm-effects))" - | No_effects_not_wasm -> - "(and (<> %{profile} using-effects) (<> %{profile} wasm) (<> %{profile} \ - wasm-effects))") - basename) + | Any | Not_wasm -> "true" + | GE5 -> "(>= %{ocaml_version} 5)" + | No_effects_not_wasm -> "(<> %{profile} using-effects)") + basename + (match enabled_if basename with + | Any -> " wasm" + | GE5 -> "" (* ZZZ /static not yet implemented *) + | Not_wasm | No_effects_not_wasm -> "")) From bdf5c00673b6d1f315f85946adab272e351020a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Vouillon?= Date: Tue, 5 Nov 2024 11:33:36 +0100 Subject: [PATCH 3/4] CI: pin main branch of dune --- .github/workflows/build-wasm_of_ocaml.yml | 2 +- .github/workflows/build.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-wasm_of_ocaml.yml b/.github/workflows/build-wasm_of_ocaml.yml index 9e1d559f5..bdac08d97 100644 --- a/.github/workflows/build-wasm_of_ocaml.yml +++ b/.github/workflows/build-wasm_of_ocaml.yml @@ -148,7 +148,7 @@ jobs: - name: Pin dune run: | - opam pin add -n dune.3.17 https://github.com/ocaml-wasm/dune.git#wasm_of_ocaml-incremental + opam pin add -n dune.3.17 https://github.com/ocaml/dune.git - name: Pin wasm_of_ocaml working-directory: ./wasm_of_ocaml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9a48c267f..5d4917a71 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -114,7 +114,7 @@ jobs: - name: Pin dune run: | - opam pin add dune.3.17 https://github.com/ocaml-wasm/dune.git#wasm_of_ocaml + opam pin add dune.3.17 https://github.com/ocaml/dune.git - run: opam install conf-pkg-config if: runner.os == 'Windows' @@ -178,7 +178,7 @@ jobs: dune-cache: true - name: Pin dune run: | - opam pin add -n dune.3.17 https://github.com/ocaml-wasm/dune.git#wasm_of_ocaml + opam pin add -n dune.3.17 https://github.com/ocaml/dune.git - uses: ocaml/setup-ocaml/lint-opam@v3 lint-fmt: @@ -193,7 +193,7 @@ jobs: dune-cache: true - name: Pin dune run: | - opam pin add -n dune.3.17 https://github.com/ocaml-wasm/dune.git#wasm_of_ocaml + opam pin add -n dune.3.17 https://github.com/ocaml/dune.git - uses: ocaml/setup-ocaml/lint-fmt@v3 lint-runtime: From ee358637991c085e923cc97b424a713407b8ada6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Vouillon?= Date: Wed, 6 Nov 2024 14:39:52 +0100 Subject: [PATCH 4/4] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ef6ed187d..35e78b431 100644 --- a/README.md +++ b/README.md @@ -24,8 +24,8 @@ The following commands will perform a minimal installation: ``` git clone https://github.com/ocaml-wasm/wasm_of_ocaml cd wasm_of_ocaml -opam pin add -n --with-version 3.17 https://github.com/ocaml-wasm/dune.git#wasm_of_ocaml -opam pin add -n --with-version 5.3.0-wasm . +opam pin add -n --with-version 3.17 https://github.com/ocaml/dune.git +opam pin add -n --with-version 5.8.2-wasm . opam install wasm_of_ocaml-compiler ``` You may want to install additional packages. For instance: