[llvm-commits] [PATCH] test/ shlibdir-aware

NAKAMURA Takumi geek4civic at gmail.com
Tue Aug 31 14:47:53 PDT 2010


Good September! (in here)

With ENABLE_SHARED on win32, DLL files are located not to lib but bin.
Some of tests assume modules might be in %llvmlibsdir.

My patch provides %llvmshlibdir to let some tests pass on Cygwin and Mingw.
Please review mine.

TODO:
I don't have CMake environments yet.

Known issue:
BugpointPasses.dll and LLVMHello.dll might be rebased explicitly.


...Takumi
-------------- next part --------------
diff --git a/test/Analysis/Profiling/profiling-tool-chain.ll b/test/Analysis/Profiling/profiling-tool-chain.ll
index 5ac31b5..ad2dd13 100644
--- a/test/Analysis/Profiling/profiling-tool-chain.ll
+++ b/test/Analysis/Profiling/profiling-tool-chain.ll
@@ -9,8 +9,8 @@
 
 ; Test the creation, reading and displaying of profile
 ; RUX: rm -f llvmprof.out
-; RUX: lli -load %llvmlibsdir/profile_rt%shlibext %t2
-; RUX: lli -load %llvmlibsdir/profile_rt%shlibext %t2 1 2
+; RUX: lli -load %llvmshlisdir/profile_rt%shlibext %t2
+; RUX: lli -load %llvmshlisdir/profile_rt%shlibext %t2 1 2
 ; RUX: llvm-prof -print-all-code %t1 | FileCheck --check-prefix=PROF %s
 
 ; Test the loaded profile also with verifier.
diff --git a/test/BugPoint/crash-narrowfunctiontest.ll b/test/BugPoint/crash-narrowfunctiontest.ll
index 18a31eb..df0b07f 100644
--- a/test/BugPoint/crash-narrowfunctiontest.ll
+++ b/test/BugPoint/crash-narrowfunctiontest.ll
@@ -1,7 +1,7 @@
 ; Test that bugpoint can narrow down the testcase to the important function
 ; FIXME: This likely fails on windows
 ;
-; RUN: bugpoint -load %llvmlibsdir/BugpointPasses%shlibext %s -output-prefix %t -bugpoint-crashcalls -silence-passes > /dev/null
+; RUN: bugpoint -load %llvmshlibdir/BugpointPasses%shlibext %s -output-prefix %t -bugpoint-crashcalls -silence-passes > /dev/null
 ; XFAIL: mingw
 
 define i32 @foo() { ret i32 1 }
diff --git a/test/BugPoint/metadata.ll b/test/BugPoint/metadata.ll
index f2541ee..eda234a 100644
--- a/test/BugPoint/metadata.ll
+++ b/test/BugPoint/metadata.ll
@@ -1,4 +1,4 @@
-; RUN: bugpoint -load %llvmlibsdir/BugpointPasses%shlibext %s -output-prefix %t -bugpoint-crashcalls -silence-passes > /dev/null
+; RUN: bugpoint -load %llvmshlibdir/BugpointPasses%shlibext %s -output-prefix %t -bugpoint-crashcalls -silence-passes > /dev/null
 ; RUN: llvm-dis %t-reduced-simplified.bc -o - | FileCheck %s
 ; XFAIL: mingw
 
diff --git a/test/BugPoint/remove_arguments_test.ll b/test/BugPoint/remove_arguments_test.ll
index 791ec69..bed4c02 100644
--- a/test/BugPoint/remove_arguments_test.ll
+++ b/test/BugPoint/remove_arguments_test.ll
@@ -1,5 +1,5 @@
 ; FIXME: This likely fails on windows
-; RUN: bugpoint -load %llvmlibsdir/BugpointPasses%shlibext %s -output-prefix %t -bugpoint-crashcalls -silence-passes
+; RUN: bugpoint -load %llvmshlibdir/BugpointPasses%shlibext %s -output-prefix %t -bugpoint-crashcalls -silence-passes
 ; RUN: llvm-dis %t-reduced-simplified.bc -o - | FileCheck %s
 ; XFAIL: mingw
 
diff --git a/test/Feature/load_module.ll b/test/Feature/load_module.ll
index e2e222f..11eb6fe 100644
--- a/test/Feature/load_module.ll
+++ b/test/Feature/load_module.ll
@@ -1,5 +1,5 @@
 ; PR1318
-; RUN: opt < %s -load=%llvmlibsdir/LLVMHello%shlibext -hello \
+; RUN: opt < %s -load=%llvmshlibdir/LLVMHello%shlibext -hello \
 ; RUN:   -disable-output |& grep Hello
 
 @junk = global i32 0
diff --git a/test/Makefile b/test/Makefile
index 7ca46be..bd46b1d 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -138,6 +138,7 @@ site.exp: FORCE
 	@echo 'set llvmgcc_langs "$(LLVMGCC_LANGS)"' >> site.tmp
 	@echo 'set llvmtoolsdir "$(ToolDir)"' >>site.tmp
 	@echo 'set llvmlibsdir "$(LibDir)"' >>site.tmp
+	@echo 'set llvmshlibdir "$(SharedLibDir)"' >>site.tmp
 	@echo 'set llvm_bindings "$(BINDINGS_TO_BUILD)"' >> site.tmp
 	@echo 'set srcroot "$(LLVM_SRC_ROOT)"' >>site.tmp
 	@echo 'set objroot "$(LLVM_OBJ_ROOT)"' >>site.tmp
@@ -180,6 +181,7 @@ Unit/lit.site.cfg: $(PROJ_OBJ_DIR)/Unit/.dir FORCE
 	     -e "s#@LLVMGCCDIR@#$(LLVMGCCDIR)#g" \
 	     -e "s#@LLVM_BUILD_MODE@#$(BuildMode)#g" \
 	     -e "s#@ENABLE_SHARED@#$(ENABLE_SHARED)#g" \
+	     -e "s#@SHLIBDIR@#$(SharedLibDir)#g" \
 	     -e "s#@SHLIBPATH_VAR@#$(SHLIBPATH_VAR)#g" \
 	     $(PROJ_SRC_DIR)/Unit/lit.site.cfg.in > $@
 
diff --git a/test/Unit/lit.cfg b/test/Unit/lit.cfg
index 5fe0732..a41f093 100644
--- a/test/Unit/lit.cfg
+++ b/test/Unit/lit.cfg
@@ -25,11 +25,10 @@ config.test_format = lit.formats.GoogleTest(llvm_build_mode, 'Tests')
 
 # If necessary, point the dynamic loader at libLLVM.so.
 if config.enable_shared:
-    libdir = os.path.join(config.llvm_obj_root, config.llvm_build_mode, 'lib')
     shlibpath = config.environment.get(config.shlibpath_var,'')
     if shlibpath:
-        shlibpath = ':' + shlibpath
-    shlibpath = libdir + shlibpath
+        shlibpath = os.pathsep + shlibpath
+    shlibpath = config.shlibdir + shlibpath
     config.environment[config.shlibpath_var] = shlibpath
 
 # Check that the object root is known.
diff --git a/test/Unit/lit.site.cfg.in b/test/Unit/lit.site.cfg.in
index 51b5bc4..37de065 100644
--- a/test/Unit/lit.site.cfg.in
+++ b/test/Unit/lit.site.cfg.in
@@ -6,6 +6,7 @@ config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
 config.llvmgcc_dir = "@LLVMGCCDIR@"
 config.llvm_build_mode = "@LLVM_BUILD_MODE@"
 config.enable_shared = @ENABLE_SHARED@
+config.shlibdir = "@SHLIBDIR@"
 config.shlibpath_var = "@SHLIBPATH_VAR@"
 
 # Let the main config do the real work.
diff --git a/test/lit.cfg b/test/lit.cfg
index f15777c..0db6d1e 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -126,7 +126,8 @@ for line in open(os.path.join(config.llvm_obj_root, 'test', 'site.exp')):
 # Add substitutions.
 config.substitutions.append(('%llvmgcc_only', site_exp['llvmgcc']))
 for sub in ['llvmgcc', 'llvmgxx', 'compile_cxx', 'compile_c',
-            'link', 'shlibext', 'ocamlopt', 'llvmdsymutil', 'llvmlibsdir',
+            'link', 'ocamlopt', 'llvmdsymutil', 'llvmlibsdir',
+            'llvmshlibdir', 'shlibext',
             'bugpoint_topts']:
     if sub in ('llvmgcc', 'llvmgxx'):
         config.substitutions.append(('%' + sub,


More information about the llvm-commits mailing list