[OCaml] [autoconf] Migrate to ocamlfind.
[oota-llvm.git] / test / lit.cfg
index 294d37bc39173328a7e344a208bd84f0cc42a9e3..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",
@@ -274,7 +292,8 @@ else:
     config.available_features.add("not_ubsan")
 
 # Direct object generation
-if not 'hexagon' in config.target_triple:
+# Suppress x86_64-mingw32 while investigating since r219108.
+if not 'hexagon' in config.target_triple and not re.match(r'^x86_64.*-(mingw32|win32)', config.target_triple):
     config.available_features.add("object-emission")
 
 if config.have_zlib == "1":
@@ -313,7 +332,8 @@ if have_ld_plugin_support():
 try:
     llvm_config_cmd = subprocess.Popen(
         [os.path.join(llvm_tools_dir, 'llvm-config'), '--assertion-mode'],
-        stdout = subprocess.PIPE)
+        stdout = subprocess.PIPE,
+        env=config.environment)
 except OSError:
     print("Could not find llvm-config in " + llvm_tools_dir)
     exit(42)