From f6867358e2fb50382b6ff3cbf717a1a733965338 Mon Sep 17 00:00:00 2001 From: Alex Kiernan Date: Sun, 29 Dec 2019 12:32:28 +0000 Subject: [PATCH 1/3] test-switchroot.sh: Exclude /proc from file list Since we're not interested in any file inside /proc, exclude it from the file listing in our fake root thus avoiding failures when processes die during our execution and find(1) can't then look inside those directories. Signed-off-by: Alex Kiernan --- tests/test-switchroot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test-switchroot.sh b/tests/test-switchroot.sh index bc3ec38b..b05b11a4 100755 --- a/tests/test-switchroot.sh +++ b/tests/test-switchroot.sh @@ -56,7 +56,7 @@ find_in_env() { "$1" "$tmpdir" enter_fs "$tmpdir" ostree-prepare-root /sysroot - find / + find / \( -path /proc -o -path /sysroot/proc \) -prune -o -print touch /usr/usr_writable 2>/null \ && echo "/usr is writable" \ || echo "/usr is not writable" From 5c62a7e4d0a5614cacc552052d474fe1768583ec Mon Sep 17 00:00:00 2001 From: Alex Kiernan Date: Sun, 29 Dec 2019 13:23:23 +0000 Subject: [PATCH 2/3] build: Expose systemd in OSTREE_FEATURES Signed-off-by: Alex Kiernan --- configure.ac | 1 + 1 file changed, 1 insertion(+) diff --git a/configure.ac b/configure.ac index 4a752e55..429239f4 100644 --- a/configure.ac +++ b/configure.ac @@ -533,6 +533,7 @@ dnl If we have both, we use the "new /var" model with ostree-system-generator AM_CONDITIONAL(BUILDOPT_SYSTEMD_AND_LIBMOUNT,[test x$with_systemd = xyes && test x$with_libmount = xyes]) AM_COND_IF(BUILDOPT_SYSTEMD_AND_LIBMOUNT, AC_DEFINE([BUILDOPT_LIBSYSTEMD_AND_LIBMOUNT], 1, [Define if systemd and libmount])) +if test x$with_systemd != xno; then OSTREE_FEATURES="$OSTREE_FEATURES systemd"; fi AC_ARG_WITH(builtin-grub2-mkconfig, AS_HELP_STRING([--with-builtin-grub2-mkconfig], From 87ccb400a28dcdcaa07f6c953b32816edb08d875 Mon Sep 17 00:00:00 2001 From: Alex Kiernan Date: Sun, 29 Dec 2019 13:25:24 +0000 Subject: [PATCH 3/3] tests: Skip /var test if running with systemd and libmount If running with systemd and libmount then /var mounting is deferred for systemd. Skip the relevant tests in this case as it will always fail. Signed-off-by: Alex Kiernan --- tests/libtest.sh | 12 ++++++++++++ tests/test-switchroot.sh | 8 ++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/tests/libtest.sh b/tests/libtest.sh index 3f5fd931..cbdf331c 100755 --- a/tests/libtest.sh +++ b/tests/libtest.sh @@ -559,6 +559,18 @@ skip_without_user_xattrs () { fi } +_have_systemd_and_libmount='' +have_systemd_and_libmount() { + if test "${_have_systemd_and_libmount}" = ''; then + if [ $(ostree --version | grep -c -e '- systemd' -e '- libmount') -eq 2 ]; then + _have_systemd_and_libmount=yes + else + _have_systemd_and_libmount=no + fi + fi + test ${_have_systemd_and_libmount} = yes +} + # Skip unless SELinux is disabled, or we can relabel. # Default Docker has security.selinux xattrs, but returns # EOPNOTSUPP when trying to set them, even to the existing value. diff --git a/tests/test-switchroot.sh b/tests/test-switchroot.sh index b05b11a4..e66c68de 100755 --- a/tests/test-switchroot.sh +++ b/tests/test-switchroot.sh @@ -82,7 +82,9 @@ test_that_prepare_root_sets_sysroot_up_correctly_with_initrd() { grep -qx "/this_is_bootfs" files grep -qx "/sysroot/this_is_ostree_root" files grep -qx "/sysroot/sysroot/this_is_real_root" files - grep -qx "/sysroot/var/this_is_ostree_var" files + if ! have_systemd_and_libmount; then + grep -qx "/sysroot/var/this_is_ostree_var" files + fi grep -qx "/sysroot/usr/this_is_ostree_usr" files grep -qx "/sysroot/usr is not writable" files @@ -101,7 +103,9 @@ test_that_prepare_root_sets_root_up_correctly_with_no_initrd() { grep -qx "/this_is_ostree_root" files grep -qx "/sysroot/this_is_bootfs" files grep -qx "/sysroot/this_is_real_root" files - grep -qx "/var/this_is_ostree_var" files + if ! have_systemd_and_libmount; then + grep -qx "/var/this_is_ostree_var" files + fi grep -qx "/usr/this_is_ostree_usr" files grep -qx "/usr is not writable" files