110 lines
3.8 KiB
Diff
110 lines
3.8 KiB
Diff
From: Simon McVittie <smcv@debian.org>
|
|
Date: Thu, 31 Mar 2016 18:29:44 +0100
|
|
Subject: libtest.sh: use G_TEST_SRCDIR, G_TEST_BUILDDIR to find resources
|
|
|
|
This fixes the bug that in installed-tests that run testlib.sh under
|
|
"bash -c" (i.e. the C and JS tests), $(dirname $0) is "." and we can't do
|
|
the LD_PRELOAD correctly:
|
|
|
|
ERROR: ld.so: object './libreaddir-rand.so' from LD_PRELOAD cannot be
|
|
preloaded (cannot open shared object file): ignored.
|
|
|
|
Similarly, those tests can't copy gpghome correctly.
|
|
|
|
This also removes the confusing situation that SRCDIR in libtest.sh
|
|
(which is ${top_srcdir}/tests) does not mean the same thing as SRCDIR
|
|
in test-abi.sh (which is just ${top_srcdir}).
|
|
|
|
Signed-off-by: Simon McVittie <smcv@debian.org>
|
|
Applied-upstream: 2016.5, commit:https://github.com/ostreedev/ostree/commit/efb86ba9d32a038dd90f47f6e82f578e91b5fef5
|
|
---
|
|
tests/libtest.sh | 18 ++++++++++++++----
|
|
tests/test-archivez.sh | 2 +-
|
|
tests/test-delta.sh | 4 ++--
|
|
tests/test-pull-archive-z.sh | 2 +-
|
|
4 files changed, 18 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/tests/libtest.sh b/tests/libtest.sh
|
|
index 3e4c4bd..f588e65 100755
|
|
--- a/tests/libtest.sh
|
|
+++ b/tests/libtest.sh
|
|
@@ -17,7 +17,17 @@
|
|
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
# Boston, MA 02111-1307, USA.
|
|
|
|
-SRCDIR=$(dirname $0)
|
|
+if [ -n "${G_TEST_SRCDIR:-}" ]; then
|
|
+ test_srcdir="${G_TEST_SRCDIR}/tests"
|
|
+else
|
|
+ test_srcdir=$(dirname $0)
|
|
+fi
|
|
+
|
|
+if [ -n "${G_TEST_BUILDDIR:-}" ]; then
|
|
+ test_builddir="${G_TEST_BUILDDIR}/tests"
|
|
+else
|
|
+ test_builddir=$(dirname $0)
|
|
+fi
|
|
|
|
assert_not_reached () {
|
|
echo $@ 1>&2; exit 1
|
|
@@ -54,7 +64,7 @@ export TEST_GPG_KEYID_3="DF444D67"
|
|
# homedir in order to create lockfiles. Work around
|
|
# this by copying locally.
|
|
echo "Copying gpghome to ${test_tmpdir}"
|
|
-cp -a ${SRCDIR}/gpghome ${test_tmpdir}
|
|
+cp -a "${test_srcdir}/gpghome" ${test_tmpdir}
|
|
export TEST_GPG_KEYHOME=${test_tmpdir}/gpghome
|
|
export OSTREE_GPG_HOME=${test_tmpdir}/gpghome/trusted
|
|
|
|
@@ -63,9 +73,9 @@ if test -n "${OT_TESTS_DEBUG:-}"; then
|
|
fi
|
|
|
|
if test -n "${OT_TESTS_VALGRIND:-}"; then
|
|
- CMD_PREFIX="env G_SLICE=always-malloc valgrind -q --leak-check=full --num-callers=30 --suppressions=${SRCDIR}/ostree-valgrind.supp"
|
|
+ CMD_PREFIX="env G_SLICE=always-malloc valgrind -q --leak-check=full --num-callers=30 --suppressions=${test_srcdir}/ostree-valgrind.supp"
|
|
else
|
|
- CMD_PREFIX="env LD_PRELOAD=${SRCDIR}/libreaddir-rand.so"
|
|
+ CMD_PREFIX="env LD_PRELOAD=${test_builddir}/libreaddir-rand.so"
|
|
fi
|
|
|
|
assert_streq () {
|
|
diff --git a/tests/test-archivez.sh b/tests/test-archivez.sh
|
|
index 999157d..b879328 100755
|
|
--- a/tests/test-archivez.sh
|
|
+++ b/tests/test-archivez.sh
|
|
@@ -25,7 +25,7 @@ echo '1..11'
|
|
|
|
setup_test_repository "archive-z2"
|
|
|
|
-. ${SRCDIR}/archive-test.sh
|
|
+. ${test_srcdir}/archive-test.sh
|
|
|
|
cd ${test_tmpdir}
|
|
mkdir repo2
|
|
diff --git a/tests/test-delta.sh b/tests/test-delta.sh
|
|
index a6fd6f8..411e9b0 100755
|
|
--- a/tests/test-delta.sh
|
|
+++ b/tests/test-delta.sh
|
|
@@ -130,9 +130,9 @@ assert_streq "${totalsize_orig}" "${totalsize_swapped}"
|
|
|
|
echo 'ok generate + show endian swapped'
|
|
|
|
-tar xf ${SRCDIR}/pre-endian-deltas-repo-big.tar.xz
|
|
+tar xf ${test_srcdir}/pre-endian-deltas-repo-big.tar.xz
|
|
mv pre-endian-deltas-repo{,-big}
|
|
-tar xf ${SRCDIR}/pre-endian-deltas-repo-little.tar.xz
|
|
+tar xf ${test_srcdir}/pre-endian-deltas-repo-little.tar.xz
|
|
mv pre-endian-deltas-repo{,-little}
|
|
legacy_origrev=$(${CMD_PREFIX} ostree --repo=pre-endian-deltas-repo-big rev-parse main^)
|
|
legacy_newrev=$(${CMD_PREFIX} ostree --repo=pre-endian-deltas-repo-big rev-parse main)
|
|
diff --git a/tests/test-pull-archive-z.sh b/tests/test-pull-archive-z.sh
|
|
index 2ea2387..66f8873 100755
|
|
--- a/tests/test-pull-archive-z.sh
|
|
+++ b/tests/test-pull-archive-z.sh
|
|
@@ -23,4 +23,4 @@ set -euo pipefail
|
|
|
|
setup_fake_remote_repo1 "archive-z2"
|
|
|
|
-. ${SRCDIR}/pull-test.sh
|
|
+. ${test_srcdir}/pull-test.sh
|