Merge pull request #1987 from akiernan/us-switchroot-tests

Skip /var test if running with systemd and libmount
This commit is contained in:
OpenShift Merge Robot 2020-01-16 16:47:41 +01:00 committed by GitHub
commit 20d84f40fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 3 deletions

View File

@ -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_CONDITIONAL(BUILDOPT_SYSTEMD_AND_LIBMOUNT,[test x$with_systemd = xyes && test x$with_libmount = xyes])
AM_COND_IF(BUILDOPT_SYSTEMD_AND_LIBMOUNT, AM_COND_IF(BUILDOPT_SYSTEMD_AND_LIBMOUNT,
AC_DEFINE([BUILDOPT_LIBSYSTEMD_AND_LIBMOUNT], 1, [Define if 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, AC_ARG_WITH(builtin-grub2-mkconfig,
AS_HELP_STRING([--with-builtin-grub2-mkconfig], AS_HELP_STRING([--with-builtin-grub2-mkconfig],

View File

@ -559,6 +559,18 @@ skip_without_user_xattrs () {
fi 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. # Skip unless SELinux is disabled, or we can relabel.
# Default Docker has security.selinux xattrs, but returns # Default Docker has security.selinux xattrs, but returns
# EOPNOTSUPP when trying to set them, even to the existing value. # EOPNOTSUPP when trying to set them, even to the existing value.

View File

@ -66,7 +66,7 @@ find_in_env() {
"$1" "$tmpdir" "$1" "$tmpdir"
enter_fs "$tmpdir" enter_fs "$tmpdir"
ostree-prepare-root /sysroot ostree-prepare-root /sysroot
find / find / \( -path /proc -o -path /sysroot/proc \) -prune -o -print
touch /usr/usr_writable 2>/null \ touch /usr/usr_writable 2>/null \
&& echo "/usr is writable" \ && echo "/usr is writable" \
|| echo "/usr is not writable" || echo "/usr is not writable"
@ -92,7 +92,9 @@ test_that_prepare_root_sets_sysroot_up_correctly_with_initrd() {
grep -qx "/this_is_bootfs" files grep -qx "/this_is_bootfs" files
grep -qx "/sysroot/this_is_ostree_root" files grep -qx "/sysroot/this_is_ostree_root" files
grep -qx "/sysroot/sysroot/this_is_real_root" files grep -qx "/sysroot/sysroot/this_is_real_root" files
if ! have_systemd_and_libmount; then
grep -qx "/sysroot/var/this_is_ostree_var" files grep -qx "/sysroot/var/this_is_ostree_var" files
fi
grep -qx "/sysroot/usr/this_is_ostree_usr" files grep -qx "/sysroot/usr/this_is_ostree_usr" files
grep -qx "/sysroot/usr is not writable" files grep -qx "/sysroot/usr is not writable" files
@ -111,7 +113,9 @@ test_that_prepare_root_sets_root_up_correctly_with_no_initrd() {
grep -qx "/this_is_ostree_root" files grep -qx "/this_is_ostree_root" files
grep -qx "/sysroot/this_is_bootfs" files grep -qx "/sysroot/this_is_bootfs" files
grep -qx "/sysroot/this_is_real_root" files grep -qx "/sysroot/this_is_real_root" files
if ! have_systemd_and_libmount; then
grep -qx "/var/this_is_ostree_var" files grep -qx "/var/this_is_ostree_var" files
fi
grep -qx "/usr/this_is_ostree_usr" files grep -qx "/usr/this_is_ostree_usr" files
grep -qx "/usr is not writable" files grep -qx "/usr is not writable" files