diff --git a/bootc-user-mountpoint.ks.in b/bootc-user-mountpoint.ks.in new file mode 100644 index 00000000..f667dc84 --- /dev/null +++ b/bootc-user-mountpoint.ks.in @@ -0,0 +1,59 @@ +# Test it is possible to use user defined mountpoint and that it is +# accessible in %post script. + +# Use the default settings. +%ksappend common/common_no_storage_and_payload.ks + +zerombr +clearpart --all --initlabel +reqpart +part /boot --fstype="ext4" --size=1024 +part / --size=1024 --grow --label=rootfs +part /var/tmp --size=1000 +part /tmp --size=500 + +# Setup the bootc image source. +bootc --source-imgref=registry:@KSTEST_OSTREECONTAINER_URL@ --stateroot=test-stateroot + +# Reboot the installed system. +reboot + +# Validate on the first boot. +%ksappend validation/success_on_first_boot.ks + +%post + +echo "File created in /var/tmp in %post script" >> /var/tmp/post-script-file.txt +echo "File created in /tmp in %post script" >> /tmp/post-script-file.txt + +# Checks after boot +cat >> /var/lib/extensions/kickstart-tests/usr/libexec/kickstart-test.sh << 'EOF' + +# propagate any errors from %post validations +if [ -e /root/RESULT ]; then + cat /root/RESULT +fi + +# Check that state root 'test-stateroot' exists +if [ ! -d /ostree/deploy/test-stateroot ]; then + echo "Couldn't find 'test-stateroot' stateroot" +fi + +# Check that /var/tmp and /tmp are separate mountpoints +if ! mountpoint -q /var/tmp; then + echo "/var/tmp is not a separate mountpoint" +fi +if ! mountpoint -q /tmp; then + echo "/tmp is not a separate mountpoint" +fi + +# Check the presence of the files created in %post script +if [ ! -e /var/tmp/post-script-file.txt ]; then + echo "Couldn't find /var/tmp/post-script-file.txt file" +fi +if [ ! -e /tmp/post-script-file.txt ]; then + echo "Couldn't find /tmp/post-script-file.txt file" +fi + +EOF +%end diff --git a/bootc-user-mountpoint.sh b/bootc-user-mountpoint.sh new file mode 100755 index 00000000..11b0b80c --- /dev/null +++ b/bootc-user-mountpoint.sh @@ -0,0 +1,85 @@ +#!/bin/bash +# +# Copyright (C) 2026 Red Hat, Inc. +# +# This copyrighted material is made available to anyone wishing to use, +# modify, copy, or redistribute it subject to the terms and conditions of +# the GNU General Public License v.2, or (at your option) any later version. +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY expressed or implied, including the implied warranties of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. You should have received a copy of the +# GNU General Public License along with this program; if not, write to the +# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the +# source code or documentation are not subject to the GNU General Public +# License and may only be used or replicated with the express permission of +# Red Hat, Inc. +# + +# Ignore unused variable parsed out by tooling scripts as test tags metadata +# shellcheck disable=SC2034 +TESTTYPE="skip-on-rhel-9 payload uefi bootc reboot storage rhel191455" + +. ${KSTESTDIR}/functions.sh + +enable_uefi() { + echo "true" +} + +copy_interesting_files_from_system() { + local disksdir + disksdir="${1}" + + # Find disks. + local args + args=$(for d in ${disksdir}/disk-*img; do echo -a ${d}; done) + + # Use also iscsi disk if there is any. + if [[ -n ${iscsi_disk_img} ]]; then + args="${args} -a ${disksdir}/${iscsi_disk_img}" + fi + + # Grab files out of the installed system while it still exists. + # Grab these files: + # + # logs from Anaconda - whole /var/log/anaconda/ directory is copied out, + # this can be used for saving specific test output + # original-ks.cfg - the kickstart used for the test + # anaconda-ks.cfg - the kickstart saved after installation, useful for + # debugging + # RESULT - file from the test + # + # The location of aforementioned files is different in an ostree system + + # Find root device by filesystem label from reqpart_root.ks + root_device="$(guestfish ${args} <<< " + launch + findfs-label rootfs + " 2>/dev/null)" + path_prefix="/ostree/deploy/test-stateroot" + + if [ -z "${root_device}" ]; then + echo "Couldn't find root filesystem with label rootfs" + return 1 + fi + + for item in ${path_prefix}/var/roothome/original-ks.cfg \ + ${path_prefix}/var/roothome/anaconda-ks.cfg \ + ${path_prefix}/var/roothome/anabot.log \ + ${path_prefix}/var/log/anaconda/ \ + ${path_prefix}/var/roothome/RESULT + do + guestfish ${args} <<< " + launch + mount ${root_device} / + copy-out '${item}' '${disksdir}' + " + done +} + +additional_runner_args() { + # Wait for reboot and shutdown of the VM, + # but exit after the specified timeout. + echo "--wait $(get_timeout)" +} diff --git a/containers/runner/skip-testtypes b/containers/runner/skip-testtypes index eed67292..8c146d31 100644 --- a/containers/runner/skip-testtypes +++ b/containers/runner/skip-testtypes @@ -100,6 +100,7 @@ rhel10_centos10_disabled_array=( gh1213 # harddrive-iso-single failing gh1633 # rpm-ostree-container-uefi failing with Fedora 44 runner container gh1700 # raid-ddf failing after migration to UEFI + rhel191455 # bootc-user-mountpoints waiting for inclusion in RHEL-191455 ) rhel10_skip_array=(