1 (* RUN: %ocamlc -warn-error A llvm.cma llvm_target.cma %s -o %t 2> /dev/null
4 (* Note: It takes several seconds for ocamlc to link an executable with
5 libLLVMCore.a, so it's better to write a big test than a bunch of
11 (* Tiny unit test framework - really just to help find which line is busted *)
13 prerr_endline (name ^ ":");
17 (*===-- Fixture -----------------------------------------------------------===*)
19 let filename = Sys.argv.(1)
20 let m = create_module (global_context ()) filename
23 (*===-- Target Data -------------------------------------------------------===*)
25 let test_target_data () =
26 let td = TargetData.create (target_triple m) in
27 let sty = struct_type (global_context ()) [| i32_type; i64_type |] in
29 ignore (TargetData.as_string td);
30 ignore (TargetData.invalidate_struct_layout td sty);
31 ignore (byte_order td);
32 ignore (pointer_size td);
33 ignore (intptr_type td);
34 ignore (size_in_bits td sty);
35 ignore (store_size td sty);
36 ignore (abi_size td sty);
37 ignore (stack_align td sty);
38 ignore (preferred_align td sty);
39 ignore (preferred_align_of_global td (declare_global sty "g" m));
40 ignore (element_at_offset td sty (Int64.of_int 1));
41 ignore (offset_of_element td sty 1);
46 (*===-- Driver ------------------------------------------------------------===*)
49 suite "target data" test_target_data;