summaryrefslogtreecommitdiff
path: root/tests/libostreetest.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2017-03-24 10:35:59 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2017-03-24 22:16:43 +0000
commit455cc5e8926350cf4386792090068ff71af08f15 (patch)
tree9c626a9034e23257fbfbe0b5a99111416c1ab282 /tests/libostreetest.c
parent4d873389f0aae45e18c8c40b2b868b8264beaade (diff)
downloadostree-455cc5e8926350cf4386792090068ff71af08f15.tar.gz
repo+tests: Add [core]disable-xattrs=true, use it on overlayfs
There are a lot of things suboptimal about this approach, but on the other hand we need to get our CI back up and running. The basic approach is to - in the test suite, detect if we're on overlayfs. If so, set a flag in the repo, which gets picked up by a few strategic places in the core to turn on "ignore xattrs". I also had to add a variant of this for the sysroot work. The core problem here is while overlayfs will let us read and see the SELinux labels, it won't let us write them. Down the line, we should improve this so that we can selectively ignore e.g. `security.*` attributes but not `user.*` say. Closes: https://github.com/ostreedev/ostree/issues/758 Closes: #759 Approved by: jlebon
Diffstat (limited to 'tests/libostreetest.c')
-rw-r--r--tests/libostreetest.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/tests/libostreetest.c b/tests/libostreetest.c
index d0eb3e81..cda1649d 100644
--- a/tests/libostreetest.c
+++ b/tests/libostreetest.c
@@ -21,6 +21,8 @@
#include "config.h"
#include <stdlib.h>
#include <string.h>
+#include <linux/magic.h>
+#include <sys/vfs.h>
#include "libglnx.h"
#include "libostreetest.h"
@@ -90,12 +92,26 @@ ot_test_setup_sysroot (GCancellable *cancellable,
gboolean ret = FALSE;
g_autoptr(GFile) sysroot_path = g_file_new_for_path ("sysroot");
glnx_unref_object OstreeSysroot *ret_sysroot = NULL;
+ struct statfs stbuf;
if (!ot_test_run_libtest ("setup_os_repository \"archive-z2\" \"syslinux\"", error))
goto out;
- /* Make sure deployments are mutable */
- g_setenv ("OSTREE_SYSROOT_DEBUG", "mutable-deployments", TRUE);
+ { g_autoptr(GString) buf = g_string_new ("mutable-deployments");
+ if (statfs ("/", &stbuf) < 0)
+ return glnx_throw_errno (error), NULL;
+ /* Keep this in sync with the overlayfs bits in libtest.sh */
+#ifndef OVERLAYFS_SUPER_MAGIC
+#define OVERLAYFS_SUPER_MAGIC 0x794c7630
+#endif
+ if (stbuf.f_type == OVERLAYFS_SUPER_MAGIC)
+ {
+ g_print ("libostreetest: detected overlayfs\n");
+ g_string_append (buf, ",no-xattrs");
+ }
+ /* Make sure deployments are mutable */
+ g_setenv ("OSTREE_SYSROOT_DEBUG", buf->str, TRUE);
+ }
ret_sysroot = ostree_sysroot_new (sysroot_path);