ocaml-batteries-team / batteries-included

Batteries Included project
http://ocaml-batteries-team.github.com/batteries-included/hdoc2/
Other
514 stars 106 forks source link

mingw, testsuite/test_digest.ml failure #53

Closed gdsfh closed 14 years ago

gdsfh commented 14 years ago

When I run "omake test" under mingw, all tests except test_digest pass, but test_digest fails, even after changing "Pervasives.open_in" to "Pervasives.open_in_bin" (to open files in binary mode). Here is a hex dump of log ("omake test > log 2>&1"):

00000004D0: 3D 3D 3D 3D 3D 3D 3D 3D | 3D 0D 0A 46 61 69 6C 75 =========..Failu 00000004E0: 72 65 3A 20 41 6C 6C 3A | 36 3A 44 69 67 65 73 74 re: All:6:Digest 00000004F0: 3A 30 3A 43 6F 6D 70 61 | 72 69 6E 67 20 4C 65 67 :0:Comparing Leg 0000000500: 61 63 79 2E 44 69 67 65 | 73 74 20 61 6E 64 20 4D acy.Digest and M 0000000510: 44 35 0D 0A 0D 0A 4F 55 | 6E 69 74 3A 20 65 78 70 D5....OUnit: exp 0000000520: 65 63 74 65 64 3A 20 22 | 92 36 86 FD 7A 6B AF 5C ected: "Т6..zk.\ 0000000530: 31 38 35 39 5C 30 31 36 | 39 5F 20 91 65 FB 22 20 1859\0169_ Сev" 0000000540: 62 75 74 20 67 6F 74 3A | 20 22 5C 6E 5C 30 33 31 but got: "\n\031 0000000550: F9 A1 37 CE 51 FE 5C 30 | 32 36 B2 A9 AA 94 77 5C ..7.Q.\026....w\ 0000000560: 6E 9D 22 0D 0A 2D 2D 2D | 2D 2D 2D 2D 2D 2D 2D 2D n."..-----------

I have checked that Open_binary is passed to open_in_gen by adding debug print in function openin in src/batFile.ml: | -> let () = Printf.eprintf "BatFile.open_in: binary set = %b\n%!" (List.mem Open_binary unix_mode) in input_channel ~cleanup:true ~autoclose:false (open_in_gen unix_mode perm name)

and modifying testsuite/test_digest.ml like this: let () = Printf.eprintf "before open\n%!" in let inp = BatFile.open_in Sys.argv.(0) in let () = Printf.eprintf "after open\n%!" in

(so, I get

..........before open BatFile.open_in: binary set = true ....after open

in the output of "omake test")

I think this is a batteries' bug, but I don't know batteries good enough to fix it by myself.

gdsfh commented 14 years ago

I've fixed it: http://overbld.hg.sourceforge.net/hgweb/overbld/overbld/raw-file/fe72e6f10ab6/src/batteries/patch/100__binmode1

thelema commented 14 years ago

Fix applied. I hope you don't mind the way I put your email in commit 488b9b3 as author.