[llvm] r194778 - [OCaml] Use native target in testsuite instead of hardcoding X86

Peter Zotov whitequark at whitequark.org
Thu Nov 14 19:19:08 PST 2013


Author: whitequark
Date: Thu Nov 14 21:19:08 2013
New Revision: 194778

URL: http://llvm.org/viewvc/llvm-project?rev=194778&view=rev
Log:
[OCaml] Use native target in testsuite instead of hardcoding X86

Modified:
    llvm/trunk/test/Bindings/Ocaml/lit.local.cfg
    llvm/trunk/test/Bindings/Ocaml/target.ml

Modified: llvm/trunk/test/Bindings/Ocaml/lit.local.cfg
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/Ocaml/lit.local.cfg?rev=194778&r1=194777&r2=194778&view=diff
==============================================================================
--- llvm/trunk/test/Bindings/Ocaml/lit.local.cfg (original)
+++ llvm/trunk/test/Bindings/Ocaml/lit.local.cfg Thu Nov 14 21:19:08 2013
@@ -3,4 +3,3 @@ config.suffixes = ['.ml']
 bindings = set([s.strip() for s in config.root.llvm_bindings.split(',')])
 if not 'ocaml' in bindings:
     config.unsupported = True
-

Modified: llvm/trunk/test/Bindings/Ocaml/target.ml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/Ocaml/target.ml?rev=194778&r1=194777&r2=194778&view=diff
==============================================================================
--- llvm/trunk/test/Bindings/Ocaml/target.ml (original)
+++ llvm/trunk/test/Bindings/Ocaml/target.ml Thu Nov 14 21:19:08 2013
@@ -1,7 +1,7 @@
 (* RUN: rm -rf %t.builddir
  * RUN: mkdir -p %t.builddir
  * RUN: cp %s %t.builddir
- * RUN: %ocamlopt -g -warn-error A llvm.cmxa llvm_target.cmxa llvm_X86.cmxa %t.builddir/target.ml -o %t
+ * RUN: %ocamlopt -g -warn-error A llvm.cmxa llvm_target.cmxa llvm_executionengine.cmxa %t.builddir/target.ml -o %t
  * RUN: %t %t.bc
  * XFAIL: vg_leak
  *)
@@ -13,7 +13,7 @@
 open Llvm
 open Llvm_target
 
-let _ = Llvm_X86.initialize ()
+let _ = Llvm_executionengine.initialize_native_target ()
 
 let context = global_context ()
 let i32_type = Llvm.i32_type context
@@ -34,13 +34,9 @@ let assert_equal a b =
 let filename = Sys.argv.(1)
 let m = create_module context filename
 
-let target =
-  match Target.by_name "x86" with
-  | Some t -> t
-  | None -> failwith "need a target"
+let target = Target.by_triple (Target.default_triple ())
 
-let machine =
-  TargetMachine.create ~triple:"i686-linux-gnu" ~cpu:"core2" target
+let machine = TargetMachine.create (Target.default_triple ()) target
 
 (*===-- Data Layout -------------------------------------------------------===*)
 
@@ -76,11 +72,11 @@ let test_target_data () =
 let test_target () =
   let module T = Target in
   ignore (T.succ target);
-  assert_equal (T.name target) "x86";
-  assert_equal (T.description target) "32-bit X86: Pentium-Pro and above";
-  assert_equal (T.has_jit target) true;
-  assert_equal (T.has_target_machine target) true;
-  assert_equal (T.has_asm_backend target) true
+  ignore (T.name target);
+  ignore (T.description target);
+  ignore (T.has_jit target);
+  ignore (T.has_target_machine target);
+  ignore (T.has_asm_backend target)
 
 
 (*===-- Target Machine ----------------------------------------------------===*)
@@ -88,8 +84,8 @@ let test_target () =
 let test_target_machine () =
   let module TM = TargetMachine in
   assert_equal (TM.target machine) target;
-  assert_equal (TM.triple machine) "i686-linux-gnu";
-  assert_equal (TM.cpu machine) "core2";
+  assert_equal (TM.triple machine) (Target.default_triple ());
+  assert_equal (TM.cpu machine) "";
   assert_equal (TM.features machine) "";
   ignore (TM.data_layout machine)
 





More information about the llvm-commits mailing list