mirror of
https://github.com/ostreedev/ostree.git
synced 2025-03-29 06:50:35 +03:00
tests: directories instead of symbolic links in boot part
Add tests for boot/loader directory. Signed-off-by: Igor Opaniuk <igor.opaniuk@foundries.io>
This commit is contained in:
parent
8e29a507e2
commit
8e47955247
@ -104,6 +104,7 @@ _installed_or_uninstalled_test_scripts = \
|
||||
tests/test-admin-upgrade-endoflife.sh \
|
||||
tests/test-admin-upgrade-systemd-update.sh \
|
||||
tests/test-admin-deploy-syslinux.sh \
|
||||
tests/test-admin-dir-deploy-syslinux.sh \
|
||||
tests/test-admin-deploy-bootprefix.sh \
|
||||
tests/test-admin-deploy-composefs.sh \
|
||||
tests/test-admin-deploy-var.sh \
|
||||
@ -112,9 +113,12 @@ _installed_or_uninstalled_test_scripts = \
|
||||
tests/test-admin-deploy-switch.sh \
|
||||
tests/test-admin-deploy-etcmerge-cornercases.sh \
|
||||
tests/test-admin-deploy-uboot.sh \
|
||||
tests/test-admin-dir-deploy-uboot.sh \
|
||||
tests/test-admin-deploy-grub2.sh \
|
||||
tests/test-admin-dir-deploy-grub2.sh \
|
||||
tests/test-admin-deploy-nomerge.sh \
|
||||
tests/test-admin-deploy-none.sh \
|
||||
tests/test-admin-dir-deploy-none.sh \
|
||||
tests/test-admin-deploy-bootid-gc.sh \
|
||||
tests/test-admin-deploy-whiteouts.sh \
|
||||
tests/test-admin-deploy-emptyetc.sh \
|
||||
|
@ -63,6 +63,20 @@ export rev
|
||||
# This initial deployment gets kicked off with some kernel arguments. We also set the initial
|
||||
# timestamp of the deploy directory to the epoch as a regression test.
|
||||
touch -d @0 sysroot/ostree/deploy
|
||||
|
||||
if [ "${folders_instead_symlinks_in_boot}" == "1" ]; then
|
||||
# Have loader as a directory (simulate ESP-based deployments)
|
||||
if [ -h sysroot/boot/loader ]; then
|
||||
loader=`readlink sysroot/boot/loader`
|
||||
rm -f sysroot/boot/loader
|
||||
mv sysroot/boot/${loader} sysroot/boot/loader
|
||||
echo -n ${loader} > sysroot/boot/loader/ostree_bootversion
|
||||
else
|
||||
mkdir -p sysroot/boot/loader
|
||||
echo -n "loader.0" > sysroot/boot/loader/ostree_bootversion
|
||||
fi
|
||||
fi
|
||||
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime
|
||||
new_mtime=$(stat -c '%.Y' sysroot/ostree/deploy)
|
||||
assert_not_streq "${orig_mtime}" "${new_mtime}"
|
||||
@ -99,7 +113,12 @@ echo "ok nice error for deploy with no stateroot"
|
||||
|
||||
# Test layout of bootloader config and refs
|
||||
assert_not_has_dir sysroot/boot/loader.0
|
||||
assert_has_dir sysroot/boot/loader.1
|
||||
if [ "${folders_instead_symlinks_in_boot}" == "1" ]; then
|
||||
assert_not_has_dir sysroot/boot/loader.1
|
||||
assert_file_has_content sysroot/boot/loader/ostree_bootversion 'loader.1'
|
||||
else
|
||||
assert_has_dir sysroot/boot/loader.1
|
||||
fi
|
||||
assert_has_dir sysroot/ostree/boot.1.1
|
||||
assert_has_file sysroot/boot/loader/entries/ostree-1.conf
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-1.conf 'options.* root=LABEL=MOO'
|
||||
@ -122,7 +141,12 @@ ${CMD_PREFIX} ostree admin deploy --stateroot=testos testos:testos/buildmain/x86
|
||||
new_mtime=$(stat -c '%.Y' sysroot/ostree/deploy)
|
||||
assert_not_streq "${orig_mtime}" "${new_mtime}"
|
||||
# Need a new bootversion, sine we now have two deployments
|
||||
assert_has_dir sysroot/boot/loader.0
|
||||
if [ "${folders_instead_symlinks_in_boot}" == "1" ]; then
|
||||
assert_not_has_dir sysroot/boot/loader.0
|
||||
assert_file_has_content sysroot/boot/loader/ostree_bootversion 'loader.0'
|
||||
else
|
||||
assert_has_dir sysroot/boot/loader.0
|
||||
fi
|
||||
assert_not_has_dir sysroot/boot/loader.1
|
||||
assert_has_dir sysroot/ostree/boot.0.1
|
||||
assert_not_has_dir sysroot/ostree/boot.0.0
|
||||
@ -140,8 +164,13 @@ echo "ok second deploy"
|
||||
|
||||
${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmain/x86_64-runtime
|
||||
# Keep the same bootversion
|
||||
assert_has_dir sysroot/boot/loader.0
|
||||
assert_not_has_dir sysroot/boot/loader.1
|
||||
if [ "${folders_instead_symlinks_in_boot}" == "1" ]; then
|
||||
assert_not_has_dir sysroot/boot/loader.0
|
||||
assert_file_has_content sysroot/boot/loader/ostree_bootversion 'loader.0'
|
||||
else
|
||||
assert_has_dir sysroot/boot/loader.0
|
||||
fi
|
||||
# But swap subbootversion
|
||||
assert_has_dir sysroot/ostree/boot.0.0
|
||||
assert_not_has_dir sysroot/ostree/boot.0.1
|
||||
@ -155,7 +184,12 @@ ${CMD_PREFIX} ostree admin os-init otheros
|
||||
|
||||
${CMD_PREFIX} ostree admin deploy --os=otheros testos/buildmain/x86_64-runtime
|
||||
assert_not_has_dir sysroot/boot/loader.0
|
||||
assert_has_dir sysroot/boot/loader.1
|
||||
if [ "${folders_instead_symlinks_in_boot}" == "1" ]; then
|
||||
assert_not_has_dir sysroot/boot/loader.1
|
||||
assert_file_has_content sysroot/boot/loader/ostree_bootversion 'loader.1'
|
||||
else
|
||||
assert_has_dir sysroot/boot/loader.1
|
||||
fi
|
||||
assert_has_file sysroot/boot/loader/entries/ostree-2.conf
|
||||
assert_has_file sysroot/boot/loader/entries/ostree-3.conf
|
||||
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.1/etc/os-release 'NAME=TestOS'
|
||||
@ -167,8 +201,13 @@ validate_bootloader
|
||||
echo "ok independent deploy"
|
||||
|
||||
${CMD_PREFIX} ostree admin deploy --retain --os=testos testos:testos/buildmain/x86_64-runtime
|
||||
assert_has_dir sysroot/boot/loader.0
|
||||
assert_not_has_dir sysroot/boot/loader.1
|
||||
if [ "${folders_instead_symlinks_in_boot}" == "1" ]; then
|
||||
assert_not_has_dir sysroot/boot/loader.0
|
||||
assert_file_has_content sysroot/boot/loader/ostree_bootversion 'loader.0'
|
||||
else
|
||||
assert_has_dir sysroot/boot/loader.0
|
||||
fi
|
||||
assert_has_file sysroot/boot/loader/entries/ostree-4.conf
|
||||
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.2/etc/os-release 'NAME=TestOS'
|
||||
assert_has_file sysroot/boot/loader/entries/ostree-2.conf
|
||||
@ -185,7 +224,12 @@ rm sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/aconfigfile
|
||||
ln -s /ENOENT sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/a-new-broken-symlink
|
||||
${CMD_PREFIX} ostree admin deploy --retain --os=testos testos:testos/buildmain/x86_64-runtime
|
||||
assert_not_has_dir sysroot/boot/loader.0
|
||||
assert_has_dir sysroot/boot/loader.1
|
||||
if [ "${folders_instead_symlinks_in_boot}" == "1" ]; then
|
||||
assert_not_has_dir sysroot/boot/loader.1
|
||||
assert_file_has_content sysroot/boot/loader/ostree_bootversion 'loader.1'
|
||||
else
|
||||
assert_has_dir sysroot/boot/loader.1
|
||||
fi
|
||||
link=sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/a-new-broken-symlink
|
||||
if ! test -L ${link}; then
|
||||
ls -al ${link}
|
||||
@ -215,8 +259,13 @@ assert_has_file sysroot/boot/loader/entries/ostree-1.conf
|
||||
assert_not_has_file sysroot/boot/loader/entries/ostree-2.conf
|
||||
assert_not_has_file sysroot/boot/loader/entries/ostree-3.conf
|
||||
${CMD_PREFIX} ostree admin deploy --not-as-default --os=otheros testos:testos/buildmain/x86_64-runtime
|
||||
assert_has_dir sysroot/boot/loader.0
|
||||
assert_not_has_dir sysroot/boot/loader.1
|
||||
if [ "${folders_instead_symlinks_in_boot}" == "1" ]; then
|
||||
assert_not_has_dir sysroot/boot/loader.0
|
||||
assert_file_has_content sysroot/boot/loader/ostree_bootversion 'loader.0'
|
||||
else
|
||||
assert_has_dir sysroot/boot/loader.0
|
||||
fi
|
||||
assert_has_file sysroot/boot/loader/entries/ostree-2.conf
|
||||
assert_has_file sysroot/boot/loader/entries/ostree-1.conf
|
||||
${CMD_PREFIX} ostree admin status
|
||||
@ -226,7 +275,12 @@ echo "ok deploy --not-as-default"
|
||||
|
||||
${CMD_PREFIX} ostree admin deploy --retain-rollback --os=otheros testos:testos/buildmain/x86_64-runtime
|
||||
assert_not_has_dir sysroot/boot/loader.0
|
||||
assert_has_dir sysroot/boot/loader.1
|
||||
if [ "${folders_instead_symlinks_in_boot}" == "1" ]; then
|
||||
assert_not_has_dir sysroot/boot/loader.1
|
||||
assert_file_has_content sysroot/boot/loader/ostree_bootversion 'loader.1'
|
||||
else
|
||||
assert_has_dir sysroot/boot/loader.1
|
||||
fi
|
||||
assert_has_file sysroot/boot/loader/entries/ostree-3.conf
|
||||
assert_has_file sysroot/boot/loader/entries/ostree-2.conf
|
||||
assert_has_file sysroot/boot/loader/entries/ostree-1.conf
|
||||
|
@ -25,5 +25,6 @@ set -euo pipefail
|
||||
setup_os_repository "archive" "grub2 ostree-grub-generator"
|
||||
|
||||
extra_admin_tests=0
|
||||
folders_instead_symlinks_in_boot=0
|
||||
|
||||
. $(dirname $0)/admin-test.sh
|
||||
|
@ -25,6 +25,7 @@ set -euo pipefail
|
||||
setup_os_repository "archive" "sysroot.bootloader none"
|
||||
|
||||
extra_admin_tests=1
|
||||
folders_instead_symlinks_in_boot=0
|
||||
|
||||
. $(dirname $0)/admin-test.sh
|
||||
|
||||
|
@ -25,6 +25,7 @@ set -euo pipefail
|
||||
setup_os_repository "archive" "syslinux"
|
||||
|
||||
extra_admin_tests=3
|
||||
folders_instead_symlinks_in_boot=0
|
||||
|
||||
. $(dirname $0)/admin-test.sh
|
||||
|
||||
|
@ -28,6 +28,7 @@ modulesdir="usr/lib/modules/${kver}"
|
||||
setup_os_repository "archive" "uboot" ${modulesdir}
|
||||
|
||||
extra_admin_tests=2
|
||||
folders_instead_symlinks_in_boot=0
|
||||
|
||||
. $(dirname $0)/admin-test.sh
|
||||
|
||||
|
30
tests/test-admin-dir-deploy-grub2.sh
Executable file
30
tests/test-admin-dir-deploy-grub2.sh
Executable file
@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (C) 2011,2014 Colin Walters <walters@verbum.org>
|
||||
#
|
||||
# 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 -euo pipefail
|
||||
|
||||
. $(dirname $0)/libtest.sh
|
||||
|
||||
# Exports OSTREE_SYSROOT so --sysroot not needed.
|
||||
setup_os_repository "archive" "grub2 ostree-grub-generator"
|
||||
|
||||
extra_admin_tests=0
|
||||
folders_instead_symlinks_in_boot=1
|
||||
|
||||
. $(dirname $0)/admin-test.sh
|
53
tests/test-admin-dir-deploy-none.sh
Executable file
53
tests/test-admin-dir-deploy-none.sh
Executable file
@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (C) 2019 Robert Fairley <rfairley@redhat.com>
|
||||
#
|
||||
# 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 -euo pipefail
|
||||
|
||||
. $(dirname $0)/libtest.sh
|
||||
|
||||
# Exports OSTREE_SYSROOT so --sysroot not needed.
|
||||
setup_os_repository "archive" "sysroot.bootloader none"
|
||||
|
||||
extra_admin_tests=1
|
||||
folders_instead_symlinks_in_boot=1
|
||||
|
||||
. $(dirname $0)/admin-test.sh
|
||||
|
||||
# Test that the bootloader configuration "none" generates BLS config snippets.
|
||||
cd ${test_tmpdir}
|
||||
rm httpd osdata testos-repo sysroot -rf
|
||||
setup_os_repository "archive" "sysroot.bootloader none"
|
||||
${CMD_PREFIX} ostree pull-local --repo=sysroot/ostree/repo --remote testos testos-repo testos/buildmain/x86_64-runtime
|
||||
# Test that configuring sysroot.bootloader="none" is a workaround for previous
|
||||
# grub2 bootloader issue (see https://github.com/ostreedev/ostree/issues/1774)
|
||||
mkdir -p sysroot/boot/grub2
|
||||
touch sysroot/boot/grub2/grub.cfg
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os testos testos/buildmain/x86_64-runtime > out.txt
|
||||
assert_file_has_content out.txt "Bootloader updated.*"
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-1.conf 'options.* root=LABEL=MOO'
|
||||
assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/vmlinuz-3.6.0 'a kernel'
|
||||
assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/.vmlinuz-3.6.0.hmac 'an hmac file'
|
||||
assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/initramfs-3.6.0.img 'an initramfs'
|
||||
echo "ok generate bls config on first deployment"
|
||||
|
||||
# TODO: add tests to try setting with an unsupported bootloader config,
|
||||
# once https://github.com/ostreedev/ostree/issues/1827 is solved.
|
||||
# The tests should check that the following commands fail:
|
||||
# ${CMD_PREFIX} ostree --repo=sysroot/ostree/repo config set sysroot.bootloader unsupported_bootloader
|
||||
# ${CMD_PREFIX} ostree --repo=sysroot/ostree/repo config set sysroot.bootloader ""
|
71
tests/test-admin-dir-deploy-syslinux.sh
Executable file
71
tests/test-admin-dir-deploy-syslinux.sh
Executable file
@ -0,0 +1,71 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (C) 2011,2014 Colin Walters <walters@verbum.org>
|
||||
#
|
||||
# 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 -euo pipefail
|
||||
|
||||
. $(dirname $0)/libtest.sh
|
||||
|
||||
# Exports OSTREE_SYSROOT so --sysroot not needed.
|
||||
setup_os_repository "archive" "syslinux"
|
||||
|
||||
extra_admin_tests=3
|
||||
folders_instead_symlinks_in_boot=1
|
||||
|
||||
. $(dirname $0)/admin-test.sh
|
||||
|
||||
# Test the legacy dirs
|
||||
for test_bootdir in "boot" "usr/lib/ostree-boot"; do
|
||||
cd ${test_tmpdir}
|
||||
rm httpd osdata testos-repo sysroot -rf
|
||||
setup_os_repository "archive" "syslinux" $test_bootdir
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmain/x86_64-runtime
|
||||
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime)
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-1.conf 'options.* root=LABEL=MOO'
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-1.conf 'options.* quiet'
|
||||
assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/vmlinuz-3.6.0 'a kernel'
|
||||
assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/initramfs-3.6.0.img 'an initramfs'
|
||||
# kernel/initrams should also be in the tree's /boot with the checksum
|
||||
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.0/$test_bootdir/vmlinuz-3.6.0-${bootcsum} 'a kernel'
|
||||
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.0/$test_bootdir/initramfs-3.6.0.img-${bootcsum} 'an initramfs'
|
||||
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.0/etc/os-release 'NAME=TestOS'
|
||||
assert_file_has_content sysroot/ostree/boot.1/testos/${bootcsum}/0/etc/os-release 'NAME=TestOS'
|
||||
${CMD_PREFIX} ostree admin status
|
||||
validate_bootloader
|
||||
echo "ok kernel in $test_bootdir"
|
||||
done
|
||||
|
||||
# And test that legacy overrides /usr/lib/modules
|
||||
cd ${test_tmpdir}
|
||||
rm httpd osdata testos-repo sysroot -rf
|
||||
setup_os_repository "archive" "syslinux" "usr/lib/ostree-boot"
|
||||
cd osdata
|
||||
echo "this is a kernel without an initramfs like Fedora 26" > usr/lib/modules/3.6.0/vmlinuz
|
||||
usrlib_modules_bootcsum=$(cat usr/lib/modules/3.6.0/vmlinuz | sha256sum | cut -f 1 -d ' ')
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --add-metadata-string version=1.0.9 -b testos/buildmain/x86_64-runtime -s "Build"
|
||||
cd ${test_tmpdir}
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmain/x86_64-runtime
|
||||
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime)
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-1.conf 'options.* root=LABEL=MOO'
|
||||
assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/vmlinuz-3.6.0 'a kernel'
|
||||
assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/initramfs-3.6.0.img 'an initramfs'
|
||||
# Note this bootcsum shouldn't be the modules one
|
||||
assert_not_streq "${bootcsum}" "${usrlib_modules_bootcsum}"
|
||||
echo "ok kernel in /usr/lib/modules and /usr/lib/ostree-boot"
|
79
tests/test-admin-dir-deploy-uboot.sh
Executable file
79
tests/test-admin-dir-deploy-uboot.sh
Executable file
@ -0,0 +1,79 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (C) 2011,2014 Colin Walters <walters@verbum.org>
|
||||
# Copyright (C) 2013 Javier Martinez <javier.martinez@collabora.co.uk>
|
||||
#
|
||||
# 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 -euo pipefail
|
||||
|
||||
. $(dirname $0)/libtest.sh
|
||||
|
||||
# Exports OSTREE_SYSROOT so --sysroot not needed.
|
||||
kver="3.6.0"
|
||||
modulesdir="usr/lib/modules/${kver}"
|
||||
setup_os_repository "archive" "uboot" ${modulesdir}
|
||||
|
||||
extra_admin_tests=2
|
||||
folders_instead_symlinks_in_boot=1
|
||||
|
||||
. $(dirname $0)/admin-test.sh
|
||||
|
||||
cd ${test_tmpdir}
|
||||
# Note this test actually requires a checksum change to /boot,
|
||||
# because adding the uEnv.txt isn't currently covered by the
|
||||
# "bootcsum".
|
||||
os_repository_new_commit "uboot test" "test upgrade multiple kernel args"
|
||||
mkdir -p osdata/usr/lib/ostree-boot
|
||||
cat << 'EOF' > osdata/usr/lib/ostree-boot/uEnv.txt
|
||||
loaduimage=load mmc ${bootpart} ${loadaddr} ${kernel_image}
|
||||
loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}${fdtfile}
|
||||
loadramdisk=load mmc ${bootpart} ${rdaddr} ${ramdisk_image}
|
||||
mmcargs=setenv bootargs $bootargs console=${console} ${optargs} root=${mmcroot} rootfstype=${mmcrootfstype}
|
||||
mmcboot=run loadramdisk; echo Booting from mmc ....; run mmcargs; bootz ${loadaddr} ${rdaddr} ${fdtaddr}
|
||||
EOF
|
||||
${CMD_PREFIX} ostree --repo=testos-repo commit --tree=dir=osdata/ -b testos/buildmain/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin upgrade --os=testos
|
||||
assert_file_has_content sysroot/boot/uEnv.txt "loadfdt="
|
||||
assert_file_has_content sysroot/boot/uEnv.txt "kernel_image="
|
||||
assert_file_has_content sysroot/boot/uEnv.txt "kernel_image2="
|
||||
assert_file_has_content sysroot/boot/uEnv.txt "kernel_image3="
|
||||
|
||||
echo "ok merging uEnv.txt files"
|
||||
|
||||
cd ${test_tmpdir}
|
||||
os_repository_new_commit "uboot test" "test with device tree directory"
|
||||
|
||||
devicetree_path=osdata/${modulesdir}/dtb/asoc-board.dtb
|
||||
devicetree_overlay_path=osdata/${modulesdir}/dtb/overlays/overlay.dtbo
|
||||
|
||||
mkdir -p osdata/${modulesdir}/dtb
|
||||
echo "a device tree" > ${devicetree_path}
|
||||
mkdir -p osdata/${modulesdir}/dtb/overlays
|
||||
echo "a device tree overlay" > ${devicetree_overlay_path}
|
||||
|
||||
bootcsum=$(
|
||||
(echo "new: a kernel uboot test" && echo "new: an initramfs uboot test" &&
|
||||
cat ${devicetree_path} ${devicetree_overlay_path} ) |
|
||||
sha256sum | cut -f 1 -d ' ')
|
||||
|
||||
${CMD_PREFIX} ostree --repo=testos-repo commit --tree=dir=osdata/ -b testos/buildmain/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin upgrade --os=testos
|
||||
assert_file_has_content sysroot/boot/uEnv.txt "fdtdir="
|
||||
assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/dtb/asoc-board.dtb 'a device tree'
|
||||
assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/dtb/overlays/overlay.dtbo 'a device tree overlay'
|
||||
|
||||
echo "ok deploying fdtdir"
|
Loading…
x
Reference in New Issue
Block a user