From 67d0000d020d7f96534dbc6c550c4b2394df2859 Mon Sep 17 00:00:00 2001 From: hugo heuzard Date: Thu, 7 Aug 2025 09:43:47 +0200 Subject: [PATCH 1/7] Tests: some windows fix --- compiler/tests-check-prim/gen_dune.ml | 1 + compiler/tests-compiler/js_parser_printer.ml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/tests-check-prim/gen_dune.ml b/compiler/tests-check-prim/gen_dune.ml index e6cd42c2e4..82d8707956 100644 --- a/compiler/tests-check-prim/gen_dune.ml +++ b/compiler/tests-check-prim/gen_dune.ml @@ -86,6 +86,7 @@ let rule bc ocaml_version os_type = let () = let versions : version list = [ `V4_14; `V5_2; `V5_3; `V5_4 ] in + set_binary_mode_out stdout true; List.iter (fun ocaml_version -> List.iter diff --git a/compiler/tests-compiler/js_parser_printer.ml b/compiler/tests-compiler/js_parser_printer.ml index 4fd903a984..403a22ad44 100644 --- a/compiler/tests-compiler/js_parser_printer.ml +++ b/compiler/tests-compiler/js_parser_printer.ml @@ -727,7 +727,7 @@ let check_vs_string s toks = then () else match s.[a] with - | ' ' | '\n' | '\t' -> space (succ a) b + | ' ' | '\n' | '\t' | '\r' -> space (succ a) b | c -> Printf.printf "pos:%d, expecting space until %d, found %C\n" a b c in let text pos str = From 859794e316455846d81e115849e78a9e65f13135 Mon Sep 17 00:00:00 2001 From: hugo heuzard Date: Thu, 7 Aug 2025 09:44:25 +0200 Subject: [PATCH 2/7] CI: no longer change git config --- .github/workflows/js_of_ocaml.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/js_of_ocaml.yml b/.github/workflows/js_of_ocaml.yml index ce3b29c07b..54aaa7a05e 100644 --- a/.github/workflows/js_of_ocaml.yml +++ b/.github/workflows/js_of_ocaml.yml @@ -108,13 +108,6 @@ jobs: if: ${{ matrix.os == 'ubuntu-latest' }} run: sudo apt-get update - - name: Set git to use LF - if: ${{ matrix.os == 'windows-latest' && matrix.ocaml-compiler < 5.2 }} - run: | - git config --global core.autocrlf false - git config --global core.eol lf - git config --global core.ignorecase false - - name: Checkout tree uses: actions/checkout@v4 From 293a3c291fcc9bdfb2f61d748a6a0ae678466728 Mon Sep 17 00:00:00 2001 From: Hugo Heuzard Date: Thu, 7 Aug 2025 16:09:05 +0200 Subject: [PATCH 3/7] WIP --- .github/workflows/js_of_ocaml.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/js_of_ocaml.yml b/.github/workflows/js_of_ocaml.yml index 54aaa7a05e..b89249ff75 100644 --- a/.github/workflows/js_of_ocaml.yml +++ b/.github/workflows/js_of_ocaml.yml @@ -149,6 +149,9 @@ jobs: # It's faster to use a cached version run: opam install --fake binaryen-bin + - run: opam pin add ppx_expect https://github.com/hhugo/ppx_expect.git#v16-win + if: contains( matrix.ocaml-compiler, '4.14') + - run: opam install . --best-effort --solver builtin-mccs+glpk if: ${{ matrix.skip-test }} From 80d9d5e386f9309b8ffc863b8f9a20dab5888944 Mon Sep 17 00:00:00 2001 From: Hugo Heuzard Date: Fri, 8 Aug 2025 15:07:05 +0200 Subject: [PATCH 4/7] wasm --- .github/workflows/wasm_of_ocaml.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/wasm_of_ocaml.yml b/.github/workflows/wasm_of_ocaml.yml index 96e4bb010c..955346312e 100644 --- a/.github/workflows/wasm_of_ocaml.yml +++ b/.github/workflows/wasm_of_ocaml.yml @@ -66,13 +66,6 @@ jobs: if: ${{ matrix.os == 'ubuntu-latest' }} run: sudo apt-get update - - name: Set git to use LF - if: ${{ matrix.os == 'windows-latest' && matrix.ocaml-compiler < 5.2 }} - run: | - git config --global core.autocrlf false - git config --global core.eol lf - git config --global core.ignorecase false - - name: Checkout tree uses: actions/checkout@v4 with: From 06e6548771b030578cd8dc5651164e2a17179d0a Mon Sep 17 00:00:00 2001 From: Hugo Heuzard Date: Fri, 8 Aug 2025 15:07:10 +0200 Subject: [PATCH 5/7] fix tests --- compiler/tests-compiler/js_parser_printer.ml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compiler/tests-compiler/js_parser_printer.ml b/compiler/tests-compiler/js_parser_printer.ml index 403a22ad44..318813b182 100644 --- a/compiler/tests-compiler/js_parser_printer.ml +++ b/compiler/tests-compiler/js_parser_printer.ml @@ -813,6 +813,11 @@ let parse_print_token ?(invalid = false) ?(extra = false) s = | true -> Printf.printf "\n%2d: " pos.Parse_info.line | false -> ()); if pos.Parse_info.line <> 0 then prev := pos.Parse_info.line; + let s = + match tok with + | T_STRING _ -> Str.global_replace (Str.regexp {|\\r\\n|}) {|\n|} s + | _ -> s + in Printf.printf "%d:%s, " pos.Parse_info.col s; loop xs in From d95f6d2a7d9ca13af19208cc8447ab82908ed50d Mon Sep 17 00:00:00 2001 From: Hugo Heuzard Date: Fri, 8 Aug 2025 15:39:54 +0200 Subject: [PATCH 6/7] WIP --- compiler/tests-compiler/js_parser_printer.ml | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/compiler/tests-compiler/js_parser_printer.ml b/compiler/tests-compiler/js_parser_printer.ml index 318813b182..55727541a6 100644 --- a/compiler/tests-compiler/js_parser_printer.ml +++ b/compiler/tests-compiler/js_parser_printer.ml @@ -813,11 +813,6 @@ let parse_print_token ?(invalid = false) ?(extra = false) s = | true -> Printf.printf "\n%2d: " pos.Parse_info.line | false -> ()); if pos.Parse_info.line <> 0 then prev := pos.Parse_info.line; - let s = - match tok with - | T_STRING _ -> Str.global_replace (Str.regexp {|\\r\\n|}) {|\n|} s - | _ -> s - in Printf.printf "%d:%s, " pos.Parse_info.col s; loop xs in @@ -878,12 +873,13 @@ let%expect_test "string" = 5: 4:var, 8:a, 10:=, 12:"munpi\207\128\207\128\207\128qtex", 26:;, |}] let%expect_test "multiline string" = - parse_print_token ~invalid:true {| + let clean s = Str.global_replace (Str.regexp "\n") "\n" s in + parse_print_token ~invalid:true (clean {| 42; " "; 42 -|}; +|}); [%expect {| 2: 4:42, 6:;, @@ -891,24 +887,24 @@ let%expect_test "multiline string" = 4: 5:;, 5: 4:42, 0:;, Lexer error: fake:3:5: Unexpected token ILLEGAL |}]; - parse_print_token {| + parse_print_token (clean {| 42; "\ "; 42 -|}; +|}); [%expect {| 2: 4:42, 6:;, 3: 4:" ", 4: 5:;, 5: 4:42, 0:;, |}]; - parse_print_token ~invalid:true {| + parse_print_token ~invalid:true (clean {| 42; " "; 42 -|}; +|}); [%expect {| 2: 4:42, 6:;, From 79ba49e5b5c7d255473fc2916e7cb64cafd8474c Mon Sep 17 00:00:00 2001 From: Hugo Heuzard Date: Fri, 8 Aug 2025 15:40:11 +0200 Subject: [PATCH 7/7] WIP --- compiler/tests-compiler/js_parser_printer.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/tests-compiler/js_parser_printer.ml b/compiler/tests-compiler/js_parser_printer.ml index 55727541a6..042c0ca90b 100644 --- a/compiler/tests-compiler/js_parser_printer.ml +++ b/compiler/tests-compiler/js_parser_printer.ml @@ -873,7 +873,7 @@ let%expect_test "string" = 5: 4:var, 8:a, 10:=, 12:"munpi\207\128\207\128\207\128qtex", 26:;, |}] let%expect_test "multiline string" = - let clean s = Str.global_replace (Str.regexp "\n") "\n" s in + let clean s = Str.global_replace (Str.regexp "\r\n") "\n" s in parse_print_token ~invalid:true (clean {| 42; "