From 43e625f47adb3c8c1317f6d3b8b2438e3c41575c Mon Sep 17 00:00:00 2001 From: Hugo Heuzard Date: Sun, 14 Sep 2025 13:24:55 +0200 Subject: [PATCH 1/3] Switch tests to OCaml 5.4 --- .github/workflows/js_of_ocaml.yml | 20 +++++++------------ .github/workflows/wasm_of_ocaml.yml | 2 +- compiler/tests-ocaml/lib-list/test.ml | 2 -- .../tests-toplevel/test_toplevel.expected | 4 ++-- 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/.github/workflows/js_of_ocaml.yml b/.github/workflows/js_of_ocaml.yml index 0776e4955c..73ccbd05b5 100644 --- a/.github/workflows/js_of_ocaml.yml +++ b/.github/workflows/js_of_ocaml.yml @@ -25,6 +25,7 @@ jobs: - "5.0" - "5.1" - "5.2" + - "5.3" skip-test: - true skip-doc: @@ -59,7 +60,7 @@ jobs: skip-doc: true - os: ubuntu-latest os-name: Ubuntu - ocaml-compiler: "5.3" + ocaml-compiler: "5.4" skip-effects: false skip-test: false skip-doc: false @@ -72,31 +73,24 @@ jobs: # Note this OCaml compiler is bytecode only - os: ubuntu-latest os-name: Ubuntu - ocaml-name: "5.3.0+32bit" - ocaml-compiler: "ocaml-variants.5.3.0+options,ocaml-option-32bit" + ocaml-name: "5.4.0+32bit" + ocaml-compiler: "ocaml-variants.5.4.0+options,ocaml-option-32bit" skip-effects: true # disabled for the same reason than `skip-test` skip-test: true # the `time_now.0.17` package is pulled and doesn't work in 32 bits :( skip-doc: true - os: macos-latest os-name: MacOS - ocaml-compiler: "5.3" + ocaml-compiler: "5.4" skip-effects: true skip-test: false skip-doc: true - os: windows-latest os-name: Windows - ocaml-compiler: "5.3" + ocaml-compiler: "5.4" skip-effects: false skip-test: false skip-doc: true - - os: ubuntu-latest - os-name: Ubuntu - ocaml-name: "5.4-alpha1" - ocaml-compiler: "ocaml-compiler.5.4.0~alpha1" - skip-effects: true - skip-test: true - skip-doc: true - + runs-on: ${{ matrix.os }} name: diff --git a/.github/workflows/wasm_of_ocaml.yml b/.github/workflows/wasm_of_ocaml.yml index c8e0a64d10..778c59a2de 100644 --- a/.github/workflows/wasm_of_ocaml.yml +++ b/.github/workflows/wasm_of_ocaml.yml @@ -26,6 +26,7 @@ jobs: - "5.0" - "5.1" - "5.2" + - "5.4" separate_compilation: - true jane_street_tests: @@ -116,7 +117,6 @@ jobs: run: | opam repo add js janestreet/opam-repository opam install opam-format - opam pin add ppxlib -n 0.35.0 opam exec -- dune exec --root wasm_of_ocaml tools/ci_setup.exe - name: Pin Jane Street packages diff --git a/compiler/tests-ocaml/lib-list/test.ml b/compiler/tests-ocaml/lib-list/test.ml index 227c454775..bcca022f61 100644 --- a/compiler/tests-ocaml/lib-list/test.ml +++ b/compiler/tests-ocaml/lib-list/test.ml @@ -68,13 +68,11 @@ let () = assert (List.take 3 [1; 2; 3; 4; 5] = [1; 2; 3]); assert (List.take 3 [1; 2] = [1; 2]); assert (List.take 3 [] = []); - assert ((try List.take (-1) [1; 2] with Invalid_argument _ -> [999]) = [999]); assert (List.take 0 [1; 2] = []); assert (List.drop 6 hello_world = world); assert (List.drop 3 [1; 2; 3; 4; 5] = [4; 5]); assert (List.drop 3 [1; 2] = []); assert (List.drop 3 [] = []); - assert ((try List.drop (-1) [1; 2] with Invalid_argument _ -> [999]) = [999]); assert (List.drop 0 [1; 2] = [1; 2]); assert (List.take_while (fun x -> x < 3) [1; 2; 3; 4; 1; 2; 3; 4] = [1; 2]); diff --git a/compiler/tests-toplevel/test_toplevel.expected b/compiler/tests-toplevel/test_toplevel.expected index 81e85b3449..c6e778709b 100644 --- a/compiler/tests-toplevel/test_toplevel.expected +++ b/compiler/tests-toplevel/test_toplevel.expected @@ -2,6 +2,6 @@ hello - : int = 2 Line 4, characters 2-4: Error: Syntax error -Line 5, characters 0-16: -Error: Unbound module "Missing_module" +Line 5, characters 0-14: +Error: Unbound module Missing_module val y : float = 0.333333333333333315 From 8787cb70913f771f24b31cfe831d519067b33cb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Vouillon?= Date: Mon, 20 Oct 2025 14:59:48 +0200 Subject: [PATCH 2/3] Update Jane Street packages --- .github/workflows/wasm_of_ocaml.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/wasm_of_ocaml.yml b/.github/workflows/wasm_of_ocaml.yml index 778c59a2de..31fa6aaf00 100644 --- a/.github/workflows/wasm_of_ocaml.yml +++ b/.github/workflows/wasm_of_ocaml.yml @@ -119,14 +119,22 @@ jobs: opam install opam-format opam exec -- dune exec --root wasm_of_ocaml tools/ci_setup.exe - - name: Pin Jane Street packages - if: ${{ ! matrix.jane_street_tests }} + - name: Pin Jane Street packages (v0.16) + if: contains(fromJson('["4.14","5.0","5.1","5.2"]'), matrix.ocaml-compiler) run: | opam pin add -n base.v0.16.1 https://github.com/ocaml-wasm/base.git#wasm opam pin add -n time_now.v0.16.1 https://github.com/ocaml-wasm/time_now.git#wasm opam pin add -n ppx_inline_test.v0.16.1 https://github.com/ocaml-wasm/ppx_inline_test.git#wasm opam pin add -n ppx_expect.v0.16.1 https://github.com/ocaml-wasm/ppx_expect.git#wasm + - name: Pin Jane Street packages (v0.17) + if: ${{ ! (matrix.jane_street_tests || contains(fromJson('["4.14","5.0","5.1","5.2"]'), matrix.ocaml-compiler)) }} + run: | + opam pin add -n base.v0.17.3 https://github.com/ocaml-wasm/base.git#wasm-v0.17 + opam pin add -n time_now.v0.17.0 https://github.com/ocaml-wasm/time_now.git#wasm-v0.17 + opam pin add -n ppx_inline_test.v0.17.1 https://github.com/ocaml-wasm/ppx_inline_test.git#wasm-v0.17 + opam pin add -n ppx_expect.v0.17.3 https://github.com/ocaml-wasm/ppx_expect.git#wasm-v0.17 + - name: Install wasm_of_ocaml and its test dependencies working-directory: ./wasm_of_ocaml run: | From b4ece7a7de4114c308582cc85b8fd9f491e07189 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Vouillon?= Date: Mon, 20 Oct 2025 16:00:47 +0200 Subject: [PATCH 3/3] Wasm runtime: fix caml_floatarray_concat --- runtime/wasm/array.wat | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/runtime/wasm/array.wat b/runtime/wasm/array.wat index 235a9aa52b..beb06f93d1 100644 --- a/runtime/wasm/array.wat +++ b/runtime/wasm/array.wat @@ -315,7 +315,7 @@ (br $fill)))) (local.get $a)))) - (func (export "caml_float_array_concat") (param (ref eq)) (result (ref eq)) + (func (export "caml_floatarray_concat") (param (ref eq)) (result (ref eq)) (local $i i32) (local $len i32) (local $l (ref eq)) (local $v (ref eq)) (local $b (ref $block)) @@ -327,9 +327,12 @@ (local.set $b (br_on_cast_fail $exit (ref eq) (ref $block) (local.get $l))) (local.set $v (array.get $block (local.get $b) (i32.const 1))) - (local.set $len - (i32.add (local.get $len) - (array.len (ref.cast (ref $float_array) (local.get $v))))) + (if (ref.test (ref $float_array) (local.get $v)) + (then + (local.set $len + (i32.add (local.get $len) + (array.len + (ref.cast (ref $float_array) (local.get $v))))))) (local.set $l (array.get $block (local.get $b) (i32.const 2))) (br $compute_length)))) (local.set $fa