aboutsummaryrefslogtreecommitdiffstats
path: root/test/Bindings/Ocaml/bitwriter.ml
blob: 57caac7cb97d3241c1bacb829510f56ef5cdf9a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
(* RUN: %ocamlopt -warn-error A llvm.cmxa llvm_bitwriter.cmxa %s -o %t
 * RUN: ./%t %t.bc
 * RUN: llvm-dis < %t.bc | grep caml_int_ty
 *)

(* Note that this takes a moment to link, so it's best to keep the number of
   individual tests low. *)

let context = Llvm.global_context ()

let test x = if not x then exit 1 else ()

let _ =
  let m = Llvm.create_module context "ocaml_test_module" in
  
  ignore (Llvm.define_type_name "caml_int_ty" (Llvm.i32_type context) m);
  
  test (Llvm_bitwriter.write_bitcode_file m Sys.argv.(1))