summaryrefslogtreecommitdiff
path: root/testsuite/tests/backtrace/pr2195.ml
blob: e45ea55d90c6179fc864815486ba43bd550ca93d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
(* TEST_BELOW
(* Blank lines added here to preserve locations. *)













*)

let () =
  Printexc.record_backtrace true;
  let c = open_out "foo" in
  close_out c;
  try
    while true do
      open_in "foo" |> ignore
    done
  with Sys_error _ ->
    (* The message is platform-specific, so convert the exception to Exit *)
    let bt = Printexc.get_raw_backtrace () in
    Printexc.raise_with_backtrace Exit bt

(* TEST
 flags += "-g";
 exit_status = "2";
 {
   ocamlrunparam += ",b=0";
   reference = "${test_source_directory}/pr2195-nolocs.byte.reference";
   bytecode;
 }{
   ocamlrunparam += ",b=1";
   reference = "${test_source_directory}/pr2195-nolocs.byte.reference";
   bytecode;
 }{
   ocamlrunparam += ",b=2";
   reference = "${test_source_directory}/pr2195-locs.byte.reference";
   bytecode;
 }{
   reference = "${test_source_directory}/pr2195.opt.reference";
   compare_programs = "false";
   native;
 }
*)