The unpac monorepo manager self-hosting as a monorepo using unpac
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #14428 from dra27/crlf-checkouts

Fix the testsuite on _all_ CRLF checkouts

authored by

David Allsopp and committed by
GitHub
f52810e1 3760ec11

+31 -17
+4 -1
testsuite/tests/basic-io/wc.ml
··· 17 17 match c with 18 18 '\n' -> 19 19 incr lines; count Outside_word 20 + | '\r' -> 21 + (* Ignore \r to cater for CRLF vs LF checkouts *) 22 + decr chars; count Outside_word 20 23 | ' ' | '\t' -> 21 24 count Outside_word 22 25 | _ -> ··· 29 32 () 30 33 31 34 let count_file name = 32 - let ic = open_in name in 35 + let ic = open_in_bin name in 33 36 count_channel ic; 34 37 close_in ic 35 38
+1 -1
testsuite/tests/basic-io/wc.reference
··· 1 - 1232 characters, 184 words, 58 lines 1 + 1347 characters, 202 words, 61 lines
+1 -1
testsuite/tests/native-debugger/sanitize.awk
··· 57 57 gsub("1 match found in /(.*):$", "1 match found in \"XXXX\":") 58 58 59 59 # Remove trailing blanks 60 - gsub(/[ \t]+$/, "") 60 + gsub(/[ \t\r]+$/, "") 61 61 62 62 if ($0 != "") 63 63 print $0
-1
testsuite/tests/tool-caml-tex/ellipses.ml
··· 5 5 script = "${ocamlrun} ${ocamlsrcdir}/tools/ocamltex -repo-root ${ocamlsrcdir} ${readonly_files} -o ${output}"; 6 6 hasstr; 7 7 hasunix; 8 - native-compiler; 9 8 shared-libraries; 10 9 script with unix, str; 11 10 check-program-output;
-1
testsuite/tests/tool-caml-tex/redirections.ml
··· 5 5 script = "${ocamlrun} ${ocamlsrcdir}/tools/ocamltex -repo-root ${ocamlsrcdir} ${readonly_files} -o ${output}"; 6 6 hasstr; 7 7 hasunix; 8 - native-compiler; 9 8 { 10 9 shared-libraries; 11 10 script with unix, str;
+16 -11
testsuite/tests/warnings/mnemonics.mll
··· 6 6 } 7 7 8 8 let ws = [' ''\t'] 9 - let nl = '\n' 9 + let eol = '\r'? '\n' 10 + let to_eol = [^'\n']* eol 10 11 let constr = ['A'-'Z']['a'-'z''A'-'Z''0'-'9''_']* 11 12 let int = ['0'-'9']+ 12 13 let mnemo = ['a'-'z']['a'-'z''-']*['a'-'z'] 13 14 14 15 rule seek_let_number_function = parse 15 - | ws* "let" ws+ "number" ws* "=" ws* "function" ws* '\n' 16 + | ws* "let" ws+ "number" ws* "=" ws* "function" ws* eol 16 17 { () } 17 - | [^'\n']* '\n' 18 + | to_eol 18 19 { seek_let_number_function lexbuf } 19 20 20 21 and constructors = parse 21 - | ws* '|' ws* (constr as c) (ws* '_')? ws* "->" ws* (int as n) [^'\n']* '\n' 22 + | ws* '|' ws* (constr as c) (ws* '_')? ws* "->" ws* (int as n) to_eol 22 23 { (c, int_of_string n) :: constructors lexbuf } 23 - | ws* ";;" ws* '\n' 24 + | ws* ";;" ws* eol 24 25 { [] } 25 26 26 27 and mnemonics = parse 27 - | ws* (int as n) ws+ '[' (mnemo as s) ']' [^'\n']* '\n' 28 + | ws* (int as n) ws+ '[' (mnemo as s) ']' to_eol 28 29 { (s, int_of_string n) :: mnemonics lexbuf } 29 - | [^'\n']* '\n' 30 + | to_eol 30 31 { mnemonics lexbuf } 31 32 | eof 32 33 { [] } ··· 37 38 let ocamlrun = Sys.getenv "ocamlrun" 38 39 39 40 let constructors = 40 - let ic = open_in Filename.(concat ocamlsrcdir (concat "utils" "warnings.ml")) in 41 + let ic = 42 + open_in_bin Filename.(concat ocamlsrcdir (concat "utils" "warnings.ml")) 43 + in 41 44 Fun.protect ~finally:(fun () -> close_in_noerr ic) 42 45 (fun () -> 43 46 let lexbuf = Lexing.from_channel ic in ··· 53 56 ocamlrun [concat ocamlsrcdir "ocamlc"; "-warn-help"]) 54 57 in 55 58 assert (n = 0); 56 - let ic = open_in stdout in 59 + let ic = open_in_bin stdout in 57 60 Fun.protect ~finally:(fun () -> close_in_noerr ic) 58 61 (fun () -> 59 62 let lexbuf = Lexing.from_channel ic in ··· 74 77 | true, false -> () 75 78 | false, true -> () 76 79 | false, false -> 77 - Printf.printf "Could not find constructor corresponding to mnemonic %S (%d)\n%!" s n 80 + Printf.printf 81 + "Could not find constructor corresponding to mnemonic %S (%d)\n%!" s n 78 82 | true, true -> 79 - Printf.printf "Found constructor for deprecated warnings %S (%d)\n%!" s n 83 + Printf.printf 84 + "Found constructor for deprecated warnings %S (%d)\n%!" s n 80 85 ) mnemonics 81 86 82 87 let _ =
+9 -1
tools/ocamltex.ml
··· 587 587 | a :: q -> String.concat ~sep:"\n " ((toplevel_prompt^a)::q) 588 588 589 589 let process_file file = 590 - let ic = try open_in file with _ -> failwith "Cannot read input file" in 590 + let ic = try open_in_bin file with _ -> failwith "Cannot read input file" in 591 + let input_line ic = 592 + let line = input_line ic in 593 + let last = String.length line - 1 in 594 + if last >= 0 && line.[last] = '\r' then 595 + String.sub line 0 last 596 + else 597 + line 598 + in 591 599 let phrase_start = ref 1 and phrase_stop = ref 1 in 592 600 let incr_phrase_start () = 593 601 incr phrase_start;