IR: Metadata: Remove unnecessary dyn_cast
[oota-llvm.git] / test / lit.cfg
index 63880d0dac78965705365f1b5494332dafbff114..40ee8dd7299d1e7b50ceb080007bea611391587a 100644 (file)
@@ -95,10 +95,30 @@ for symbolizer in ['ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH']:
     if symbolizer in os.environ:
         config.environment[symbolizer] = os.environ[symbolizer]
 
-# Propagate options for sanitizers.
-for options in ['ASAN_OPTIONS', 'UBSAN_OPTIONS']:
-    if options in os.environ:
-        config.environment[options] = os.environ[options]
+# Set up OCAMLPATH to include newly built OCaml libraries.
+llvm_lib_dir = getattr(config, 'llvm_lib_dir', None)
+if llvm_lib_dir is None:
+    if llvm_obj_root is not None:
+        llvm_lib_dir = os.path.join(llvm_obj_root, 'lib')
+
+if llvm_lib_dir is not None:
+    llvm_ocaml_lib = os.path.join(llvm_lib_dir, 'ocaml')
+    if llvm_ocaml_lib is not None:
+        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'] = llvm_ocaml_lib
+
+# Set up OCAMLRUNPARAM to enable backtraces in OCaml tests.
+config.environment['OCAMLRUNPARAM'] = 'b'
 
 ###
 
@@ -175,14 +195,14 @@ config.substitutions.append( ('%python', config.python_executable) )
 
 # OCaml substitutions.
 # Support tests for both native and bytecode builds.
-if config.ocamlopt_executable != "":
-    config.substitutions.append( ('%ocamlcomp',
-        "%s %s" % (config.ocamlopt_executable, config.ocaml_flags)) )
-    config.substitutions.append( ('%cma', 'cmxa') )
+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 -cclib -L%s -cclib -Wl,-rpath,%s %s" %
+            (config.ocamlfind_executable, llvm_lib_dir, llvm_lib_dir, config.ocaml_flags)) )
 else:
-    config.substitutions.append( ('%ocamlcomp',
-        "%s %s" % (config.ocamlc_executable, config.ocaml_flags)) )
-    config.substitutions.append( ('%cma', 'cma') )
+    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