File tree Expand file tree Collapse file tree 2 files changed +44
-5
lines changed
test/bin/mdx-dune-gen/misc/non-deterministic Expand file tree Collapse file tree 2 files changed +44
-5
lines changed Original file line number Diff line number Diff line change 1+ (* small helper to determine whether two files differ *)
2+
3+ let main () =
4+ let first = Sys. argv.(1 ) |> open_in in
5+ let second = Sys. argv.(2 ) |> open_in in
6+ let rec loop () =
7+ match input_line first with
8+ | first_line -> (
9+ match input_line second with
10+ | second_line ->
11+ match String. equal first_line second_line with
12+ | true -> loop ()
13+ | false ->
14+ (* we found a difference between the lines *)
15+ exit 0
16+ | exception End_of_file ->
17+ (* the second file ended before the first *)
18+ exit 0
19+ )
20+ | exception End_of_file ->
21+ (* the first file ended first *)
22+ match input_line second with
23+ | _ ->
24+ (* the second file continues: a difference *)
25+ exit 1
26+ | exception End_of_file ->
27+ (* the second file ended too *)
28+ ()
29+ in
30+ loop () ;
31+ close_in first;
32+ close_in second;
33+ (* we didn't find a difference, exit with a failure code *)
34+ prerr_endline " The files appear to be identical" ;
35+ exit 1
36+
37+ let () =
38+ main ()
Original file line number Diff line number Diff line change 3030
3131;; make sure the non-deterministic is different from the deterministic
3232
33+ (executable
34+ (name different)
35+ (modules different))
36+
3337(rule
3438 (alias runtest)
3539 (action
36- (with-accepted-exit-codes
37- 1
38- (ignore-stdout
39- (run diff %{dep:dune-mdx-nondeterministic.expected}
40- %{dep:dune-mdx-nondeterministic.nondeterministic})))))
40+ (run ./different.exe %{dep:dune-mdx-nondeterministic.expected}
41+ %{dep:dune-mdx-nondeterministic.nondeterministic})))
You can’t perform that action at this time.
0 commit comments