diff --git a/compiler/tests-compiler/rec52.ml b/compiler/tests-compiler/rec52.ml index 18d766eeaf..87e13f1e32 100644 --- a/compiler/tests-compiler/rec52.ml +++ b/compiler/tests-compiler/rec52.ml @@ -44,6 +44,11 @@ let%expect_test "let rec" = in let p = compile_and_parse p in print_program p; + let s = [%expect.output] in + let s = + Str.global_replace (Str.regexp "runtime.caml_make_vect") "runtime.caml_array_make" s + in + print_endline s; [%expect {| (function(globalThis){ @@ -61,7 +66,7 @@ let%expect_test "let rec" = Stdlib_Hashtbl = global_data.Stdlib__Hashtbl, letrec_function_context = [], c = [], - d = runtime.caml_make_vect(5, 0), + d = runtime.caml_array_make(5, 0), default$0 = 42; function a(x){return b(x);} function b(x){ diff --git a/dune b/dune index abf74d5ffa..320fad6226 100644 --- a/dune +++ b/dune @@ -1,7 +1,7 @@ (env (dev (binaries - (tools/node_wrapper.sh as node)) + (tools/node_wrapper.exe as node)) (wasm_of_ocaml (runtest_alias runtest-wasm)) (js_of_ocaml @@ -10,7 +10,7 @@ (:standard -w +a-4-40-41-42-44-48-58-66-70))) (using-effects (binaries - (tools/node_wrapper.sh as node)) + (tools/node_wrapper.exe as node)) (wasm_of_ocaml (runtest_alias runtest-wasm)) (js_of_ocaml @@ -22,7 +22,7 @@ (:standard --enable effects)))) (bench_no_debug (binaries - (tools/node_wrapper.sh as node)) + (tools/node_wrapper.exe as node)) (flags (:standard \ -g)) (ocamlc_flags @@ -35,7 +35,7 @@ (js_of_ocaml (runtest_alias runtest-js)) (binaries - (tools/node_wrapper.sh as node)))) + (tools/node_wrapper.exe as node)))) (rule (targets version.ml.in) diff --git a/ppx/ppx_deriving_json/tests/dune b/ppx/ppx_deriving_json/tests/dune index d2607ddee2..5e2a598458 100644 --- a/ppx/ppx_deriving_json/tests/dune +++ b/ppx/ppx_deriving_json/tests/dune @@ -35,7 +35,7 @@ (rule (alias runtest) (enabled_if - (>= %{ocaml_version} 5.1)) + (>= %{ocaml_version} 5.2)) ;; (package js_of_ocaml-ppx) (action (diff gen.mlt gen.mlt.corrected))) diff --git a/tools/dune b/tools/dune new file mode 100644 index 0000000000..5a4c422832 --- /dev/null +++ b/tools/dune @@ -0,0 +1,3 @@ +(executable + (name node_wrapper) + (libraries unix)) \ No newline at end of file diff --git a/tools/node_wrapper.ml b/tools/node_wrapper.ml new file mode 100644 index 0000000000..1e8a3c5b1a --- /dev/null +++ b/tools/node_wrapper.ml @@ -0,0 +1,28 @@ +let extra_args_for_wasoo = + [ "--experimental-wasm-imported-strings" + ; "--experimental-wasm-stack-switching" + ; "--stack-size=10000" + ] + +let () = + match Unix.getenv "PATH" with + | exception Not_found -> assert false + | path -> ( + let sep = if Sys.win32 then ';' else ':' in + match String.split_on_char sep path with + | drop :: paths -> Unix.putenv "PATH" (String.concat (String.make 1 sep) paths) + | [] -> assert false) + +let args = + match Array.to_list Sys.argv with + | exe :: argv -> + let argv = + match argv with + | file :: _ when Filename.check_suffix file ".wasm.js" -> + extra_args_for_wasoo @ argv + | _ -> argv + in + Array.of_list (exe :: argv) + | [] -> assert false + +let () = Unix.execvp "node" args diff --git a/tools/node_wrapper.sh b/tools/node_wrapper.sh deleted file mode 100755 index 9912795db0..0000000000 --- a/tools/node_wrapper.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -export PATH=$(echo $PATH | cut -d : -f 2-) # Do not call oneself recursively -exec node --experimental-wasm-imported-strings --experimental-wasm-stack-switching --stack-size=10000 "$@"