[OCaml] Run tests twice, with ocamlc and ocamlopt (if available)
authorPeter Zotov <whitequark@whitequark.org>
Mon, 3 Nov 2014 09:50:53 +0000 (09:50 +0000)
committerPeter Zotov <whitequark@whitequark.org>
Mon, 3 Nov 2014 09:50:53 +0000 (09:50 +0000)
ocamlc and ocamlopt expose a distinct set of buildsystem bugs, e.g.
only ocamlc would detect -custom or -dllib-related bugs, and as all
buildbots will have ocamlopt, these bugs will stay hidden.

This change should add no more than 30 seconds of testing time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221137 91177308-0d34-0410-b5e6-96231b3b80d8

14 files changed:
test/Bindings/OCaml/analysis.ml
test/Bindings/OCaml/bitreader.ml
test/Bindings/OCaml/bitwriter.ml
test/Bindings/OCaml/core.ml
test/Bindings/OCaml/executionengine.ml
test/Bindings/OCaml/ext_exc.ml
test/Bindings/OCaml/ipo.ml
test/Bindings/OCaml/irreader.ml
test/Bindings/OCaml/linker.ml
test/Bindings/OCaml/passmgr_builder.ml
test/Bindings/OCaml/scalar_opts.ml
test/Bindings/OCaml/target.ml
test/Bindings/OCaml/vectorize.ml
test/lit.cfg

index 68d5d65e1223583f2826d5e3cbb9ea495c6c199c..e935ee838058da06571edc6a7e4ecd38d7f38d22 100644 (file)
@@ -1,5 +1,7 @@
 (* RUN: cp %s %T/analysis.ml
- * RUN: %ocamlcomp -g -warn-error A -package llvm.analysis -linkpkg %T/analysis.ml -o %t
+ * RUN: %ocamlc -g -warn-error A -package llvm.analysis -linkpkg %T/analysis.ml -o %t
+ * RUN: %t
+ * RUN: %ocamlopt -g -warn-error A -package llvm.analysis -linkpkg %T/analysis.ml -o %t
  * RUN: %t
  * XFAIL: vg_leak
  *)
index 81db5431aefa2f6077212cd67cc0c19118fae5bc..57cfd043b2de2df22420f39a4cb4867cb67fa5e1 100644 (file)
@@ -1,5 +1,7 @@
 (* RUN: cp %s %T/bitreader.ml
- * RUN: %ocamlcomp -g -warn-error A -package llvm.bitreader -package llvm.bitwriter -linkpkg %T/bitreader.ml -o %t
+ * RUN: %ocamlc -g -warn-error A -package llvm.bitreader -package llvm.bitwriter -linkpkg %T/bitreader.ml -o %t
+ * RUN: %t %t.bc
+ * RUN: %ocamlopt -g -warn-error A -package llvm.bitreader -package llvm.bitwriter -linkpkg %T/bitreader.ml -o %t
  * RUN: %t %t.bc
  * RUN: llvm-dis < %t.bc
  * XFAIL: vg_leak
index 5d77b83bd6eb00106840ee14f68d19609699b969..7c803f6d5510f2548ad260c88251ae0aa4d69893 100644 (file)
@@ -1,5 +1,7 @@
 (* RUN: cp %s %T/bitwriter.ml
- * RUN: %ocamlcomp -g -warn-error A -package llvm.bitreader -package llvm.bitwriter -linkpkg %T/bitwriter.ml -o %t
+ * RUN: %ocamlc -g -w -3 -warn-error A -package llvm.bitreader -package llvm.bitwriter -linkpkg %T/bitwriter.ml -o %t
+ * RUN: %t %t.bc
+ * RUN: %ocamlopt -g -w -3 -warn-error A -package llvm.bitreader -package llvm.bitwriter -linkpkg %T/bitwriter.ml -o %t
  * RUN: %t %t.bc
  * RUN: llvm-dis < %t.bc
  * XFAIL: vg_leak
index 087f9d35b87c21b835d3388bfb165bd7d752a593..c08351ec234b07a220d4c4c5674448122f299b48 100644 (file)
@@ -1,5 +1,7 @@
-(* RUN: cp %s %T/vmcore.ml
- * RUN: %ocamlcomp -g -warn-error A -package llvm.analysis -package llvm.bitwriter -linkpkg %T/vmcore.ml -o %t
+(* RUN: cp %s %T/core.ml
+ * RUN: %ocamlc -g -warn-error A -package llvm.analysis -package llvm.bitwriter -linkpkg %T/core.ml -o %t
+ * RUN: %t %t.bc
+ * RUN: %ocamlopt -g -warn-error A -package llvm.analysis -package llvm.bitwriter -linkpkg %T/core.ml -o %t
  * RUN: %t %t.bc
  * RUN: llvm-dis < %t.bc > %t.ll
  * RUN: FileCheck %s < %t.ll
index 9f1b74f8ee09e726d287a1b9ee550e6a7483fcfc..893f98887645a65029c15630892582832dc0fe74 100644 (file)
@@ -1,5 +1,7 @@
 (* RUN: cp %s %T/executionengine.ml
- * RUN: %ocamlcomp -g -warn-error A -package llvm.executionengine -linkpkg %T/executionengine.ml -o %t
+ * RUN: %ocamlc -g -warn-error A -package llvm.executionengine -linkpkg %T/executionengine.ml -o %t
+ * RUN: %t
+ * RUN: %ocamlopt -g -warn-error A -package llvm.executionengine -linkpkg %T/executionengine.ml -o %t
  * RUN: %t
  * REQUIRES: native, object-emission
  * XFAIL: vg_leak
index 7d40c2847a61e2b629cdb1d7bf75020460c53419..2b44803f517032f538c27fdba1ec1bb6b36f83ad 100644 (file)
@@ -1,5 +1,7 @@
 (* RUN: cp %s %T/ext_exc.ml
- * RUN: %ocamlcomp -g -warn-error A -package llvm.bitreader -linkpkg %T/ext_exc.ml -o %t
+ * RUN: %ocamlc -g -warn-error A -package llvm.bitreader -linkpkg %T/ext_exc.ml -o %t
+ * RUN: %t
+ * RUN: %ocamlopt -g -warn-error A -package llvm.bitreader -linkpkg %T/ext_exc.ml -o %t
  * RUN: %t
  * XFAIL: vg_leak
  *)
index e395424d334c311407cfecf3adb6165660507e0b..fc728b92ff3d6c8dde1a1511a43515775aaf2895 100644 (file)
@@ -1,5 +1,7 @@
 (* RUN: cp %s %T/ipo_opts.ml
- * RUN: %ocamlcomp -g -warn-error A -package llvm.ipo -linkpkg %T/ipo_opts.ml -o %t
+ * RUN: %ocamlc -g -warn-error A -package llvm.ipo -linkpkg %T/ipo_opts.ml -o %t
+ * RUN: %t %t.bc
+ * RUN: %ocamlopt -g -warn-error A -package llvm.ipo -linkpkg %T/ipo_opts.ml -o %t
  * RUN: %t %t.bc
  * XFAIL: vg_leak
  *)
index a64e01a40133e41ca47130f31d2a314396c94a3d..e1771e75dd49c895e70c8a14b5d7c833d60eef5c 100644 (file)
@@ -1,5 +1,7 @@
 (* RUN: cp %s %T/irreader.ml
- * RUN: %ocamlcomp -g -warn-error A -package llvm.irreader -linkpkg %T/irreader.ml -o %t
+ * RUN: %ocamlc -g -warn-error A -package llvm.irreader -linkpkg %T/irreader.ml -o %t
+ * RUN: %t
+ * RUN: %ocamlopt -g -warn-error A -package llvm.irreader -linkpkg %T/irreader.ml -o %t
  * RUN: %t
  * XFAIL: vg_leak
  *)
index 6ec87bfc5c2db07ac7949343d6f99c89bad5cbda..00064b0ba926eb8477b66a6f51d8b159935a2614 100644 (file)
@@ -1,5 +1,7 @@
 (* RUN: cp %s %T/linker.ml
- * RUN: %ocamlcomp -g -warn-error A -package llvm.linker -linkpkg %T/linker.ml -o %t
+ * RUN: %ocamlc -g -warn-error A -package llvm.linker -linkpkg %T/linker.ml -o %t
+ * RUN: %t
+ * RUN: %ocamlopt -g -warn-error A -package llvm.linker -linkpkg %T/linker.ml -o %t
  * RUN: %t
  * XFAIL: vg_leak
  *)
index cc8e9fcb0d0a92103fe8f87ed5d5a27f82b45984..5dd9d4e00e89bb953f04a5520d4aa59215d96357 100644 (file)
@@ -1,5 +1,7 @@
 (* RUN: cp %s %T/passmgr_builder.ml
- * RUN: %ocamlcomp -g -warn-error A -package llvm.passmgr_builder -linkpkg %T/passmgr_builder.ml -o %t
+ * RUN: %ocamlc -g -warn-error A -package llvm.passmgr_builder -linkpkg %T/passmgr_builder.ml -o %t
+ * RUN: %t %t.bc
+ * RUN: %ocamlopt -g -warn-error A -package llvm.passmgr_builder -linkpkg %T/passmgr_builder.ml -o %t
  * RUN: %t %t.bc
  * XFAIL: vg_leak
  *)
index c3b4f6673ee93caf5ebf13bd847eb4430de1f3f0..3017fb131129f13bee5e9e86ab195baa35614133 100644 (file)
@@ -1,5 +1,7 @@
 (* RUN: cp %s %T/scalar_opts.ml
- * RUN: %ocamlcomp -g -warn-error A -package llvm.scalar_opts -linkpkg %T/scalar_opts.ml -o %t
+ * RUN: %ocamlc -g -warn-error A -package llvm.scalar_opts -linkpkg %T/scalar_opts.ml -o %t
+ * RUN: %t %t.bc
+ * RUN: %ocamlopt -g -warn-error A -package llvm.scalar_opts -linkpkg %T/scalar_opts.ml -o %t
  * RUN: %t %t.bc
  * XFAIL: vg_leak
  *)
index e532ad55ebf3ebf6557554af79b631a066e1de41..41faefa8ea680be9315733ebc5f47457c18d2558 100644 (file)
@@ -1,5 +1,6 @@
 (* RUN: cp %s %T/target.ml
- * RUN: %ocamlcomp -g -warn-error A -package llvm.target -package llvm.all_backends -linkpkg %T/target.ml -o %t
+ * RUN: %ocamlc -g -warn-error A -package llvm.target -package llvm.all_backends -linkpkg %T/target.ml -o %t
+ * RUN: %ocamlopt -g -warn-error A -package llvm.target -package llvm.all_backends -linkpkg %T/target.ml -o %t
  * RUN: %t %t.bc
  * XFAIL: vg_leak
  *)
index 536adac8c333f31ad80b4733d0695b9f64a4b9df..c5b03b525375403954c6ef01cbfba482b7151f58 100644 (file)
@@ -1,5 +1,7 @@
 (* RUN: cp %s %T/vectorize_opts.ml
- * RUN: %ocamlcomp -g -warn-error A -package llvm.vectorize -linkpkg %T/vectorize_opts.ml -o %t
+ * RUN: %ocamlc -g -warn-error A -package llvm.vectorize -linkpkg %T/vectorize_opts.ml -o %t
+ * RUN: %t %t.bc
+ * RUN: %ocamlopt -g -warn-error A -package llvm.vectorize -linkpkg %T/vectorize_opts.ml -o %t
  * RUN: %t %t.bc
  * XFAIL: vg_leak
  *)
index 335b86dae7d980025687e28ad00ccc9c46111ddd..67c9bbae744e59a69d1c699d3932c07234f86dde 100644 (file)
@@ -102,13 +102,22 @@ for options in ['ASAN_OPTIONS', 'UBSAN_OPTIONS']:
 
 # Set up OCAMLPATH to include newly built OCaml libraries.
 llvm_lib_dir = getattr(config, 'llvm_lib_dir', None)
-if llvm_lib_dir: # empty llvm_lib_dir is falsey, reads as None
-    llvm_ocaml_lib = os.path.join(llvm_lib_dir, 'ocaml')
-    if 'OCAMLPATH' in os.environ:
-        ocamlpath = os.path.pathsep.join((llvm_ocaml_lib, os.environ['OCAMLPATH']))
-        config.environment['OCAMLPATH'] = ocamlpath
-    else:
-        config.environment['OCAMLPATH'] = llvm_ocaml_lib
+if not llvm_lib_dir:
+    llvm_lib_dir = os.path.join(getattr(config, 'llvm_obj_root', None), 'lib')
+
+llvm_ocaml_lib = os.path.join(llvm_lib_dir, 'ocaml')
+if 'OCAMLPATH' in os.environ:
+    ocamlpath = os.path.pathsep.join((llvm_ocaml_lib, os.environ['OCAMLPATH']))
+    config.environment['OCAMLPATH'] = ocamlpath
+else:
+    config.environment['OCAMLPATH'] = llvm_ocaml_lib
+
+if 'CAML_LD_LIBRARY_PATH' in os.environ:
+    caml_ld_library_path = os.path.pathsep.join((llvm_ocaml_lib,
+                                os.environ['CAML_LD_LIBRARY_PATH']))
+    config.environment['CAML_LD_LIBRARY_PATH'] = caml_ld_library_path
+else:
+    config.environment['CAML_LD_LIBRARY_PATH'] = caml_ld_library_path
 
 # Set up OCAMLRUNPARAM to enable backtraces in OCaml tests.
 config.environment['OCAMLRUNPARAM'] = 'b'
@@ -188,12 +197,13 @@ config.substitutions.append( ('%python', config.python_executable) )
 
 # OCaml substitutions.
 # Support tests for both native and bytecode builds.
-if config.have_ocamlopt == '1':
-    config.substitutions.append( ('%ocamlcomp',
+config.substitutions.append( ('%ocamlc',
+    "%s ocamlc %s" % (config.ocamlfind_executable, config.ocaml_flags)) )
+if config.have_ocamlopt in ('1', 'TRUE'):
+    config.substitutions.append( ('%ocamlopt',
         "%s ocamlopt %s" % (config.ocamlfind_executable, config.ocaml_flags)) )
 else:
-    config.substitutions.append( ('%ocamlcomp',
-        "%s ocamlc %s" % (config.ocamlfind_executable, config.ocaml_flags)) )
+    config.substitutions.append( ('%ocamlopt', "true" ) )
 
 # For each occurrence of an llvm tool name as its own word, replace it
 # with the full path to the build directory holding that tool.  This