summaryrefslogtreecommitdiff
path: root/test/Bindings/Ocaml/target.ml
diff options
context:
space:
mode:
Diffstat (limited to 'test/Bindings/Ocaml/target.ml')
-rw-r--r--test/Bindings/Ocaml/target.ml11
1 files changed, 7 insertions, 4 deletions
diff --git a/test/Bindings/Ocaml/target.ml b/test/Bindings/Ocaml/target.ml
index e6d08ed6db75..3c3b7339fef8 100644
--- a/test/Bindings/Ocaml/target.ml
+++ b/test/Bindings/Ocaml/target.ml
@@ -1,13 +1,16 @@
-(* RUN: %ocamlc -warn-error A llvm.cma llvm_target.cma %s -o %t 2> /dev/null
+(* RUN: %ocamlopt -warn-error A llvm.cmxa llvm_target.cmxa %s -o %t
*)
-(* Note: It takes several seconds for ocamlc to link an executable with
+(* Note: It takes several seconds for ocamlopt to link an executable with
libLLVMCore.a, so it's better to write a big test than a bunch of
little ones. *)
open Llvm
open Llvm_target
+let context = global_context ()
+let i32_type = Llvm.i32_type context
+let i64_type = Llvm.i64_type context
(* Tiny unit test framework - really just to help find which line is busted *)
let suite name f =
@@ -18,14 +21,14 @@ let suite name f =
(*===-- Fixture -----------------------------------------------------------===*)
let filename = Sys.argv.(1)
-let m = create_module filename
+let m = create_module context filename
(*===-- Target Data -------------------------------------------------------===*)
let test_target_data () =
let td = TargetData.create (target_triple m) in
- let sty = struct_type [| i32_type; i64_type |] in
+ let sty = struct_type context [| i32_type; i64_type |] in
ignore (TargetData.as_string td);
ignore (TargetData.invalidate_struct_layout td sty);