diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2018-07-23 10:27:30 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2018-07-23 09:51:25 +0000 |
commit | f57fd0ba726d759b177665921392962672a8f026 (patch) | |
tree | 3acd1029406b2a613d0457e8178ae0a597b12ee1 | |
parent | 6c9d1873487aa6070cb16c8c40268cb9fcd33e9c (diff) |
On PE platforms, use PATH instead of LD_LIBRARY_PATH
The windows linker looks for .dll files in PATH. LD_LIBRARY_PATH doesn't
work. This reduces the amount of headache to be suffered when running the
test suite.
Change-Id: I94e73af46bf4a7b185158067db86a9c16f3690dd
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r-- | tests/Makefile.am | 7 | ||||
-rw-r--r-- | tests/test-subr.sh | 19 | ||||
-rwxr-xr-x | tests/test-wrapper.sh | 22 |
3 files changed, 40 insertions, 8 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index da78a57d..b280d793 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -407,6 +407,9 @@ if USE_VALGRIND valgrind_cmd='valgrind -q --leak-check=full --error-exitcode=1' endif +if NATIVE_PE +ld_uses_path=1 +endif installed_TESTS_ENVIRONMENT = libdir=$(DESTDIR)$(libdir); \ bindir=$(DESTDIR)$(bindir); \ @@ -415,9 +418,11 @@ installed_TESTS_ENVIRONMENT = libdir=$(DESTDIR)$(libdir); \ abs_srcdir=$(abs_srcdir); \ abs_builddir=$(abs_builddir); \ abs_top_builddir=$(abs_top_builddir); \ + ld_uses_path=$(ld_uses_path); \ export abs_srcdir; export abs_builddir; \ export abs_top_builddir; \ export libdir; export bindir; \ + export ld_uses_path; \ export LC_ALL; export LANG; export VALGRIND_CMD; \ NM=$(NM); export NM; installed_LOG_COMPILER = $(abs_srcdir)/test-wrapper.sh \ @@ -430,8 +435,10 @@ else !STANDALONE TESTS_ENVIRONMENT = LC_ALL=C; LANG=C; VALGRIND_CMD=$(valgrind_cmd); \ abs_srcdir=$(abs_srcdir); abs_builddir=$(abs_builddir); \ abs_top_builddir=$(abs_top_builddir); \ + ld_uses_path=$(ld_uses_path); \ export abs_srcdir; export abs_builddir; \ export abs_top_builddir; \ + export ld_uses_path; \ export LC_ALL; export LANG; export VALGRIND_CMD; \ NM=$(NM); export NM; LOG_COMPILER = $(abs_srcdir)/test-wrapper.sh \ diff --git a/tests/test-subr.sh b/tests/test-subr.sh index c8b279d8..d92fbca3 100644 --- a/tests/test-subr.sh +++ b/tests/test-subr.sh @@ -83,8 +83,13 @@ testrun() built_testrun() { - LD_LIBRARY_PATH="${built_library_path}${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"\ - $VALGRIND_CMD "$@" + if [ "$ld_uses_path" = 1 ]; then + PATH="${built_library_path}${PATH:+:}$PATH"\ + $VALGRIND_CMD "$@" + else + LD_LIBRARY_PATH="${built_library_path}${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"\ + $VALGRIND_CMD "$@" + fi } installed_testrun() @@ -103,9 +108,13 @@ installed_testrun() ;; esac if [ "${libdir}" != /usr/lib ] && [ "${libdir}" != /usr/lib64 ]; then - LD_LIBRARY_PATH="${libdir}:${libdir}/elfutils\ -${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH" \ - $VALGRIND_CMD $program ${1+"$@"} + if [ "$ld_uses_path" = 1 ]; then + PATH="${libdir}:${libdir}/elfutils ${PATH:+:}$PATH" \ + $VALGRIND_CMD $program ${1+"$@"} + else + LD_LIBRARY_PATH="${libdir}:${libdir}/elfutils ${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH" \ + $VALGRIND_CMD $program ${1+"$@"} + fi else $VALGRIND_CMD $program ${1+"$@"} fi diff --git a/tests/test-wrapper.sh b/tests/test-wrapper.sh index 09b4d49f..cb00c7fa 100755 --- a/tests/test-wrapper.sh +++ b/tests/test-wrapper.sh @@ -38,7 +38,11 @@ else elfutils_testrun=built fi +if [ "$ld_uses_path" = 1 ]; then +old_path="${PATH:+:}$PATH" +else old_path="${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH" +fi case "$1" in *.sh) @@ -47,14 +51,26 @@ case "$1" in ;; *) if [ $elfutils_testrun = built ]; then - LD_LIBRARY_PATH="$built_library_path$old_path" + if [ "$ld_uses_path" = 1 ]; then + PATH="$built_library_path$old_path" + else + LD_LIBRARY_PATH="$built_library_path$old_path" + fi elif [ $elfutils_tests_rpath = yes ]; then echo >&2 installcheck not possible with --enable-tests-rpath exit 77 elif [ "x$libdir" != x/usr/lib ] && [ "x$libdir" != x/usr/lib64 ]; then - LD_LIBRARY_PATH="${libdir}:${libdir}/elfutils$old_path" + if [ "$ld_uses_path" = 1 ]; then + PATH="${libdir}:${libdir}/elfutils$old_path" + else + LD_LIBRARY_PATH="${libdir}:${libdir}/elfutils$old_path" + fi + fi + if [ "$ld_uses_path" = 1 ]; then + export PATH + else + export LD_LIBRARY_PATH fi - export LD_LIBRARY_PATH ;; esac |