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>
Closes: #234
Approved by: cgwalters
This commit is contained in:
parent
bdf24cdc04
commit
efb86ba9d3
|
|
@ -17,7 +17,17 @@
|
||||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
# Boston, MA 02111-1307, USA.
|
# 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 () {
|
assert_not_reached () {
|
||||||
echo $@ 1>&2; exit 1
|
echo $@ 1>&2; exit 1
|
||||||
|
|
@ -54,7 +64,7 @@ export TEST_GPG_KEYID_3="DF444D67"
|
||||||
# homedir in order to create lockfiles. Work around
|
# homedir in order to create lockfiles. Work around
|
||||||
# this by copying locally.
|
# this by copying locally.
|
||||||
echo "Copying gpghome to ${test_tmpdir}"
|
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 TEST_GPG_KEYHOME=${test_tmpdir}/gpghome
|
||||||
export OSTREE_GPG_HOME=${test_tmpdir}/gpghome/trusted
|
export OSTREE_GPG_HOME=${test_tmpdir}/gpghome/trusted
|
||||||
|
|
||||||
|
|
@ -63,9 +73,9 @@ if test -n "${OT_TESTS_DEBUG:-}"; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -n "${OT_TESTS_VALGRIND:-}"; then
|
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
|
else
|
||||||
CMD_PREFIX="env LD_PRELOAD=${SRCDIR}/libreaddir-rand.so"
|
CMD_PREFIX="env LD_PRELOAD=${test_builddir}/libreaddir-rand.so"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
assert_streq () {
|
assert_streq () {
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ echo '1..11'
|
||||||
|
|
||||||
setup_test_repository "archive-z2"
|
setup_test_repository "archive-z2"
|
||||||
|
|
||||||
. ${SRCDIR}/archive-test.sh
|
. ${test_srcdir}/archive-test.sh
|
||||||
|
|
||||||
cd ${test_tmpdir}
|
cd ${test_tmpdir}
|
||||||
mkdir repo2
|
mkdir repo2
|
||||||
|
|
|
||||||
|
|
@ -130,9 +130,9 @@ assert_streq "${totalsize_orig}" "${totalsize_swapped}"
|
||||||
|
|
||||||
echo 'ok generate + show endian 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}
|
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}
|
mv pre-endian-deltas-repo{,-little}
|
||||||
legacy_origrev=$(${CMD_PREFIX} ostree --repo=pre-endian-deltas-repo-big rev-parse main^)
|
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)
|
legacy_newrev=$(${CMD_PREFIX} ostree --repo=pre-endian-deltas-repo-big rev-parse main)
|
||||||
|
|
|
||||||
|
|
@ -23,4 +23,4 @@ set -euo pipefail
|
||||||
|
|
||||||
setup_fake_remote_repo1 "archive-z2"
|
setup_fake_remote_repo1 "archive-z2"
|
||||||
|
|
||||||
. ${SRCDIR}/pull-test.sh
|
. ${test_srcdir}/pull-test.sh
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue