Add yet more patches to make the installed-tests work

This commit is contained in:
Simon McVittie 2016-04-01 06:59:13 +01:00
parent 4c3a6272a5
commit 03171dc0d9
13 changed files with 196 additions and 17 deletions

View File

@ -5,7 +5,7 @@ Subject: In tests that use gpg, terminate the gpg-agent after testing
Otherwise we leak those processes. Otherwise we leak those processes.
Signed-off-by: Simon McVittie <smcv@debian.org> Signed-off-by: Simon McVittie <smcv@debian.org>
Applied-upstream: 2016.5, https://github.com/ostreedev/ostree/commit/b25ddd29ab8eb56bc1022dd38758e54dc4b2ccbe Applied-upstream: 2016.5, commit:https://github.com/ostreedev/ostree/commit/b25ddd29ab8eb56bc1022dd38758e54dc4b2ccbe
--- ---
tests/test-commit-sign.sh | 1 + tests/test-commit-sign.sh | 1 +
tests/test-gpg-signed-commit.sh | 2 ++ tests/test-gpg-signed-commit.sh | 2 ++

View File

@ -1,28 +1,26 @@
From: Simon McVittie <smcv@debian.org> From: Simon McVittie <smcv@debian.org>
Date: Thu, 31 Mar 2016 09:02:23 +0100 Date: Thu, 31 Mar 2016 18:36:04 +0100
Subject: Load g-i bindings from builddir during build-time testing Subject: Load g-i bindings from builddir during build-time testing
Previously, the build-time tests would only pass if the g-i bindings to Previously, the build-time tests would only pass if the g-i bindings to
OSTree were already installed, with a reasonably similar version. OSTree were already installed, with a reasonably similar version.
Signed-off-by: Simon McVittie <smcv@debian.org> Signed-off-by: Simon McVittie <smcv@debian.org>
Applied-upstream: 2016.5, https://github.com/ostreedev/ostree/commit/07aa8e1c76463e3de0ffc79d0271773ababf05b4 Applied-upstream: 2016.5, commit:https://github.com/ostreedev/ostree/commit/07aa8e1c76463e3de0ffc79d0271773ababf05b4
[smcv: rebased on 2016.4] [smcv: backport to 2016.4]
--- ---
Makefile-tests.am | 7 ++++++- Makefile-tests.am | 5 ++++-
1 file changed, 6 insertions(+), 1 deletion(-) 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/Makefile-tests.am b/Makefile-tests.am diff --git a/Makefile-tests.am b/Makefile-tests.am
index 9eb9ad8..f10c23f 100644 index 9eb9ad8..e7c2395 100644
--- a/Makefile-tests.am --- a/Makefile-tests.am
+++ b/Makefile-tests.am +++ b/Makefile-tests.am
@@ -23,7 +23,12 @@ include $(top_srcdir)/buildutil/glib-tap.mk @@ -23,7 +23,10 @@ include $(top_srcdir)/buildutil/glib-tap.mk
# include the builddir in $PATH so we find our just-built ostree # include the builddir in $PATH so we find our just-built ostree
# binary. # binary.
TESTS_ENVIRONMENT += OT_TESTS_DEBUG=1 \ TESTS_ENVIRONMENT += OT_TESTS_DEBUG=1 \
- PATH=$$(cd $(top_builddir) && pwd):$${PATH} - PATH=$$(cd $(top_builddir) && pwd):$${PATH}
+ SRCDIR=$$(cd $(top_srcdir) && pwd) \
+ BUILDDIR=$$(cd $(top_builddir) && pwd) \
+ GI_TYPELIB_PATH=$$(cd $(top_builddir) && pwd) \ + GI_TYPELIB_PATH=$$(cd $(top_builddir) && pwd) \
+ LD_LIBRARY_PATH=$$(cd $(top_builddir)/.libs && pwd) \ + LD_LIBRARY_PATH=$$(cd $(top_builddir)/.libs && pwd) \
+ PATH=$$(cd $(top_builddir) && pwd):$${PATH} \ + PATH=$$(cd $(top_builddir) && pwd):$${PATH} \

View File

@ -16,7 +16,7 @@ some versions optionally supported an incompatible command-line syntax
taken from moreutils parallel. taken from moreutils parallel.
Signed-off-by: Simon McVittie <smcv@debian.org> Signed-off-by: Simon McVittie <smcv@debian.org>
Applied-upstream: 2016.5, https://github.com/ostreedev/ostree/commit/9dafc820241ed6e663ad4093660fc255f549aa26 Applied-upstream: 2016.5, commit:https://github.com/ostreedev/ostree/commit/9dafc820241ed6e663ad4093660fc255f549aa26
--- ---
tests/test-admin-locking.sh | 6 +++--- tests/test-admin-locking.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-) 1 file changed, 3 insertions(+), 3 deletions(-)

View File

@ -4,7 +4,7 @@ Subject: Skip tests that run rofiles-fuse if /dev/fuse or /etc/mtab
unavailable unavailable
Signed-off-by: Simon McVittie <smcv@debian.org> Signed-off-by: Simon McVittie <smcv@debian.org>
Applied-upstream: 2016.5, https://github.com/ostreedev/ostree/commit/e1ce859368b41c863fe096df84f1ff33e90d725f Applied-upstream: 2016.5, commit:https://github.com/ostreedev/ostree/commit/e1ce859368b41c863fe096df84f1ff33e90d725f
--- ---
tests/libtest.sh | 17 +++++++++++++++++ tests/libtest.sh | 17 +++++++++++++++++
tests/test-demo-buildsystem.sh | 6 +----- tests/test-demo-buildsystem.sh | 6 +-----

View File

@ -5,7 +5,7 @@ Subject: Symlink libreaddir-rand.so into tests directory
This means it can be LD_PRELOADed during build-time testing. This means it can be LD_PRELOADed during build-time testing.
Signed-off-by: Simon McVittie <smcv@debian.org> Signed-off-by: Simon McVittie <smcv@debian.org>
Applied-upstream: 2016.5, https://github.com/ostreedev/ostree/commit/f8bef792cb9cdd8b9cd174dad5856727db3b9bad Applied-upstream: 2016.5, commit:https://github.com/ostreedev/ostree/commit/f8bef792cb9cdd8b9cd174dad5856727db3b9bad
--- ---
.gitignore | 1 + .gitignore | 1 +
Makefile-decls.am | 3 +++ Makefile-decls.am | 3 +++

View File

@ -0,0 +1,31 @@
From: Simon McVittie <smcv@debian.org>
Date: Thu, 31 Mar 2016 17:52:57 +0100
Subject: libtest.sh: only check whether $(pwd) is empty once
test-sysroot.js runs libtestExec() twice, one of which is after
creating non-hidden directories in $(pwd), so this check needs to be
skipped the second time.
Signed-off-by: Simon McVittie <smcv@debian.org>
Applied-upstream: 2016.5, commit:https://github.com/ostreedev/ostree/commit/18e9169d7ae76149833475c14f4c7147f6f91c9e
---
tests/libtest.sh | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tests/libtest.sh b/tests/libtest.sh
index f588e65..f22ba4b 100755
--- a/tests/libtest.sh
+++ b/tests/libtest.sh
@@ -41,8 +41,12 @@ test_tmpdir=$(pwd)
if ! test -f .testtmp; then
files=$(ls)
if test -n "${files}"; then
+ ls -l
assert_not_reached "test tmpdir=${test_tmpdir} is not empty; run this test via \`make check TESTS=\`, not directly"
fi
+ # Remember that this is an acceptable test $(pwd), for the benefit of
+ # C and JS tests which may source this file again
+ touch .testtmp
fi
export G_DEBUG=fatal-warnings

View File

@ -0,0 +1,109 @@
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

View File

@ -7,3 +7,6 @@ Load-g-i-bindings-from-builddir-during-build-time-testing.patch
tests-admin-test.sh-this-is-a-bash-script-not-a-POSIX-sh-.patch tests-admin-test.sh-this-is-a-bash-script-not-a-POSIX-sh-.patch
Skip-tests-that-run-rofiles-fuse-if-dev-fuse-or-etc-mtab-.patch Skip-tests-that-run-rofiles-fuse-if-dev-fuse-or-etc-mtab-.patch
Probe-for-GNU-parallel-more-accurately.patch Probe-for-GNU-parallel-more-accurately.patch
libtest.sh-use-G_TEST_SRCDIR-G_TEST_BUILDDIR-to-find-reso.patch
test-xattrs-sync-how-this-is-skipped-with-test-rofiles-fu.patch
libtest.sh-only-check-whether-pwd-is-empty-once.patch

View File

@ -9,7 +9,7 @@ This means the various "ostree trivial-httpd --autoexit" processes
actually exit, because their web roots are cleaned up now. actually exit, because their web roots are cleaned up now.
Signed-off-by: Simon McVittie <smcv@debian.org> Signed-off-by: Simon McVittie <smcv@debian.org>
Applied-upstream: 2016.5, https://github.com/ostreedev/ostree/commit/47fd5c74f1428d4cc02ff0061a4958c4b714e852 Applied-upstream: 2016.5, commit:https://github.com/ostreedev/ostree/commit/47fd5c74f1428d4cc02ff0061a4958c4b714e852
--- ---
buildutil/tap-test | 2 +- buildutil/tap-test | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-) 1 file changed, 1 insertion(+), 1 deletion(-)

View File

@ -0,0 +1,38 @@
From: Simon McVittie <smcv@debian.org>
Date: Thu, 31 Mar 2016 17:47:36 +0100
Subject: test-xattrs: sync how this is skipped with test-rofiles-fuse
If we touch test-xattrs before sourcing libtest.sh, we get:
test tmpdir=/tmp/test-tmp-ostree_test-xattrs.sh.test-HSEXEY is not
empty; run this test via `make check TESTS=`, not directly
Signed-off-by: Simon McVittie <smcv@debian.org>
Applied-upstream: 2016.5, commit:https://github.com/ostreedev/ostree/commit/9c4babf316cfbfad61cfcd0ab8fd5e77e9df13be
---
tests/test-xattrs.sh | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/tests/test-xattrs.sh b/tests/test-xattrs.sh
index 2f2d99c..cdc06e8 100755
--- a/tests/test-xattrs.sh
+++ b/tests/test-xattrs.sh
@@ -19,15 +19,11 @@
set -euo pipefail
-touch test-xattrs
-if ! setfattr -n user.testvalue -v somevalue test-xattrs; then
- echo "1..0 # SKIP: cannot run setfattr"
- exit 0
-fi
+. $(dirname $0)/libtest.sh
-echo "1..2"
+skip_without_user_xattrs
-. $(dirname $0)/libtest.sh
+echo "1..2"
setup_test_repository "archive-z2"

View File

@ -3,7 +3,7 @@ Date: Mon, 28 Mar 2016 13:08:32 +0100
Subject: test-xattrs: use TAP syntax to skip test Subject: test-xattrs: use TAP syntax to skip test
Signed-off-by: Simon McVittie <smcv@debian.org> Signed-off-by: Simon McVittie <smcv@debian.org>
Applied-upstream: 2016.5, https://github.com/ostreedev/ostree/commit/c276025466af4319d603fe8b534dd3463818a168 Applied-upstream: 2016.5, commit:https://github.com/ostreedev/ostree/commit/c276025466af4319d603fe8b534dd3463818a168
--- ---
tests/test-xattrs.sh | 3 ++- tests/test-xattrs.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-) 1 file changed, 2 insertions(+), 1 deletion(-)

View File

@ -7,7 +7,7 @@ PR #226 that he prefers to require bash rather than trying to support
every POSIX shell. every POSIX shell.
Signed-off-by: Simon McVittie <smcv@debian.org> Signed-off-by: Simon McVittie <smcv@debian.org>
Applied-upstream: 2016.5, https://github.com/ostreedev/ostree/commit/1dd85513e540ef0b42f2fee7238fa1f710eaa4ca Applied-upstream: 2016.5, commit:https://github.com/ostreedev/ostree/commit/1dd85513e540ef0b42f2fee7238fa1f710eaa4ca
--- ---
tests/admin-test.sh | 2 +- tests/admin-test.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-) 1 file changed, 1 insertion(+), 1 deletion(-)

View File

@ -6,7 +6,7 @@ Some autobuilder environments place the entire build chroot on tmpfs, so
even /var/tmp might not have this. even /var/tmp might not have this.
Signed-off-by: Simon McVittie <smcv@debian.org> Signed-off-by: Simon McVittie <smcv@debian.org>
Applied-upstream: 2016.5, https://github.com/ostreedev/ostree/commit/3e3755c497bd85e22b01829c5715119d46394687 Applied-upstream: 2016.5, commit:https://github.com/ostreedev/ostree/commit/3e3755c497bd85e22b01829c5715119d46394687
--- ---
tests/libtest.sh | 8 ++++++++ tests/libtest.sh | 8 ++++++++
tests/test-basic-user.sh | 6 ++++-- tests/test-basic-user.sh | 6 ++++--