[OCaml] [autoconf] Migrate to ocamlfind.
[oota-llvm.git] / test / lit.cfg
index 323d3ce10d36615144591b25ac8bbb830277fe9c..4e9a5ad6efa015971d491c1693041a9d224ec027 100644 (file)
@@ -100,6 +100,14 @@ 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_ocaml_lib = os.path.join(getattr(config, 'llvm_lib_dir', None), '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
+
 ###
 
 import os
@@ -167,12 +175,21 @@ if re.search(r'win32', config.target_triple):
 config.substitutions.append( ('%llc_dwarf', llc_dwarf) )
 
 # Add site-specific substitutions.
-config.substitutions.append( ('%ocamlopt', config.ocamlopt_executable) )
+config.substitutions.append( ('%go', config.go_executable) )
 config.substitutions.append( ('%llvmshlibdir', config.llvm_shlib_dir) )
 config.substitutions.append( ('%shlibext', config.llvm_shlib_ext) )
 config.substitutions.append( ('%exeext', config.llvm_exe_ext) )
 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',
+        "%s ocamlopt %s" % (config.ocamlfind_executable, config.ocaml_flags)) )
+else:
+    config.substitutions.append( ('%ocamlcomp',
+        "%s ocamlc %s" % (config.ocamlfind_executable, config.ocaml_flags)) )
+
 # 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
 # ensures that we are testing the tools just built and not some random
@@ -199,6 +216,7 @@ for pattern in [r"\bbugpoint\b(?!-)",
                 r"\bllvm-dis\b",
                 r"\bllvm-dwarfdump\b",
                 r"\bllvm-extract\b",
+                r"\bllvm-go\b",
                 r"\bllvm-link\b",
                 r"\bllvm-lto\b",
                 r"\bllvm-mc\b",