Tell build-time tests which bwrap we are going to use

In autobuilder environments that deprive the build of capabilities,
it is entirely possible that we have a system bwrap(1) but cannot
run it, for example because CAP_SYS_ADMIN has been excluded from
the capability bounding set. Tell the tests which bwrap we are
going to run, so we can run it in a simpler way and see whether
it works.

Debian's sbuild autobuilder currently suffers from a different
issue in which pivot_root(2) returns EINVAL, possibly caused by
sbuild being chroot-based and so not having the mount point
structure that is required for pivot_root. This avoids the
problematic build-time tests there too; they work on ci.debian.net,
which uses lxc instead of chroots, and in virtual machines.

Because $(BWRAP) might be non-absolute, we need to search PATH for it.

Signed-off-by: Simon McVittie <smcv@debian.org>
tingping/wmclass
Simon McVittie 2016-09-07 13:30:59 +01:00
parent a5d70667b2
commit 1769f8e8dc
2 changed files with 4 additions and 2 deletions

View File

@ -6,7 +6,9 @@ TESTS_ENVIRONMENT += FLATPAK_TESTS_DEBUG=1 \
PATH=$$(cd $(top_builddir) && pwd):$${PATH} \
$(NULL)
if !WITH_SYSTEM_BWRAP
if WITH_SYSTEM_BWRAP
TESTS_ENVIRONMENT += FLATPAK_BWRAP=$(BWRAP)
else
TESTS_ENVIRONMENT += FLATPAK_BWRAP=$$(cd $(top_builddir) && pwd)/flatpak-bwrap
endif

View File

@ -276,7 +276,7 @@ test_install_launch_uninstall (void)
{
gint exit_code = 0;
char *argv[] = { (char *)bwrap, "--ro-bind", "/", "/", "/bin/true", NULL };
g_spawn_sync (NULL, argv, NULL, 0, NULL, NULL, NULL, NULL, &exit_code, &error);
g_spawn_sync (NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL, &exit_code, &error);
g_assert_no_error (error);
if (exit_code != 0)
{