New upstream version 2022.6
This commit is contained in:
commit
46bfe6e238
79 files changed
+2679
-2141
No files matched your search
@@ -71,6 +71,11 @@ mkdir -p test-overlays
|
||||
date > test-overlays/overlaid-file
|
||||
$OSTREE commit ${COMMIT_ARGS} -b test-base --base test2 --owner-uid 42 --owner-gid 42 test-overlays/
|
||||
$OSTREE ls -R test-base > ls.txt
|
||||
assert_streq "$(wc -l < ls.txt)" 14
|
||||
if can_create_whiteout_devices; then
|
||||
assert_streq "$(wc -l < ls.txt)" 17
|
||||
else
|
||||
assert_streq "$(wc -l < ls.txt)" 14
|
||||
fi
|
||||
|
||||
assert_streq "$(grep '42.*42' ls.txt | wc -l)" 2
|
||||
echo "ok commit overlay base"
|
||||
+44
-1
@@ -19,7 +19,7 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "1..$((87 + ${extra_basic_tests:-0}))"
|
||||
echo "1..$((90 + ${extra_basic_tests:-0}))"
|
||||
|
||||
CHECKOUT_U_ARG=""
|
||||
CHECKOUT_H_ARGS="-H"
|
||||
@@ -97,6 +97,22 @@ $OSTREE rev-parse 'test2^'
|
||||
$OSTREE rev-parse 'test2^^' 2>/dev/null && fatal "rev-parse test2^^ unexpectedly succeeded!"
|
||||
echo "ok rev-parse"
|
||||
|
||||
if $OSTREE rev-parse -S 2>err.txt; then
|
||||
fatal "rev parse multiple"
|
||||
fi
|
||||
assert_file_has_content_literal err.txt 'Multiple commit objects found'
|
||||
$CMD_PREFIX ostree --repo=repo-copy init --mode=archive
|
||||
if $CMD_PREFIX ostree --repo=repo-copy rev-parse -S 2>err.txt; then
|
||||
fatal "rev parse none"
|
||||
fi
|
||||
assert_file_has_content_literal err.txt 'No commit objects found'
|
||||
rev=$($OSTREE rev-parse test2)
|
||||
$CMD_PREFIX ostree --repo=repo-copy pull-local repo test2
|
||||
rev2=$($CMD_PREFIX ostree --repo=repo-copy rev-parse -S)
|
||||
assert_streq "${rev}" "${rev2}"
|
||||
echo "ok rev-parse -S"
|
||||
|
||||
|
||||
checksum=$($OSTREE rev-parse test2)
|
||||
partial=${checksum:0:6}
|
||||
echo "partial:" $partial
|
||||
@@ -1187,3 +1203,30 @@ if test "$(id -u)" != "0"; then
|
||||
else
|
||||
echo "ok # SKIP not run when root"
|
||||
fi
|
||||
|
||||
if ! skip_one_without_whiteouts_devices; then
|
||||
cd ${test_tmpdir}
|
||||
rm checkout-test2 -rf
|
||||
$OSTREE checkout test2 checkout-test2
|
||||
|
||||
assert_not_has_file checkout-test2/whiteouts/whiteout
|
||||
assert_not_has_file checkout-test2/whiteouts/whiteout2
|
||||
assert_has_file checkout-test2/whiteouts/.ostree-wh.whiteout
|
||||
assert_has_file checkout-test2/whiteouts/.ostree-wh.whiteout2
|
||||
|
||||
echo "ok checkout: no whiteout passthrough by default"
|
||||
fi
|
||||
|
||||
if ! skip_one_without_whiteouts_devices; then
|
||||
cd ${test_tmpdir}
|
||||
rm checkout-test2 -rf
|
||||
$OSTREE checkout --process-passthrough-whiteouts test2 checkout-test2
|
||||
|
||||
assert_not_has_file checkout-test2/whiteouts/.ostree-wh.whiteout
|
||||
assert_not_has_file checkout-test2/whiteouts/.ostree-wh.whiteout2
|
||||
|
||||
assert_is_whiteout_device checkout-test2/whiteouts/whiteout
|
||||
assert_is_whiteout_device checkout-test2/whiteouts/whiteout2
|
||||
|
||||
echo "ok checkout: whiteout with overlayfs passthrough processing"
|
||||
fi
|
||||
@@ -163,6 +163,13 @@ assert_file_has_mode () {
|
||||
fi
|
||||
}
|
||||
|
||||
assert_is_whiteout_device () {
|
||||
device_details="$(stat -c '%F %t:%T' $1)"
|
||||
if [ "$device_details" != "character special file 0:0" ]; then
|
||||
fatal "File '$1' is not a whiteout character device 0:0"
|
||||
fi
|
||||
}
|
||||
|
||||
assert_symlink_has_content () {
|
||||
if ! test -L "$1"; then
|
||||
fatal "File '$1' is not a symbolic link"
|
||||
|
||||
+51
-1
@@ -148,6 +148,20 @@ if ! have_selinux_relabel; then
|
||||
fi
|
||||
echo done
|
||||
|
||||
# whiteout char 0:0 devices can be created as regular users, but
|
||||
# cannot be created inside containers mounted via overlayfs
|
||||
can_create_whiteout_devices() {
|
||||
mknod -m 000 ${test_tmpdir}/.test-whiteout c 0 0 || return 1
|
||||
rm -f ${test_tmpdir}/.test-whiteout
|
||||
return 0
|
||||
}
|
||||
|
||||
echo -n checking for overlayfs whiteouts...
|
||||
if ! can_create_whiteout_devices; then
|
||||
export OSTREE_NO_WHITEOUTS=1
|
||||
fi
|
||||
echo done
|
||||
|
||||
if test -n "${OT_TESTS_DEBUG:-}"; then
|
||||
set -x
|
||||
fi
|
||||
@@ -245,6 +259,15 @@ setup_test_repository () {
|
||||
ln -s nonexistent baz/alink
|
||||
mkdir baz/another/
|
||||
echo x > baz/another/y
|
||||
|
||||
# if we are running inside a container we cannot test
|
||||
# the overlayfs whiteout marker passthrough
|
||||
if ! test -n "${OSTREE_NO_WHITEOUTS:-}"; then
|
||||
mkdir whiteouts
|
||||
touch whiteouts/.ostree-wh.whiteout
|
||||
touch whiteouts/.ostree-wh.whiteout2
|
||||
chmod 755 whiteouts/.ostree-wh.whiteout2
|
||||
fi
|
||||
umask "${oldumask}"
|
||||
|
||||
cd ${test_tmpdir}/files
|
||||
@@ -406,7 +429,7 @@ setup_os_repository () {
|
||||
mkdir osdata
|
||||
cd osdata
|
||||
kver=3.6.0
|
||||
mkdir -p usr/bin ${bootdir} usr/lib/modules/${kver} usr/share usr/etc
|
||||
mkdir -p usr/bin ${bootdir} usr/lib/modules/${kver} usr/share usr/etc usr/container/layers/abcd
|
||||
kernel_path=${bootdir}/vmlinuz
|
||||
initramfs_path=${bootdir}/initramfs.img
|
||||
# the HMAC file is only in /usr/lib/modules
|
||||
@@ -449,6 +472,17 @@ EOF
|
||||
mkdir -p usr/etc/testdirectory
|
||||
echo "a default daemon file" > usr/etc/testdirectory/test
|
||||
|
||||
# if we are running inside a container we cannot test
|
||||
# the overlayfs whiteout marker passthrough
|
||||
if ! test -n "${OSTREE_NO_WHITEOUTS:-}"; then
|
||||
# overlayfs whiteout passhthrough marker files
|
||||
touch usr/container/layers/abcd/.ostree-wh.whiteout
|
||||
chmod 400 usr/container/layers/abcd/.ostree-wh.whiteout
|
||||
|
||||
touch usr/container/layers/abcd/.ostree-wh.whiteout2
|
||||
chmod 777 usr/container/layers/abcd/.ostree-wh.whiteout2
|
||||
fi
|
||||
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit ${bootable_flag} --add-metadata-string version=1.0.9 -b testos/buildmain/x86_64-runtime -s "Build"
|
||||
|
||||
# Ensure these commits have distinct second timestamps
|
||||
@@ -588,6 +622,22 @@ skip_without_user_xattrs () {
|
||||
fi
|
||||
}
|
||||
|
||||
# Usage: if ! skip_one_without_whiteouts_devices; then ... more tests ...; fi
|
||||
skip_one_without_whiteouts_devices() {
|
||||
if ! can_create_whiteout_devices; then
|
||||
echo "ok # SKIP - this test requires whiteout device support (test outside containers)"
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
skip_without_whiteouts_devices () {
|
||||
if ! can_create_whiteout_devices; then
|
||||
skip "this test requires whiteout device support (test outside containers)"
|
||||
fi
|
||||
}
|
||||
|
||||
_have_systemd_and_libmount=''
|
||||
have_systemd_and_libmount() {
|
||||
if test "${_have_systemd_and_libmount}" = ''; then
|
||||
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (C) 2022 Red Hat, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: LGPL-2.0+
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
set -euox pipefail
|
||||
|
||||
. $(dirname $0)/libtest.sh
|
||||
|
||||
skip_without_whiteouts_devices
|
||||
|
||||
# Exports OSTREE_SYSROOT so --sysroot not needed.
|
||||
setup_os_repository "archive" "syslinux"
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmain/x86_64-runtime
|
||||
|
||||
echo "1..3"
|
||||
${CMD_PREFIX} ostree admin deploy --os=testos --karg=root=LABEL=foo --karg=testkarg=1 testos:testos/buildmain/x86_64-runtime
|
||||
origdeployment=$(${CMD_PREFIX} ostree admin --sysroot=sysroot --print-current-dir)
|
||||
|
||||
assert_is_whiteout_device "${origdeployment}"/usr/container/layers/abcd/whiteout
|
||||
echo "ok whiteout deployment"
|
||||
|
||||
assert_not_has_file "${origdeployment}"/usr/container/layers/abcd/.ostree-wh.whiteout
|
||||
echo "ok .ostree-wh.whiteout not created"
|
||||
|
||||
assert_file_has_mode "${origdeployment}"/usr/container/layers/abcd/whiteout 400
|
||||
assert_file_has_mode "${origdeployment}"/usr/container/layers/abcd/whiteout2 777
|
||||
echo "ok whiteout permissions are preserved"
|
||||
Reference in new issue
Block a user