New upstream version 2021.3
This commit is contained in:
commit
5e89318de3
106 files changed
+4795
-3705
No files matched your search
+33
-33
@@ -53,11 +53,11 @@ assert_ostree_deployment_refs() {
|
||||
}
|
||||
|
||||
orig_mtime=$(stat -c '%.Y' sysroot/ostree/deploy)
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
|
||||
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
|
||||
${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)
|
||||
export rev
|
||||
# This initial deployment gets kicked off with some kernel arguments
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
${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}"
|
||||
${CMD_PREFIX} ostree admin status | tee status.txt
|
||||
@@ -66,9 +66,9 @@ assert_not_file_has_content status.txt "rollback"
|
||||
validate_bootloader
|
||||
|
||||
# Test the bootable and linux keys
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo --print-metadata-key=ostree.linux show testos:testos/buildmaster/x86_64-runtime >out.txt
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo --print-metadata-key=ostree.linux show testos:testos/buildmain/x86_64-runtime >out.txt
|
||||
assert_file_has_content_literal out.txt 3.6.0
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo --print-metadata-key=ostree.bootable show testos:testos/buildmaster/x86_64-runtime >out.txt
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo --print-metadata-key=ostree.bootable show testos:testos/buildmain/x86_64-runtime >out.txt
|
||||
assert_file_has_content_literal out.txt true
|
||||
|
||||
echo "ok deploy command"
|
||||
@@ -92,14 +92,14 @@ assert_ostree_deployment_refs 1/1/0
|
||||
${CMD_PREFIX} ostree admin status
|
||||
echo "ok layout"
|
||||
|
||||
if ${CMD_PREFIX} ostree admin deploy --stage --os=testos testos:testos/buildmaster/x86_64-runtime 2>err.txt; then
|
||||
if ${CMD_PREFIX} ostree admin deploy --stage --os=testos testos:testos/buildmain/x86_64-runtime 2>err.txt; then
|
||||
fatal "staged when not booted"
|
||||
fi
|
||||
assert_file_has_content_literal err.txt "Cannot stage deployment: Not currently booted into an OSTree system"
|
||||
echo "ok staging does not work when not booted"
|
||||
|
||||
orig_mtime=$(stat -c '%.Y' sysroot/ostree/deploy)
|
||||
${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmain/x86_64-runtime
|
||||
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
|
||||
@@ -119,7 +119,7 @@ validate_bootloader
|
||||
|
||||
echo "ok second deploy"
|
||||
|
||||
${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
${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
|
||||
@@ -134,7 +134,7 @@ echo "ok third deploy (swap)"
|
||||
|
||||
${CMD_PREFIX} ostree admin os-init otheros
|
||||
|
||||
${CMD_PREFIX} ostree admin deploy --os=otheros testos/buildmaster/x86_64-runtime
|
||||
${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
|
||||
assert_has_file sysroot/boot/loader/entries/ostree-2-testos.conf
|
||||
@@ -147,7 +147,7 @@ validate_bootloader
|
||||
|
||||
echo "ok independent deploy"
|
||||
|
||||
${CMD_PREFIX} ostree admin deploy --retain --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
${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
|
||||
assert_has_file sysroot/boot/loader/entries/ostree-4-testos.conf
|
||||
@@ -164,7 +164,7 @@ echo "a new local config file" > sysroot/ostree/deploy/testos/deploy/${rev}.3/et
|
||||
rm -r sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/testdirectory
|
||||
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/buildmaster/x86_64-runtime
|
||||
${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
|
||||
link=sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/a-new-broken-symlink
|
||||
@@ -189,7 +189,7 @@ done
|
||||
assert_has_file sysroot/boot/loader/entries/ostree-1-testos.conf
|
||||
assert_not_has_file sysroot/boot/loader/entries/ostree-2-testos.conf
|
||||
assert_not_has_file sysroot/boot/loader/entries/ostree-3-otheros.conf
|
||||
${CMD_PREFIX} ostree admin deploy --not-as-default --os=otheros testos:testos/buildmaster/x86_64-runtime
|
||||
${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
|
||||
assert_has_file sysroot/boot/loader/entries/ostree-2-testos.conf
|
||||
@@ -199,7 +199,7 @@ validate_bootloader
|
||||
|
||||
echo "ok deploy --not-as-default"
|
||||
|
||||
${CMD_PREFIX} ostree admin deploy --retain-rollback --os=otheros testos:testos/buildmaster/x86_64-runtime
|
||||
${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
|
||||
assert_has_file sysroot/boot/loader/entries/ostree-3-otheros.conf
|
||||
@@ -211,12 +211,12 @@ validate_bootloader
|
||||
echo "ok deploy --retain-rollback"
|
||||
|
||||
os_repository_new_commit
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
|
||||
newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos:testos/buildmaster/x86_64-runtime)
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmain/x86_64-runtime
|
||||
newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos:testos/buildmain/x86_64-runtime)
|
||||
export newrev
|
||||
assert_not_streq ${rev} ${newrev}
|
||||
|
||||
${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmain/x86_64-runtime
|
||||
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/os-release 'NAME=TestOS'
|
||||
# New files in /usr/etc
|
||||
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/a-new-default-config-file "a new default config file"
|
||||
@@ -234,24 +234,24 @@ if env OSTREE_EX_STAGE_DEPLOYMENTS=1 ${CMD_PREFIX} ostree admin upgrade --os=tes
|
||||
fi
|
||||
echo "ok upgrade failed when staged"
|
||||
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos file://$(pwd)/testos-repo testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos file://$(pwd)/testos-repo testos/buildmain/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin upgrade --os=testos
|
||||
origrev=${rev}
|
||||
rev=${newrev}
|
||||
newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
|
||||
newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime)
|
||||
assert_not_streq ${rev} ${newrev}
|
||||
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/os-release 'NAME=TestOS'
|
||||
${CMD_PREFIX} ostree admin status
|
||||
validate_bootloader
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo refs testos:testos > reftest.txt
|
||||
assert_file_has_content reftest.txt testos:buildmaster/x86_64-runtime
|
||||
assert_file_has_content reftest.txt testos:buildmain/x86_64-runtime
|
||||
|
||||
echo "ok upgrade"
|
||||
|
||||
originfile=$(${CMD_PREFIX} ostree admin --print-current-dir).origin
|
||||
cp ${originfile} saved-origin
|
||||
${CMD_PREFIX} ostree admin set-origin --index=0 bacon --set=gpg-verify=false http://tasty.com
|
||||
assert_file_has_content "${originfile}" "bacon:testos/buildmaster/x86_64-runtime"
|
||||
assert_file_has_content "${originfile}" "bacon:testos/buildmain/x86_64-runtime"
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote list -u > remotes.txt
|
||||
assert_file_has_content remotes.txt 'bacon.*http://tasty\.com'
|
||||
cp saved-origin ${originfile}
|
||||
@@ -272,22 +272,22 @@ validate_bootloader
|
||||
|
||||
echo "ok undeploy"
|
||||
|
||||
if ${CMD_PREFIX} ostree admin deploy --os=unknown testos:testos/buildmaster/x86_64-runtime; then
|
||||
if ${CMD_PREFIX} ostree admin deploy --os=unknown testos:testos/buildmain/x86_64-runtime; then
|
||||
assert_not_reached "Unexpected successful deploy of unknown OS"
|
||||
fi
|
||||
echo "ok deploy with unknown OS"
|
||||
|
||||
${CMD_PREFIX} ostree admin deploy --os=testos --karg-append=console=/dev/foo --karg-append=console=/dev/bar testos:testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin deploy --os=testos --karg-append=console=/dev/foo --karg-append=console=/dev/bar testos:testos/buildmain/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmain/x86_64-runtime
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-4-testos.conf 'console=/dev/foo.*console=/dev/bar'
|
||||
validate_bootloader
|
||||
|
||||
echo "ok deploy with multiple kernel args"
|
||||
|
||||
origrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
|
||||
origrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime)
|
||||
os_repository_new_commit 0 "test upgrade multiple kernel args"
|
||||
${CMD_PREFIX} ostree admin upgrade --os=testos
|
||||
newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
|
||||
newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime)
|
||||
assert_not_streq ${origrev} ${newrev}
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-4-testos.conf 'console=/dev/foo.*console=/dev/bar'
|
||||
validate_bootloader
|
||||
@@ -297,7 +297,7 @@ echo "ok upgrade with multiple kernel args"
|
||||
os_repository_new_commit
|
||||
${CMD_PREFIX} ostree admin upgrade --os=testos
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-4-testos.conf "^title TestOS 42 ${version} (ostree:testos:0)$"
|
||||
os_repository_new_commit 0 0 testos/buildmaster/x86_64-runtime 42
|
||||
os_repository_new_commit 0 0 testos/buildmain/x86_64-runtime 42
|
||||
${CMD_PREFIX} ostree admin upgrade --os=testos
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-4-testos.conf "^title TestOS 42 (ostree:testos:0)$"
|
||||
|
||||
@@ -310,8 +310,8 @@ sleep 1
|
||||
os_repository_new_commit
|
||||
# upgrade to the latest
|
||||
${CMD_PREFIX} ostree admin upgrade --os=testos
|
||||
head_rev=$(${CMD_PREFIX} ostree rev-parse --repo=sysroot/ostree/repo testos/buildmaster/x86_64-runtime)
|
||||
prev_rev=$(${CMD_PREFIX} ostree rev-parse --repo=sysroot/ostree/repo testos/buildmaster/x86_64-runtime^)
|
||||
head_rev=$(${CMD_PREFIX} ostree rev-parse --repo=sysroot/ostree/repo testos/buildmain/x86_64-runtime)
|
||||
prev_rev=$(${CMD_PREFIX} ostree rev-parse --repo=sysroot/ostree/repo testos/buildmain/x86_64-runtime^)
|
||||
assert_not_streq ${head_rev} ${prev_rev}
|
||||
# Don't use `ostree admin status | head -n 1` directly here because `head`
|
||||
# exiting early might cause SIGPIPE to ostree, which with `set -euo pipefail`
|
||||
@@ -342,14 +342,14 @@ sleep 1
|
||||
os_repository_new_commit
|
||||
sleep 1
|
||||
os_repository_new_commit
|
||||
${CMD_PREFIX} ostree pull --repo=sysroot/ostree/repo --commit-metadata-only --depth=-1 testos:testos/buildmaster/x86_64-runtime
|
||||
curr_rev=$(${CMD_PREFIX} ostree rev-parse --repo=sysroot/ostree/repo testos/buildmaster/x86_64-runtime)
|
||||
prev_rev=$(${CMD_PREFIX} ostree rev-parse --repo=sysroot/ostree/repo testos/buildmaster/x86_64-runtime^)
|
||||
${CMD_PREFIX} ostree pull --repo=sysroot/ostree/repo --commit-metadata-only --depth=-1 testos:testos/buildmain/x86_64-runtime
|
||||
curr_rev=$(${CMD_PREFIX} ostree rev-parse --repo=sysroot/ostree/repo testos/buildmain/x86_64-runtime)
|
||||
prev_rev=$(${CMD_PREFIX} ostree rev-parse --repo=sysroot/ostree/repo testos/buildmain/x86_64-runtime^)
|
||||
${CMD_PREFIX} ostree admin upgrade --os=testos --override-commit=${prev_rev}
|
||||
echo "ok upgrade to newer version older than branch tip"
|
||||
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --add-metadata-string "version=${version}" \
|
||||
--add-metadata-string 'ostree.source-title=libtest os_repository_new_commit()' -b testos/buildmaster/x86_64-runtime \
|
||||
--add-metadata-string 'ostree.source-title=libtest os_repository_new_commit()' -b testos/buildmain/x86_64-runtime \
|
||||
-s "Build" --tree=dir=${test_tmpdir}/osdata
|
||||
${CMD_PREFIX} ostree admin upgrade --os=testos
|
||||
${CMD_PREFIX} ostree admin status | tee status.txt
|
||||
@@ -381,7 +381,7 @@ assert_file_has_content sysroot/ostree/repo/config remote-test-config-dir
|
||||
echo "ok remote add nonphysical sysroot add-remotes-config-dir false"
|
||||
|
||||
if env OSTREE_SYSROOT_DEBUG="${OSTREE_SYSROOT_DEBUG},test-fifreeze" \
|
||||
${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmaster/x86_64-runtime 2>err.txt; then
|
||||
${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmain/x86_64-runtime 2>err.txt; then
|
||||
fatal "fifreeze-test exited successfully?"
|
||||
fi
|
||||
assert_file_has_content err.txt "fifreeze watchdog was run"
|
||||
|
||||
+1
-1
@@ -1017,7 +1017,7 @@ if ! skip_one_without_user_xattrs; then
|
||||
fi
|
||||
|
||||
cd ${test_tmpdir}
|
||||
${CMD_PREFIX} ostree --repo=repo remote --set=tls-permissive=true add aremote http://remote.example.com/repo testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree --repo=repo remote --set=tls-permissive=true add aremote http://remote.example.com/repo testos/buildmain/x86_64-runtime
|
||||
assert_file_has_content repo/config 'tls-permissive=true'
|
||||
assert_file_has_content repo/config 'remote\.example\.com'
|
||||
echo "ok remote add with set"
|
||||
|
||||
+28
-1
@@ -5,7 +5,8 @@
|
||||
#
|
||||
# Known copies are in the following repos:
|
||||
#
|
||||
# - https://github.com/projectatomic/rpm-ostree
|
||||
# - https://github.com/containers/bubblewrap
|
||||
# - https://github.com/coreos/rpm-ostree
|
||||
#
|
||||
# Copyright (C) 2017 Colin Walters <walters@verbum.org>
|
||||
#
|
||||
@@ -83,6 +84,18 @@ _fatal_print_file() {
|
||||
fatal "$@"
|
||||
}
|
||||
|
||||
_fatal_print_files() {
|
||||
file1="$1"
|
||||
shift
|
||||
file2="$1"
|
||||
shift
|
||||
ls -al "$file1" >&2
|
||||
sed -e 's/^/# /' < "$file1" >&2
|
||||
ls -al "$file2" >&2
|
||||
sed -e 's/^/# /' < "$file2" >&2
|
||||
fatal "$@"
|
||||
}
|
||||
|
||||
assert_not_has_file () {
|
||||
if test -f "$1"; then
|
||||
_fatal_print_file "$1" "File '$1' exists"
|
||||
@@ -156,8 +169,22 @@ assert_file_empty() {
|
||||
fi
|
||||
}
|
||||
|
||||
assert_files_equal() {
|
||||
if ! cmp "$1" "$2"; then
|
||||
_fatal_print_files "$1" "$2" "File '$1' and '$2' is not equal"
|
||||
fi
|
||||
}
|
||||
|
||||
# Use to skip all of these tests
|
||||
skip() {
|
||||
echo "1..0 # SKIP" "$@"
|
||||
exit 0
|
||||
}
|
||||
|
||||
report_err () {
|
||||
local exit_status="$?"
|
||||
{ { local BASH_XTRACEFD=3; } 2> /dev/null
|
||||
echo "Unexpected nonzero exit status $exit_status while running: $BASH_COMMAND" >&2
|
||||
} 3> /dev/null
|
||||
}
|
||||
trap report_err ERR
|
||||
+9
-4
@@ -78,6 +78,11 @@ unset TAR_OPTIONS
|
||||
# easily clean up.
|
||||
export OSTREE_SYSROOT_DEBUG=mutable-deployments
|
||||
|
||||
# By default, don't use a cache directory since it makes the tests racy.
|
||||
# Tests that are explicitly testing the cache operation should unset
|
||||
# this.
|
||||
export OSTREE_SKIP_CACHE=1
|
||||
|
||||
export TEST_GPG_KEYID_1="7FCA23D8472CDAFA"
|
||||
export TEST_GPG_KEYFPR_1="5E65DE75AB1C501862D476347FCA23D8472CDAFA"
|
||||
export TEST_GPG_KEYID_2="D8228CFECA950D41"
|
||||
@@ -442,12 +447,12 @@ EOF
|
||||
mkdir -p usr/etc/testdirectory
|
||||
echo "a default daemon file" > usr/etc/testdirectory/test
|
||||
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit ${bootable_flag} --add-metadata-string version=1.0.9 -b testos/buildmaster/x86_64-runtime -s "Build"
|
||||
${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
|
||||
sleep 2
|
||||
echo "a new executable" > usr/bin/sh
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit ${bootable_flag} --add-metadata-string version=1.0.10 -b testos/buildmaster/x86_64-runtime -s "Build"
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit ${bootable_flag} --add-metadata-string version=1.0.10 -b testos/buildmain/x86_64-runtime -s "Build"
|
||||
|
||||
cd ${test_tmpdir}
|
||||
rm -rf osdata-devel
|
||||
@@ -456,7 +461,7 @@ EOF
|
||||
cd osdata-devel
|
||||
mkdir -p usr/include
|
||||
echo "a development header" > usr/include/foo.h
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit ${bootable_flag} --add-metadata-string version=1.0.9 -b testos/buildmaster/x86_64-devel -s "Build"
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit ${bootable_flag} --add-metadata-string version=1.0.9 -b testos/buildmain/x86_64-devel -s "Build"
|
||||
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo fsck -q
|
||||
|
||||
@@ -503,7 +508,7 @@ os_repository_new_commit ()
|
||||
{
|
||||
boot_checksum_iteration=${1:-0}
|
||||
content_iteration=${2:-0}
|
||||
branch=${3:-testos/buildmaster/x86_64-runtime}
|
||||
branch=${3:-testos/buildmain/x86_64-runtime}
|
||||
export version=${4:-$(date "+%Y%m%d.${content_iteration}")}
|
||||
echo "BOOT ITERATION: $boot_checksum_iteration"
|
||||
cd ${test_tmpdir}/osdata
|
||||
|
||||
+10
-2
@@ -55,10 +55,10 @@ function verify_initial_contents() {
|
||||
}
|
||||
|
||||
if has_gpgme; then
|
||||
echo "1..36"
|
||||
echo "1..37"
|
||||
else
|
||||
# 3 tests needs GPG support
|
||||
echo "1..33"
|
||||
echo "1..34"
|
||||
fi
|
||||
|
||||
# Try both syntaxes
|
||||
@@ -142,6 +142,14 @@ ${CMD_PREFIX} ostree --repo=mirrorrepo pull origin main
|
||||
${CMD_PREFIX} ostree --repo=mirrorrepo fsck
|
||||
echo "ok pull (refuses deltas)"
|
||||
|
||||
${CMD_PREFIX} ostree --repo=mirrorrepo remote add broken badscheme://something
|
||||
if ${CMD_PREFIX} ostree --repo=mirrorrepo pull broken main 2>err.txt; then
|
||||
assert_not_reached "pulled from invalid"
|
||||
fi
|
||||
assert_file_has_content_literal err.txt "Invalid URI scheme in badscheme://something"
|
||||
${CMD_PREFIX} ostree --repo=mirrorrepo remote delete broken
|
||||
echo "ok clean error on invalid scheme"
|
||||
|
||||
cd ${test_tmpdir}
|
||||
rm mirrorrepo/refs/remotes/* -rf
|
||||
${CMD_PREFIX} ostree --repo=mirrorrepo prune --refs-only
|
||||
|
||||
@@ -28,11 +28,11 @@ setup_os_repository "archive" "syslinux"
|
||||
|
||||
echo "1..8"
|
||||
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
|
||||
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
|
||||
${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)
|
||||
export rev
|
||||
# This initial deployment gets kicked off with some kernel arguments
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime
|
||||
assert_has_dir sysroot/boot/ostree/testos-${bootcsum}
|
||||
|
||||
echo "ok deploy command"
|
||||
@@ -40,14 +40,14 @@ echo "ok deploy command"
|
||||
# Commit + upgrade twice, so that we'll rotate out the original deployment
|
||||
bootcsum1=${bootcsum}
|
||||
os_repository_new_commit
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos file://$(pwd)/testos-repo testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos file://$(pwd)/testos-repo testos/buildmain/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin upgrade --os=testos
|
||||
bootcsum2=${bootcsum}
|
||||
os_repository_new_commit "1"
|
||||
bootcsum3=${bootcsum}
|
||||
${CMD_PREFIX} ostree admin upgrade --os=testos
|
||||
|
||||
newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
|
||||
newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime)
|
||||
assert_not_streq ${rev} ${newrev}
|
||||
assert_not_streq ${bootcsum1} ${bootcsum2}
|
||||
assert_not_streq ${bootcsum2} ${bootcsum3}
|
||||
|
||||
@@ -28,16 +28,16 @@ setup_os_repository "archive" "syslinux"
|
||||
|
||||
echo "1..1"
|
||||
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
|
||||
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
|
||||
${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)
|
||||
export rev
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime
|
||||
os_repository_new_commit
|
||||
|
||||
rm sysroot/ostree/repo/tmp/* -rf
|
||||
export TEST_BOOTID=4072029c-8b10-60d1-d31b-8422eeff9b42
|
||||
if env OSTREE_REPO_TEST_ERROR=pre-commit OSTREE_BOOTID=${TEST_BOOTID} \
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime 2>err.txt; then
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime 2>err.txt; then
|
||||
assert_not_reached "Should have hit OSTREE_REPO_TEST_ERROR_PRE_COMMIT"
|
||||
fi
|
||||
stagepath=$(ls -d sysroot/ostree/repo/tmp/staging-${TEST_BOOTID}-*)
|
||||
@@ -47,12 +47,12 @@ assert_has_dir "${stagepath}"
|
||||
|
||||
export NEW_TEST_BOOTID=5072029c-8b10-60d1-d31b-8422eeff9b42
|
||||
if env OSTREE_REPO_TEST_ERROR=pre-commit OSTREE_BOOTID=${NEW_TEST_BOOTID} \
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=FOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime 2>err.txt; then
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=FOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime 2>err.txt; then
|
||||
assert_not_reached "Should have hit OSTREE_REPO_TEST_ERROR_PRE_COMMIT"
|
||||
fi
|
||||
newstagepath=$(ls -d sysroot/ostree/repo/tmp/staging-${NEW_TEST_BOOTID}-*)
|
||||
assert_has_dir "${newstagepath}"
|
||||
env OSTREE_BOOTID=${NEW_TEST_BOOTID} ${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
env OSTREE_BOOTID=${NEW_TEST_BOOTID} ${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime
|
||||
newstagepath=$(echo sysroot/ostree/repo/tmp/staging-${NEW_TEST_BOOTID}-*)
|
||||
assert_not_has_dir "${stagepath}"
|
||||
assert_not_has_dir "${newstagepath}"
|
||||
|
||||
@@ -28,10 +28,10 @@ setup_os_repository "archive" "syslinux"
|
||||
|
||||
echo "1..1"
|
||||
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
|
||||
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
|
||||
${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)
|
||||
export rev
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin undeploy 0
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo refs > refs.txt
|
||||
assert_not_file_has_content refs.txt '^ostree/'
|
||||
|
||||
@@ -28,12 +28,12 @@ setup_os_repository "archive" "syslinux"
|
||||
|
||||
echo "1..2"
|
||||
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
|
||||
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
|
||||
${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)
|
||||
export rev
|
||||
echo "rev=${rev}"
|
||||
# This initial deployment gets kicked off with some kernel arguments
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime
|
||||
assert_has_dir sysroot/boot/ostree/testos-${bootcsum}
|
||||
|
||||
etc=sysroot/ostree/deploy/testos/deploy/${rev}.0/etc
|
||||
@@ -58,9 +58,9 @@ rm ${etc}/testdirectory -rf
|
||||
|
||||
# Now deploy a new commit
|
||||
os_repository_new_commit
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos file://$(pwd)/testos-repo testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos file://$(pwd)/testos-repo testos/buildmain/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin upgrade --os=testos
|
||||
newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
|
||||
newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime)
|
||||
echo "newrev=${newrev}"
|
||||
newroot=sysroot/ostree/deploy/testos/deploy/${newrev}.0
|
||||
newetc=${newroot}/etc
|
||||
@@ -94,32 +94,32 @@ echo "ok"
|
||||
# Add /etc/initially-empty
|
||||
cd "${test_tmpdir}/osdata"
|
||||
mkdir -p usr/etc/initially-empty
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit -b testos/buildmaster/x86_64-runtime -s "Add empty directory"
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit -b testos/buildmain/x86_64-runtime -s "Add empty directory"
|
||||
cd ${test_tmpdir}
|
||||
|
||||
# Upgrade, check that we have it
|
||||
${CMD_PREFIX} ostree admin upgrade --os=testos
|
||||
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
|
||||
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime)
|
||||
assert_has_dir sysroot/ostree/deploy/testos/deploy/$rev.0/etc/initially-empty
|
||||
|
||||
# Now add a two files in initially-empty
|
||||
cd "${test_tmpdir}/osdata"
|
||||
touch usr/etc/initially-empty/{afile,bfile}
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit -b testos/buildmaster/x86_64-runtime -s "Add empty directory"
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit -b testos/buildmain/x86_64-runtime -s "Add empty directory"
|
||||
|
||||
# Upgrade, check that we have the two new files
|
||||
cd ${test_tmpdir}
|
||||
${CMD_PREFIX} ostree admin upgrade --os=testos
|
||||
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
|
||||
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime)
|
||||
assert_has_file sysroot/ostree/deploy/testos/deploy/$rev.0/etc/initially-empty/afile
|
||||
assert_has_file sysroot/ostree/deploy/testos/deploy/$rev.0/etc/initially-empty/bfile
|
||||
|
||||
# Replace config file with default directory
|
||||
cd "${test_tmpdir}/osdata"
|
||||
mkdir usr/etc/somenewdir
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit -b testos/buildmaster/x86_64-runtime -s "Add default dir"
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit -b testos/buildmain/x86_64-runtime -s "Add default dir"
|
||||
cd ${test_tmpdir}
|
||||
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
|
||||
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime)
|
||||
newconfpath=sysroot/ostree/deploy/testos/deploy/${rev}.0/etc/somenewdir
|
||||
echo "some content blah" > ${newconfpath}
|
||||
if ${CMD_PREFIX} ostree admin upgrade --os=testos 2>err.txt; then
|
||||
@@ -131,12 +131,12 @@ rm ${newconfpath}
|
||||
# Remove parent directory of modified config file
|
||||
cd "${test_tmpdir}/osdata"
|
||||
rm -rf usr/etc/initially-empty
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit -b testos/buildmaster/x86_64-runtime -s "Remove default dir"
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit -b testos/buildmain/x86_64-runtime -s "Remove default dir"
|
||||
cd ${test_tmpdir}
|
||||
newconfpath=sysroot/ostree/deploy/testos/deploy/${rev}.0/etc/initially-empty/mynewfile
|
||||
touch ${newconfpath}
|
||||
${CMD_PREFIX} ostree admin upgrade --os=testos
|
||||
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
|
||||
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime)
|
||||
assert_not_has_file sysroot/ostree/deploy/testos/deploy/${rev}.0/usr/etc/initially-empty
|
||||
assert_has_file sysroot/ostree/deploy/testos/deploy/${rev}.0/etc/initially-empty/mynewfile
|
||||
rm ${newconfpath}
|
||||
|
||||
@@ -28,23 +28,23 @@ setup_os_repository "archive" "syslinux"
|
||||
|
||||
echo "1..3"
|
||||
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
|
||||
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
|
||||
${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)
|
||||
export rev
|
||||
# This initial deployment gets kicked off with some kernel arguments
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin deploy --karg=FOO=BAR --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin deploy --karg=TESTARG=TESTVALUE --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin deploy --karg=FOO=BAR --os=testos testos:testos/buildmain/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin deploy --karg=TESTARG=TESTVALUE --os=testos testos:testos/buildmain/x86_64-runtime
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.*FOO=BAR'
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*FOO=BAR'
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*TESTARG=TESTVALUE'
|
||||
${CMD_PREFIX} ostree admin deploy --karg=ANOTHERARG=ANOTHERVALUE --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin deploy --karg=ANOTHERARG=ANOTHERVALUE --os=testos testos:testos/buildmain/x86_64-runtime
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*TESTARG=TESTVALUE'
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*ANOTHERARG=ANOTHERVALUE'
|
||||
|
||||
echo "ok deploy with --karg, but same config"
|
||||
|
||||
${CMD_PREFIX} ostree admin deploy --karg-proc-cmdline --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin deploy --karg-proc-cmdline --os=testos testos:testos/buildmain/x86_64-runtime
|
||||
for arg in $(cat /proc/cmdline); do
|
||||
case "$arg" in
|
||||
ostree=*) # Skip ostree arg that gets stripped out
|
||||
@@ -61,13 +61,13 @@ echo "ok deploy --karg-proc-cmdline"
|
||||
${CMD_PREFIX} ostree admin status
|
||||
${CMD_PREFIX} ostree admin undeploy 0
|
||||
|
||||
${CMD_PREFIX} ostree admin deploy --os=testos --karg-append=APPENDARG=VALAPPEND --karg-append=APPENDARG=2NDAPPEND testos:testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin deploy --os=testos --karg-append=APPENDARG=VALAPPEND --karg-append=APPENDARG=2NDAPPEND testos:testos/buildmain/x86_64-runtime
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*FOO=BAR'
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*TESTARG=TESTVALUE'
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*APPENDARG=VALAPPEND .*APPENDARG=2NDAPPEND'
|
||||
|
||||
# Check correct ordering of different-valued args of the same key.
|
||||
${CMD_PREFIX} ostree admin deploy --os=testos --karg-append=FOO=TESTORDERED --karg-append=APPENDARG=3RDAPPEND testos:testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin deploy --os=testos --karg-append=FOO=TESTORDERED --karg-append=APPENDARG=3RDAPPEND testos:testos/buildmain/x86_64-runtime
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*APPENDARG=VALAPPEND .*APPENDARG=2NDAPPEND .*FOO=TESTORDERED .*APPENDARG=3RDAPPEND'
|
||||
|
||||
echo "ok deploy --karg-append"
|
||||
@@ -25,15 +25,15 @@ set -euo pipefail
|
||||
|
||||
# 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/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmain/x86_64-runtime
|
||||
|
||||
echo "1..1"
|
||||
${CMD_PREFIX} ostree admin deploy --os=testos --karg=root=LABEL=foo --karg=testkarg=1 testos:testos/buildmaster/x86_64-runtime
|
||||
${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)
|
||||
testconfig=etc/modified-config-file-that-will-be-removed
|
||||
touch "${origdeployment}"/"${testconfig}"
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf "^options.*root=LABEL=foo.*testkarg"
|
||||
${CMD_PREFIX} ostree admin deploy --os=testos --no-merge --karg=root=LABEL=bar testos:testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin deploy --os=testos --no-merge --karg=root=LABEL=bar testos:testos/buildmain/x86_64-runtime
|
||||
deployment=$(${CMD_PREFIX} ostree admin --sysroot=sysroot --print-current-dir)
|
||||
assert_not_streq "${origdeployment}" "${deployment}"
|
||||
assert_not_has_file "${deployment}/${testconfig}"
|
||||
|
||||
@@ -34,12 +34,12 @@ extra_admin_tests=1
|
||||
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/buildmaster/x86_64-runtime
|
||||
${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/buildmaster/x86_64-runtime > out.txt
|
||||
${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-testos.conf 'options.* root=LABEL=MOO'
|
||||
assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/vmlinuz-3.6.0 'a kernel'
|
||||
|
||||
@@ -29,23 +29,23 @@ setup_os_repository "archive" "syslinux"
|
||||
echo "1..4"
|
||||
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos file://$(pwd)/testos-repo
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos:testos/buildmaster/x86_64-runtime)
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos testos/buildmain/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime
|
||||
newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos:testos/buildmain/x86_64-runtime)
|
||||
assert_not_has_file sysroot/ostree/deploy/testos/deploy/$newrev.0/usr/include/foo.h
|
||||
if ${CMD_PREFIX} ostree admin switch --os=testos testos/buildmaster/x86_64-runtime; then
|
||||
if ${CMD_PREFIX} ostree admin switch --os=testos testos/buildmain/x86_64-runtime; then
|
||||
assert_not_reached "Switch to same ref unexpectedly succeeded"
|
||||
fi
|
||||
echo "ok switch expected error"
|
||||
|
||||
${CMD_PREFIX} ostree admin switch --os=testos testos/buildmaster/x86_64-devel
|
||||
newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos:testos/buildmaster/x86_64-devel)
|
||||
${CMD_PREFIX} ostree admin switch --os=testos testos/buildmain/x86_64-devel
|
||||
newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos:testos/buildmain/x86_64-devel)
|
||||
assert_file_has_content sysroot/ostree/deploy/testos/deploy/$newrev.0/usr/include/foo.h 'header'
|
||||
|
||||
echo "ok switch"
|
||||
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false anothertestos file://$(pwd)/testos-repo
|
||||
${CMD_PREFIX} ostree admin switch --os=testos anothertestos:testos/buildmaster/x86_64-devel
|
||||
${CMD_PREFIX} ostree admin switch --os=testos anothertestos:testos/buildmain/x86_64-devel
|
||||
# Ok this is lame, need a better shell command to extract config, or switch to gjs
|
||||
${CMD_PREFIX} ostree admin status > status.txt
|
||||
assert_file_has_content status.txt anothertestos
|
||||
|
||||
@@ -35,9 +35,9 @@ 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/buildmaster/x86_64-runtime
|
||||
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
${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-testos.conf 'options.* root=LABEL=MOO'
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.* quiet'
|
||||
assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/vmlinuz-3.6.0 'a kernel'
|
||||
@@ -59,11 +59,11 @@ 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/buildmaster/x86_64-runtime -s "Build"
|
||||
${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/buildmaster/x86_64-runtime
|
||||
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
${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-testos.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'
|
||||
|
||||
@@ -46,7 +46,7 @@ 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/buildmaster/x86_64-runtime
|
||||
${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="
|
||||
@@ -71,7 +71,7 @@ bootcsum=$(
|
||||
cat ${devicetree_path} ${devicetree_overlay_path} ) |
|
||||
sha256sum | cut -f 1 -d ' ')
|
||||
|
||||
${CMD_PREFIX} ostree --repo=testos-repo commit --tree=dir=osdata/ -b testos/buildmaster/x86_64-runtime
|
||||
${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'
|
||||
|
||||
@@ -82,12 +82,12 @@ EOF
|
||||
mkdir -p usr/etc/testdirectory
|
||||
echo "a default daemon file" > usr/etc/testdirectory/test
|
||||
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --add-metadata-string version=1.0.9 -b testos/buildmaster/x86_64-runtime -s "Build" --gpg-sign=$keyid --gpg-homedir=${test_tmpdir}/gpghome
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --add-metadata-string version=1.0.9 -b testos/buildmain/x86_64-runtime -s "Build" --gpg-sign=$keyid --gpg-homedir=${test_tmpdir}/gpghome
|
||||
|
||||
# Ensure these commits have distinct second timestamps
|
||||
sleep 2
|
||||
echo "a new executable" > usr/bin/sh
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --add-metadata-string version=1.0.10 -b testos/buildmaster/x86_64-runtime -s "Build" --gpg-sign=$keyid --gpg-homedir=${test_tmpdir}/gpghome
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --add-metadata-string version=1.0.10 -b testos/buildmain/x86_64-runtime -s "Build" --gpg-sign=$keyid --gpg-homedir=${test_tmpdir}/gpghome
|
||||
|
||||
cd ${test_tmpdir}
|
||||
rm -rf osdata-devel
|
||||
@@ -96,7 +96,7 @@ EOF
|
||||
cd osdata-devel
|
||||
mkdir -p usr/include
|
||||
echo "a development header" > usr/include/foo.h
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --add-metadata-string version=1.0.9 -b testos/buildmaster/x86_64-devel -s "Build" --gpg-sign=$keyid --gpg-homedir=${test_tmpdir}/gpghome
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --add-metadata-string version=1.0.9 -b testos/buildmain/x86_64-devel -s "Build" --gpg-sign=$keyid --gpg-homedir=${test_tmpdir}/gpghome
|
||||
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo fsck -q
|
||||
|
||||
@@ -137,9 +137,9 @@ setup_os_repository_signed "archive" "syslinux"
|
||||
echo "1..2"
|
||||
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add testos $(cat httpd-address)/ostree/testos-repo
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --gpg-verify=true --remote=testos testos-repo testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --gpg-verify=true --remote=testos testos-repo testos/buildmain/x86_64-runtime
|
||||
# This initial deployment gets kicked off with some kernel arguments
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime
|
||||
assert_has_dir sysroot/boot/ostree/testos-${bootcsum}
|
||||
|
||||
echo "ok deploy command"
|
||||
|
||||
@@ -29,8 +29,8 @@ setup_os_repository "archive" "syslinux"
|
||||
|
||||
echo "1..5"
|
||||
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmain/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmain/x86_64-runtime
|
||||
|
||||
${CMD_PREFIX} ostree admin instutil set-kargs FOO=BAR
|
||||
${CMD_PREFIX} ostree admin instutil set-kargs FOO=BAZ FOO=BIF TESTARG=TESTVALUE KEYWORD EMPTYLIST=
|
||||
@@ -50,7 +50,7 @@ assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'option
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.*TESTARG=TESTVALUE KEYWORD EMPTYLIST='
|
||||
echo "ok instutil set-kargs --replace"
|
||||
|
||||
${CMD_PREFIX} ostree admin instutil set-kargs --merge --append=FOO=BAR --append=APPENDARG=VALAPPEND --append=APPENDARG=2NDAPPEND testos:testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin instutil set-kargs --merge --append=FOO=BAR --append=APPENDARG=VALAPPEND --append=APPENDARG=2NDAPPEND testos:testos/buildmain/x86_64-runtime
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.*FOO=XXX.*FOO=BAR'
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.*APPENDARG=VALAPPEND .*APPENDARG=2NDAPPEND'
|
||||
echo "ok instutil set-kargs --append"
|
||||
|
||||
@@ -36,12 +36,12 @@ echo "1..1"
|
||||
|
||||
cd ${test_tmpdir}
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos $(cat httpd-address)/ostree/testos-repo
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos testos/buildmaster/x86_64-runtime
|
||||
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos testos/buildmain/x86_64-runtime
|
||||
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime)
|
||||
export rev
|
||||
echo "rev=${rev}"
|
||||
# This initial deployment gets kicked off with some kernel arguments
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime
|
||||
assert_has_dir sysroot/boot/ostree/testos-${bootcsum}
|
||||
|
||||
parallel_cmd="parallel --gnu"
|
||||
@@ -50,7 +50,7 @@ if parallel --help | grep -q -e --no-notice; then
|
||||
fi
|
||||
|
||||
count=$(($(getconf _NPROCESSORS_ONLN) * 2))
|
||||
seq "${count}" | ${parallel_cmd} -n0 ${CMD_PREFIX} ostree admin deploy --retain --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
seq "${count}" | ${parallel_cmd} -n0 ${CMD_PREFIX} ostree admin deploy --retain --os=testos testos:testos/buildmain/x86_64-runtime
|
||||
|
||||
${CMD_PREFIX} ostree admin status > status.txt
|
||||
grep "testos ${rev}" status.txt | wc -l > status-matches.txt
|
||||
|
||||
@@ -31,8 +31,8 @@ setup_os_repository "archive" "syslinux"
|
||||
|
||||
cd ${test_tmpdir}
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos $(cat httpd-address)/ostree/testos-repo
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos testos/buildmaster/x86_64-runtime
|
||||
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos testos/buildmain/x86_64-runtime
|
||||
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime)
|
||||
parent_rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse ${rev}^)
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos ${parent_rev}
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos ${parent_rev}
|
||||
|
||||
@@ -31,11 +31,11 @@ setup_os_repository "archive" "syslinux"
|
||||
|
||||
cd ${test_tmpdir}
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos $(cat httpd-address)/ostree/testos-repo
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos testos/buildmaster/x86_64-runtime
|
||||
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos testos/buildmain/x86_64-runtime
|
||||
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime)
|
||||
parent_rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse ${rev}^)
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos testos/buildmaster/x86_64-runtime@${parent_rev}
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos testos/buildmain/x86_64-runtime@${parent_rev}
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime
|
||||
assert_has_dir sysroot/ostree/deploy/testos/deploy/${parent_rev}.0
|
||||
assert_not_has_dir sysroot/ostree/deploy/testos/deploy/${rev}.0
|
||||
# Do a pull, this one should get us new content
|
||||
@@ -47,7 +47,7 @@ assert_not_file_has_content out.txt 'No update available'
|
||||
assert_has_dir sysroot/ostree/deploy/testos/deploy/${parent_rev}.0
|
||||
assert_not_has_dir sysroot/ostree/deploy/testos/deploy/${rev}.0
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'TestOS 42 1\.0\.9'
|
||||
assert_streq "${rev}" $(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
|
||||
assert_streq "${rev}" $(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime)
|
||||
# Now, generate new content upstream; we shouldn't pull it
|
||||
os_repository_new_commit
|
||||
${CMD_PREFIX} ostree admin upgrade --os=testos --deploy-only --os=testos > out.txt
|
||||
|
||||
@@ -36,27 +36,27 @@ echo "1..3"
|
||||
|
||||
cd ${test_tmpdir}
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos $(cat httpd-address)/ostree/testos-repo
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos testos/buildmaster/x86_64-runtime
|
||||
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos testos/buildmain/x86_64-runtime
|
||||
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime)
|
||||
echo "rev=${rev}"
|
||||
|
||||
# Now sysroot/ostree has the objects from the testos-repo (obtained over http
|
||||
# and kept in remote "testos"), but there is no deployment
|
||||
|
||||
# This initial deployment gets kicked off with some kernel arguments
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime
|
||||
assert_has_dir sysroot/boot/ostree/testos-${bootcsum}
|
||||
|
||||
echo "ok deploy"
|
||||
|
||||
# Create a new branch which we want to migrate to
|
||||
os_repository_new_commit 1 1 testos/buildmaster/newbranch
|
||||
os_repository_new_commit 1 1 testos/buildmain/newbranch
|
||||
# bootcsum now refers to this new commit
|
||||
|
||||
# Create a new commit with an empty tree, which marks the original branch as
|
||||
# EOL, redirecting to the new one.
|
||||
mkdir empty
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --tree=dir=$(pwd)/empty --add-metadata-string "ostree.endoflife=Product discontinued" --add-metadata-string "ostree.endoflife-rebase=testos/buildmaster/newbranch" -b testos/buildmaster/x86_64-runtime -s "EOL redirect to new branch"
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --tree=dir=$(pwd)/empty --add-metadata-string "ostree.endoflife=Product discontinued" --add-metadata-string "ostree.endoflife-rebase=testos/buildmain/newbranch" -b testos/buildmain/x86_64-runtime -s "EOL redirect to new branch"
|
||||
|
||||
echo "ok new branch"
|
||||
|
||||
@@ -66,7 +66,7 @@ ${CMD_PREFIX} ostree admin upgrade --os=testos --deploy-only
|
||||
|
||||
# Check we got redirected to the new branch
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf "${bootcsum}"
|
||||
rev=$(${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo rev-parse testos/buildmaster/newbranch)
|
||||
rev=$(${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo rev-parse testos/buildmain/newbranch)
|
||||
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.0/usr/bin/content-iteration "1"
|
||||
|
||||
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.0.origin "newbranch"
|
||||
|
||||
@@ -28,7 +28,7 @@ setup_os_repository "archive" "syslinux"
|
||||
|
||||
echo "1..2"
|
||||
|
||||
ref=testos/buildmaster/x86_64-runtime
|
||||
ref=testos/buildmain/x86_64-runtime
|
||||
cd ${test_tmpdir}
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos $(cat httpd-address)/ostree/testos-repo
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos ${ref}
|
||||
|
||||
@@ -29,9 +29,9 @@ echo "1..2"
|
||||
# Setup a deployment
|
||||
cd ${test_tmpdir}
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos $(cat httpd-address)/ostree/testos-repo
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos testos/buildmaster/x86_64-runtime
|
||||
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
|
||||
${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos 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 --os=testos testos:testos/buildmain/x86_64-runtime
|
||||
assert_has_dir sysroot/ostree/deploy/testos/deploy/${rev}.0/usr
|
||||
assert_has_dir sysroot/ostree/deploy/testos/deploy/${rev}.0/etc
|
||||
assert_has_dir sysroot/ostree/deploy/testos/var
|
||||
@@ -50,7 +50,7 @@ touch -r ${usr} sysroot/ostree/deploy/testos/var/.updated
|
||||
# (current) deployment
|
||||
os_repository_new_commit
|
||||
${CMD_PREFIX} ostree admin upgrade --os=testos
|
||||
newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
|
||||
newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime)
|
||||
assert_not_has_file sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/.updated
|
||||
assert_not_has_file sysroot/ostree/deploy/testos/var/.updated
|
||||
assert_has_file sysroot/ostree/deploy/testos/deploy/${rev}.0/etc/.updated
|
||||
|
||||
@@ -28,15 +28,15 @@ setup_os_repository "archive" "syslinux"
|
||||
|
||||
echo "1..2"
|
||||
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
|
||||
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
|
||||
${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)
|
||||
export rev
|
||||
echo "rev=${rev}"
|
||||
# This initial deployment gets kicked off with some kernel arguments
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime
|
||||
echo "unconfigured-state=Use \"subscription-manager\" to enable online updates for example.com OS" >> sysroot/ostree/deploy/testos/deploy/${rev}.0.origin
|
||||
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos file://$(pwd)/testos-repo testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos file://$(pwd)/testos-repo testos/buildmain/x86_64-runtime
|
||||
if ${CMD_PREFIX} ostree admin upgrade --os=testos 2>err.txt; then
|
||||
assert_not_reached "upgrade unexpectedly succeeded"
|
||||
fi
|
||||
@@ -44,7 +44,7 @@ assert_file_has_content err.txt "Use.*subscription.*online"
|
||||
|
||||
echo "ok error"
|
||||
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false otheros file://$(pwd)/testos-repo testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin switch --os=testos otheros:testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false otheros file://$(pwd)/testos-repo testos/buildmain/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin switch --os=testos otheros:testos/buildmain/x86_64-runtime
|
||||
|
||||
echo "ok switch"
|
||||
Executable
+45
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# SPDX-License-Identifier: LGPL-2.0+
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
. $(dirname $0)/libtest.sh
|
||||
TZ='UTC'
|
||||
LANG='C'
|
||||
|
||||
echo "1..2"
|
||||
|
||||
# Explicit timestamp via CLI flag.
|
||||
mkdir testrepo
|
||||
ostree_repo_init testrepo --mode="archive"
|
||||
mkdir testrepo-files
|
||||
cd testrepo-files
|
||||
echo first > firstfile
|
||||
cd ..
|
||||
${CMD_PREFIX} ostree --repo=./testrepo commit -b cli --timestamp='@1234567890' -s "cli timestamp"
|
||||
${CMD_PREFIX} ostree --repo=./testrepo show cli > show-cli.txt
|
||||
rm -rf testrepo testrepo-files
|
||||
assert_file_has_content_literal show-cli.txt 'Date: 2009-02-13 23:31:30 +0000'
|
||||
echo "ok commit with CLI timestamp"
|
||||
|
||||
# Reproducible timestamp via env flag.
|
||||
mkdir testrepo
|
||||
ostree_repo_init testrepo --mode="archive"
|
||||
mkdir testrepo-files
|
||||
cd testrepo-files
|
||||
echo first > firstfile
|
||||
cd ..
|
||||
${CMD_PREFIX} SOURCE_DATE_EPOCH='1234567890' ostree --repo=./testrepo commit -b env -s "env timestamp"
|
||||
if (${CMD_PREFIX} SOURCE_DATE_EPOCH='invalid' ostree --repo=./testrepo commit -b env -s "invalid timestamp") 2> commit-invalid.txt; then
|
||||
assert_not_reached "commit with invalid timestamp succeeded"
|
||||
fi
|
||||
if (${CMD_PREFIX} SOURCE_DATE_EPOCH='12345678901234567890' ostree --repo=./testrepo commit -b env -s "overflowing timestamp") 2> commit-overflowing.txt; then
|
||||
assert_not_reached "commit with overflowing timestamp succeeded"
|
||||
fi
|
||||
${CMD_PREFIX} ostree --repo=./testrepo show env > show-env.txt
|
||||
rm -rf testrepo testrepo-files
|
||||
assert_file_has_content_literal commit-invalid.txt 'Failed to convert SOURCE_DATE_EPOCH'
|
||||
assert_file_has_content_literal commit-overflowing.txt 'Parsing SOURCE_DATE_EPOCH: Numerical result out of range'
|
||||
assert_file_has_content_literal show-env.txt 'Date: 2009-02-13 23:31:30 +0000'
|
||||
echo "ok commit with env timestamp"
|
||||
@@ -40,11 +40,15 @@ def mktree(dname, serial=0):
|
||||
f.write('{} {} {}\n'.format(dname, serial, v))
|
||||
|
||||
subprocess.check_call(['ostree', '--repo=repo', 'init', '--mode=bare'])
|
||||
# like the bit in libtest, but let's do it unconditionally since it's simpler,
|
||||
# and we don't need xattr coverage for this
|
||||
with open('repo/config', 'a') as f:
|
||||
# like the bit in libtest, but let's do it unconditionally since
|
||||
# it's simpler, and we don't need xattr coverage for this
|
||||
f.write('disable-xattrs=true\n')
|
||||
|
||||
# Make any locking errors fail quickly instead of blocking the test
|
||||
# for 30 seconds.
|
||||
f.write('lock-timeout-secs=5\n')
|
||||
|
||||
def commit(v):
|
||||
tdir='tree{}'.format(v)
|
||||
cmd = ['ostree', '--repo=repo', 'commit', '--fsync=0', '-b', tdir, '--tree=dir='+tdir]
|
||||
|
||||
@@ -134,4 +134,12 @@ w.write(inline_content.slice(10), null)
|
||||
let actual_checksum = w.finish(null)
|
||||
assertEquals(actual_checksum, networks_checksum)
|
||||
|
||||
// Basic locking API sanity test
|
||||
repo.lock_push(OSTree.RepoLockType.SHARED, null);
|
||||
repo.lock_push(OSTree.RepoLockType.SHARED, null);
|
||||
repo.lock_pop(OSTree.RepoLockType.SHARED, null);
|
||||
repo.lock_pop(OSTree.RepoLockType.SHARED, null);
|
||||
repo.lock_push(OSTree.RepoLockType.EXCLUSIVE, null);
|
||||
repo.lock_pop(OSTree.RepoLockType.EXCLUSIVE, null);
|
||||
|
||||
print("ok test-core");
|
||||
+31
-31
@@ -43,7 +43,7 @@ mkdir os-collection
|
||||
ostree_repo_init os-collection --collection-id org.example.OsCollection
|
||||
mkdir -p files
|
||||
pushd files
|
||||
${CMD_PREFIX} ostree --repo=../os-collection commit -s "Test os-collection commit 1" -b os/amd64/master --gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_2} > ../os-checksum
|
||||
${CMD_PREFIX} ostree --repo=../os-collection commit -s "Test os-collection commit 1" -b os/amd64/main --gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_2} > ../os-checksum
|
||||
popd
|
||||
${CMD_PREFIX} ostree --repo=os-collection summary --update --gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_2}
|
||||
|
||||
@@ -54,16 +54,16 @@ ${CMD_PREFIX} ostree --repo=local remote add apps-remote file://$(pwd)/apps-coll
|
||||
${CMD_PREFIX} ostree --repo=local remote add os-remote file://$(pwd)/os-collection --collection-id org.example.OsCollection --gpg-import=${test_tmpdir}/gpghome/key2.asc
|
||||
|
||||
${CMD_PREFIX} ostree --repo=local pull apps-remote app1
|
||||
${CMD_PREFIX} ostree --repo=local pull os-remote os/amd64/master
|
||||
${CMD_PREFIX} ostree --repo=local pull os-remote os/amd64/main
|
||||
|
||||
${CMD_PREFIX} ostree --repo=local refs > refs
|
||||
assert_file_has_content refs "^apps-remote:app1$"
|
||||
assert_file_has_content refs "^os-remote:os/amd64/master$"
|
||||
assert_file_has_content refs "^os-remote:os/amd64/main$"
|
||||
|
||||
${CMD_PREFIX} ostree --repo=local refs --collections > refs
|
||||
cat refs | wc -l > refscount
|
||||
assert_file_has_content refs "^(org\.example\.AppsCollection, app1)$"
|
||||
assert_file_has_content refs "^(org\.example\.OsCollection, os/amd64/master)$"
|
||||
assert_file_has_content refs "^(org\.example\.OsCollection, os/amd64/main)$"
|
||||
assert_file_has_content refscount "^2$"
|
||||
|
||||
# Create a local mirror repository where we pull the branches *in mirror mode* from the two remotes.
|
||||
@@ -74,7 +74,7 @@ ${CMD_PREFIX} ostree --repo=local-mirror remote add apps-remote file://$(pwd)/ap
|
||||
${CMD_PREFIX} ostree --repo=local-mirror remote add os-remote file://$(pwd)/os-collection --collection-id org.example.OsCollection --gpg-import=${test_tmpdir}/gpghome/key2.asc
|
||||
|
||||
${CMD_PREFIX} ostree --repo=local-mirror pull --mirror apps-remote app1
|
||||
${CMD_PREFIX} ostree --repo=local-mirror pull --mirror os-remote os/amd64/master
|
||||
${CMD_PREFIX} ostree --repo=local-mirror pull --mirror os-remote os/amd64/main
|
||||
|
||||
${CMD_PREFIX} ostree --repo=local-mirror refs | wc -l > refscount
|
||||
assert_file_has_content refscount "^0$"
|
||||
@@ -83,10 +83,10 @@ assert_file_has_content remotescount "^0$"
|
||||
|
||||
${CMD_PREFIX} ostree --repo=local-mirror refs --collections > refs
|
||||
assert_file_has_content refs "^(org\.example\.AppsCollection, app1)$"
|
||||
assert_file_has_content refs "^(org\.example\.OsCollection, os/amd64/master)$"
|
||||
assert_file_has_content refs "^(org\.example\.OsCollection, os/amd64/main)$"
|
||||
|
||||
assert_file_has_content local-mirror/refs/mirrors/org.example.AppsCollection/app1 "^$(cat app1-checksum)$"
|
||||
assert_file_has_content local-mirror/refs/mirrors/org.example.OsCollection/os/amd64/master "^$(cat os-checksum)$"
|
||||
assert_file_has_content local-mirror/refs/mirrors/org.example.OsCollection/os/amd64/main "^$(cat os-checksum)$"
|
||||
|
||||
for repo in local local-mirror; do
|
||||
# Try finding an update for an existing branch.
|
||||
@@ -98,25 +98,25 @@ for repo in local local-mirror; do
|
||||
assert_not_file_has_content find "^No results\.$"
|
||||
|
||||
# Find several updates for several existing branches.
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.AppsCollection app1 org.example.OsCollection os/amd64/master > find
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.AppsCollection app1 org.example.OsCollection os/amd64/main > find
|
||||
assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/apps-collection$"
|
||||
assert_file_has_content find "^ - Keyring: apps-remote\.trustedkeys\.gpg$"
|
||||
assert_file_has_content find "^ - (org\.example\.AppsCollection, app1) = $(cat app1-checksum)$"
|
||||
assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/os-collection$"
|
||||
assert_file_has_content find "^ - Keyring: os-remote\.trustedkeys\.gpg$"
|
||||
assert_file_has_content find "^ - (org\.example\.OsCollection, os/amd64/master) = $(cat os-checksum)$"
|
||||
assert_file_has_content find "^ - (org\.example\.OsCollection, os/amd64/main) = $(cat os-checksum)$"
|
||||
assert_file_has_content find "^2/2 refs were found\.$"
|
||||
assert_not_file_has_content find "^No results\.$"
|
||||
|
||||
# Find some updates and a new branch.
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.AppsCollection app1 org.example.AppsCollection app2 org.example.OsCollection os/amd64/master > find
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.AppsCollection app1 org.example.AppsCollection app2 org.example.OsCollection os/amd64/main > find
|
||||
assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/apps-collection$"
|
||||
assert_file_has_content find "^ - Keyring: apps-remote\.trustedkeys\.gpg$"
|
||||
assert_file_has_content find "^ - (org\.example\.AppsCollection, app1) = $(cat app1-checksum)$"
|
||||
assert_file_has_content find "^ - (org\.example\.AppsCollection, app2) = $(cat app2-checksum)$"
|
||||
assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/os-collection$"
|
||||
assert_file_has_content find "^ - Keyring: os-remote\.trustedkeys\.gpg$"
|
||||
assert_file_has_content find "^ - (org\.example\.OsCollection, os/amd64/master) = $(cat os-checksum)$"
|
||||
assert_file_has_content find "^ - (org\.example\.OsCollection, os/amd64/main) = $(cat os-checksum)$"
|
||||
assert_file_has_content find "^3/3 refs were found\.$"
|
||||
assert_not_file_has_content find "^No results\.$"
|
||||
|
||||
@@ -138,20 +138,20 @@ for repo in local local-mirror; do
|
||||
assert_not_file_has_content pull "Failed to pull some refs from the remotes"
|
||||
assert_ref $repo app1 $(cat app1-checksum)
|
||||
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.AppsCollection app1 org.example.OsCollection os/amd64/master > pull
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.AppsCollection app1 org.example.OsCollection os/amd64/main > pull
|
||||
assert_file_has_content pull "^2/2 refs were found\.$"
|
||||
assert_file_has_content pull "^Pulled 2/2 refs successfully\.$"
|
||||
assert_not_file_has_content pull "Failed to pull some refs from the remotes"
|
||||
assert_ref $repo app1 $(cat app1-checksum)
|
||||
assert_ref $repo os/amd64/master $(cat os-checksum)
|
||||
assert_ref $repo os/amd64/main $(cat os-checksum)
|
||||
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.AppsCollection app1 org.example.AppsCollection app2 org.example.OsCollection os/amd64/master > pull
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.AppsCollection app1 org.example.AppsCollection app2 org.example.OsCollection os/amd64/main > pull
|
||||
assert_file_has_content pull "^3/3 refs were found\.$"
|
||||
assert_file_has_content pull "^Pulled 3/3 refs successfully\.$"
|
||||
assert_not_file_has_content pull "Failed to pull some refs from the remotes"
|
||||
assert_ref $repo app1 $(cat app1-checksum)
|
||||
assert_ref $repo app2 $(cat app2-checksum)
|
||||
assert_ref $repo os/amd64/master $(cat os-checksum)
|
||||
assert_ref $repo os/amd64/main $(cat os-checksum)
|
||||
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.AppsCollection app1 org.example.AppsCollection not-an-app > pull
|
||||
assert_file_has_content pull "^1/2 refs were found\.$"
|
||||
@@ -162,30 +162,30 @@ done
|
||||
|
||||
# Test pulling a new commit into the local mirror from one of the repositories.
|
||||
pushd files
|
||||
${CMD_PREFIX} ostree --repo=../os-collection commit -s "Test os-collection commit 2" -b os/amd64/master --gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_2} > ../os-checksum-2
|
||||
${CMD_PREFIX} ostree --repo=../os-collection commit -s "Test os-collection commit 2" -b os/amd64/main --gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_2} > ../os-checksum-2
|
||||
popd
|
||||
${CMD_PREFIX} ostree --repo=os-collection summary --update --gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_2}
|
||||
|
||||
for repo in local-mirror; do
|
||||
# Try finding an update for that branch.
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.OsCollection os/amd64/master > find
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.OsCollection os/amd64/main > find
|
||||
assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/os-collection$"
|
||||
assert_file_has_content find "^ - Keyring: os-remote\.trustedkeys\.gpg$"
|
||||
assert_file_has_content find "^ - (org\.example\.OsCollection, os/amd64/master) = $(cat os-checksum-2)$"
|
||||
assert_file_has_content find "^ - (org\.example\.OsCollection, os/amd64/main) = $(cat os-checksum-2)$"
|
||||
assert_file_has_content find "^1/1 refs were found\.$"
|
||||
assert_not_file_has_content find "^No results\.$"
|
||||
|
||||
# Pull it.
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.OsCollection os/amd64/master > pull || true
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.OsCollection os/amd64/main > pull || true
|
||||
assert_file_has_content pull "^1/1 refs were found\.$"
|
||||
assert_file_has_content pull "^Pulled 1/1 refs successfully\.$"
|
||||
assert_not_file_has_content pull "Failed to pull some refs from the remotes"
|
||||
assert_ref $repo os/amd64/master $(cat os-checksum-2)
|
||||
assert_ref $repo os/amd64/main $(cat os-checksum-2)
|
||||
|
||||
# We need to manually update the refs afterwards, since the original pull
|
||||
# into the local-mirror was a --mirror pull — so it wrote refs/mirrors/blah.
|
||||
# This pull was not, so it wrote refs/remotes/blah.
|
||||
${CMD_PREFIX} ostree --repo=$repo refs --collections --create org.example.OsCollection:os/amd64/master os-remote:os/amd64/master
|
||||
${CMD_PREFIX} ostree --repo=$repo refs --collections --create org.example.OsCollection:os/amd64/main os-remote:os/amd64/main
|
||||
done
|
||||
|
||||
# Add the local mirror to the local repository as a remote, so that the local repo
|
||||
@@ -195,46 +195,46 @@ ${CMD_PREFIX} ostree --repo=local remote add os-remote-local-mirror file://$(pwd
|
||||
|
||||
for repo in local; do
|
||||
# Try finding an update for that branch.
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.OsCollection os/amd64/master > find
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.OsCollection os/amd64/main > find
|
||||
assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/os-collection$"
|
||||
assert_file_has_content find "^ - Keyring: os-remote\.trustedkeys\.gpg$"
|
||||
assert_file_has_content find "^ - (org\.example\.OsCollection, os/amd64/master) = $(cat os-checksum-2)$"
|
||||
assert_file_has_content find "^ - (org\.example\.OsCollection, os/amd64/main) = $(cat os-checksum-2)$"
|
||||
assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/local-mirror$"
|
||||
assert_file_has_content find "^ - Keyring: os-remote-local-mirror\.trustedkeys\.gpg$"
|
||||
assert_file_has_content find "^ - (org\.example\.OsCollection, os/amd64/master) = $(cat os-checksum-2)$"
|
||||
assert_file_has_content find "^ - (org\.example\.OsCollection, os/amd64/main) = $(cat os-checksum-2)$"
|
||||
assert_file_has_content find "^1/1 refs were found\.$"
|
||||
assert_not_file_has_content find "^No results\.$"
|
||||
|
||||
# Pull it.
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.OsCollection os/amd64/master > pull || true
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.OsCollection os/amd64/main > pull || true
|
||||
assert_file_has_content pull "^1/1 refs were found\.$"
|
||||
assert_file_has_content pull "^Pulled 1/1 refs successfully\.$"
|
||||
assert_not_file_has_content pull "Failed to pull some refs from the remotes"
|
||||
assert_ref $repo os/amd64/master $(cat os-checksum-2)
|
||||
assert_ref $repo os/amd64/main $(cat os-checksum-2)
|
||||
done
|
||||
|
||||
# Add another commit to the OS collection, but don’t update the mirror. Then try pulling
|
||||
# into the local repository again, and check that the outdated ref in the mirror is ignored.
|
||||
pushd files
|
||||
${CMD_PREFIX} ostree --repo=../os-collection commit -s "Test os-collection commit 3" -b os/amd64/master --gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_2} > ../os-checksum-3
|
||||
${CMD_PREFIX} ostree --repo=../os-collection commit -s "Test os-collection commit 3" -b os/amd64/main --gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_2} > ../os-checksum-3
|
||||
popd
|
||||
${CMD_PREFIX} ostree --repo=os-collection summary --update --gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_2}
|
||||
|
||||
for repo in local; do
|
||||
# Try finding an update for that branch.
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.OsCollection os/amd64/master > find
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.OsCollection os/amd64/main > find
|
||||
assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/os-collection$"
|
||||
assert_file_has_content find "^ - Keyring: os-remote\.trustedkeys\.gpg$"
|
||||
assert_file_has_content find "^ - (org\.example\.OsCollection, os/amd64/master) = $(cat os-checksum-3)$"
|
||||
assert_file_has_content find "^ - (org\.example\.OsCollection, os/amd64/main) = $(cat os-checksum-3)$"
|
||||
assert_file_has_content find "^1/1 refs were found\.$"
|
||||
assert_not_file_has_content find "^No results\.$"
|
||||
|
||||
# Pull it.
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.OsCollection os/amd64/master > pull || true
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.OsCollection os/amd64/main > pull || true
|
||||
assert_file_has_content pull "^1/1 refs were found\.$"
|
||||
assert_file_has_content pull "^Pulled 1/1 refs successfully\.$"
|
||||
assert_not_file_has_content pull "Failed to pull some refs from the remotes"
|
||||
assert_ref $repo os/amd64/master $(cat os-checksum-3)
|
||||
assert_ref $repo os/amd64/main $(cat os-checksum-3)
|
||||
done
|
||||
|
||||
echo "ok find-remotes"
|
||||
@@ -235,7 +235,6 @@ assert_file_has_content test2-show "${key1_id}"
|
||||
assert_file_has_content test2-show "${key2_sub_id}"
|
||||
assert_file_has_content test2-show 'Good signature from "Test Key 1 <>"'
|
||||
assert_file_has_content test2-show 'BAD signature from "Test Key 2 <>"'
|
||||
assert_not_file_has_content test2-show 'Key expired'
|
||||
assert_file_has_content test2-show "Primary key ID ${key2_id}"
|
||||
assert_file_has_content test2-show 'Primary key expired'
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ setup_os_repository "archive-z2" "uboot"
|
||||
cd ${test_tmpdir}
|
||||
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos $(cat httpd-address)/ostree/testos-repo
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=rootfs --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos testos/buildmain/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=rootfs --os=testos testos:testos/buildmain/x86_64-runtime
|
||||
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'root=LABEL=rootfs'
|
||||
assert_not_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'init='
|
||||
@@ -47,8 +47,8 @@ pull_test_tree() {
|
||||
exit 1
|
||||
fi
|
||||
cd -
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --tree=dir=osdata/ -b testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree pull testos:testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --tree=dir=osdata/ -b testos/buildmain/x86_64-runtime
|
||||
${CMD_PREFIX} ostree pull testos:testos/buildmain/x86_64-runtime
|
||||
}
|
||||
|
||||
get_key_from_bootloader_conf() {
|
||||
@@ -62,7 +62,7 @@ get_key_from_bootloader_conf() {
|
||||
for layout in /usr/lib/modules /usr/lib/ostree-boot /boot;
|
||||
do
|
||||
pull_test_tree "the kernel only"
|
||||
${CMD_PREFIX} ostree admin deploy --os=testos --karg=root=/dev/sda2 --karg=rootwait testos:testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin deploy --os=testos --karg=root=/dev/sda2 --karg=rootwait testos:testos/buildmain/x86_64-runtime
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'rootwait'
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'init='
|
||||
assert_not_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'initrd'
|
||||
@@ -70,7 +70,7 @@ do
|
||||
echo "ok switching to bootdir with no initramfs layout=$layout"
|
||||
|
||||
pull_test_tree "the kernel" "initramfs to assist the kernel"
|
||||
${CMD_PREFIX} ostree admin deploy --os=testos --karg-none --karg=root=LABEL=rootfs testos:testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin deploy --os=testos --karg-none --karg=root=LABEL=rootfs testos:testos/buildmain/x86_64-runtime
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'initrd'
|
||||
assert_file_has_content sysroot/boot/$(get_key_from_bootloader_conf sysroot/boot/loader/entries/ostree-2-testos.conf "initrd") "initramfs to assist the kernel"
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'root=LABEL=rootfs'
|
||||
@@ -80,7 +80,7 @@ do
|
||||
echo "ok switching from no initramfs to initramfs enabled sysroot layout=$layout"
|
||||
|
||||
pull_test_tree "the kernel" "" "my .dtb file"
|
||||
${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmain/x86_64-runtime
|
||||
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'init='
|
||||
assert_file_has_content sysroot/boot/"$(get_key_from_bootloader_conf sysroot/boot/loader/entries/ostree-2-testos.conf 'devicetree')" "my \.dtb file"
|
||||
|
||||
@@ -41,17 +41,17 @@ echo "a device tree" > ${devicetree_path}
|
||||
mkdir -p osdata/${modulesdir}/dtb/overlays
|
||||
echo "a device tree overlay" > ${devicetree_overlay_path}
|
||||
|
||||
${CMD_PREFIX} ostree --repo=testos-repo commit --tree=dir=osdata/ -b testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos file://$(pwd)/testos-repo testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} env OSTREE_SYSROOT_DEBUG=${OSTREE_SYSROOT_DEBUG},no-dtb ostree admin deploy --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree --repo=testos-repo commit --tree=dir=osdata/ -b testos/buildmain/x86_64-runtime
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmain/x86_64-runtime
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos file://$(pwd)/testos-repo testos/buildmain/x86_64-runtime
|
||||
${CMD_PREFIX} env OSTREE_SYSROOT_DEBUG=${OSTREE_SYSROOT_DEBUG},no-dtb ostree admin deploy --os=testos testos:testos/buildmain/x86_64-runtime
|
||||
assert_has_file sysroot/boot/ostree/testos-${bootcsum}/vmlinuz-3.6.0
|
||||
assert_not_has_file sysroot/boot/ostree/testos-${bootcsum}/dtb/asoc-board.dtb 'a device tree'
|
||||
assert_streq $(ls sysroot/boot/ostree | wc -l) 1
|
||||
assert_streq $(find sysroot/boot/ostree -name '*.dtb' | wc -l) 0
|
||||
${CMD_PREFIX} ostree --repo=testos-repo commit --tree=dir=osdata/ -b testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree --repo=testos-repo commit --tree=dir=osdata/ -b testos/buildmain/x86_64-runtime
|
||||
env OSTREE_SYSROOT_DEBUG=${OSTREE_SYSROOT_DEBUG},no-dtb ${CMD_PREFIX} ostree admin upgrade --os=testos
|
||||
${CMD_PREFIX} ostree --repo=testos-repo commit --tree=dir=osdata/ -b testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree --repo=testos-repo commit --tree=dir=osdata/ -b testos/buildmain/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin upgrade --os=testos
|
||||
assert_streq $(ls sysroot/boot/ostree | wc -l) 2
|
||||
# Note that the bootcsum computed by the test suite doesn't include devicetree
|
||||
|
||||
@@ -31,6 +31,9 @@ if ! has_gpgme; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Ensure repo caching is in use.
|
||||
unset OSTREE_SKIP_CACHE
|
||||
|
||||
COMMIT_SIGN="--gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_1}"
|
||||
|
||||
echo "1..1"
|
||||
|
||||
@@ -23,6 +23,9 @@ set -euo pipefail
|
||||
|
||||
. $(dirname $0)/libtest.sh
|
||||
|
||||
# Ensure repo caching is in use.
|
||||
unset OSTREE_SKIP_CACHE
|
||||
|
||||
COMMIT_SIGN=""
|
||||
if has_gpgme; then
|
||||
COMMIT_SIGN="--gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_1}"
|
||||
|
||||
@@ -112,7 +112,7 @@ test_repo_finder_config_no_configs (Fixture *fixture,
|
||||
g_autoptr(GPtrArray) results = NULL; /* (element-type OstreeRepoFinderResult) */
|
||||
g_autoptr(GError) error = NULL;
|
||||
const OstreeCollectionRef ref1 = { "org.example.Os", "exampleos/x86_64/standard" };
|
||||
const OstreeCollectionRef ref2 = { "org.example.Os", "exampleos/x86_64/buildmaster/standard" };
|
||||
const OstreeCollectionRef ref2 = { "org.example.Os", "exampleos/x86_64/buildmain/standard" };
|
||||
const OstreeCollectionRef * const refs[] = { &ref1, &ref2, NULL };
|
||||
|
||||
context = g_main_context_new ();
|
||||
|
||||
@@ -125,7 +125,7 @@ test_repo_finder_mount_no_mounts (Fixture *fixture,
|
||||
g_autoptr(GPtrArray) results = NULL; /* (element-type OstreeRepoFinderResult) */
|
||||
g_autoptr(GError) error = NULL;
|
||||
const OstreeCollectionRef ref1 = { "org.example.Collection1", "exampleos/x86_64/standard" };
|
||||
const OstreeCollectionRef ref2 = { "org.example.Collection1", "exampleos/x86_64/buildmaster/standard" };
|
||||
const OstreeCollectionRef ref2 = { "org.example.Collection1", "exampleos/x86_64/buildmain/standard" };
|
||||
const OstreeCollectionRef ref3 = { "org.example.Collection2", "exampleos/x86_64/standard" };
|
||||
const OstreeCollectionRef ref4 = { "org.example.Collection2", "exampleos/arm64/standard" };
|
||||
const OstreeCollectionRef * const refs[] = { &ref1, &ref2, &ref3, &ref4, NULL };
|
||||
|
||||
@@ -51,6 +51,29 @@ setup (Fixture *fixture,
|
||||
g_test_message ("Using temporary directory: %s", fixture->tmpdir.path);
|
||||
}
|
||||
|
||||
/* Common setup for locking tests. Create an archive repo in the tmpdir and
|
||||
* set the locking timeout to 0 so lock failures don't block.
|
||||
*/
|
||||
static void
|
||||
lock_setup (Fixture *fixture,
|
||||
gconstpointer test_data)
|
||||
{
|
||||
setup (fixture, test_data);
|
||||
|
||||
g_autoptr(GError) error = NULL;
|
||||
g_autoptr(OstreeRepo) repo = ostree_repo_create_at (fixture->tmpdir.fd, ".",
|
||||
OSTREE_REPO_MODE_ARCHIVE,
|
||||
NULL,
|
||||
NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
/* Set the lock timeout to 0 so failures don't block the test */
|
||||
g_autoptr(GKeyFile) config = ostree_repo_copy_config (repo);
|
||||
g_key_file_set_integer (config, "core", "lock-timeout-secs", 0);
|
||||
ostree_repo_write_config (repo, config, &error);
|
||||
g_assert_no_error (error);
|
||||
}
|
||||
|
||||
static void
|
||||
teardown (Fixture *fixture,
|
||||
gconstpointer test_data)
|
||||
@@ -249,6 +272,301 @@ test_write_regfile_api (Fixture *fixture,
|
||||
g_assert_cmpstr (checksum, ==, "23a2e97d21d960ac7a4e39a8721b1baff7b213e00e5e5641334f50506012fcff");
|
||||
}
|
||||
|
||||
/* Just a sanity check of the C autolocking API */
|
||||
static void
|
||||
test_repo_autolock (Fixture *fixture,
|
||||
gconstpointer test_data)
|
||||
{
|
||||
g_autoptr(GError) error = NULL;
|
||||
g_autoptr(OstreeRepo) repo = ostree_repo_create_at (fixture->tmpdir.fd, ".",
|
||||
OSTREE_REPO_MODE_ARCHIVE,
|
||||
NULL,
|
||||
NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
{
|
||||
g_autoptr(OstreeRepoAutoLock) lock = ostree_repo_auto_lock_push (repo, OSTREE_REPO_LOCK_EXCLUSIVE, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
}
|
||||
|
||||
g_autoptr(OstreeRepoAutoLock) lock1 = ostree_repo_auto_lock_push (repo, OSTREE_REPO_LOCK_SHARED, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_autoptr(OstreeRepoAutoLock) lock2 = ostree_repo_auto_lock_push (repo, OSTREE_REPO_LOCK_SHARED, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
}
|
||||
|
||||
/* Locking from single thread with a single OstreeRepo */
|
||||
static void
|
||||
test_repo_lock_single (Fixture *fixture,
|
||||
gconstpointer test_data)
|
||||
{
|
||||
g_autoptr(GError) error = NULL;
|
||||
g_autoptr(OstreeRepo) repo = ostree_repo_open_at (fixture->tmpdir.fd, ".",
|
||||
NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
/* Single thread on a single repo can freely recurse in any state */
|
||||
ostree_repo_lock_push (repo, OSTREE_REPO_LOCK_SHARED, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
ostree_repo_lock_push (repo, OSTREE_REPO_LOCK_EXCLUSIVE, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
ostree_repo_lock_push (repo, OSTREE_REPO_LOCK_SHARED, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
ostree_repo_lock_pop (repo, OSTREE_REPO_LOCK_SHARED, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
ostree_repo_lock_pop (repo, OSTREE_REPO_LOCK_EXCLUSIVE, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
ostree_repo_lock_pop (repo, OSTREE_REPO_LOCK_SHARED, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
}
|
||||
|
||||
/* Unlocking without having ever locked */
|
||||
static void
|
||||
test_repo_lock_unlock_never_locked (Fixture *fixture,
|
||||
gconstpointer test_data)
|
||||
{
|
||||
if (g_test_subprocess ())
|
||||
{
|
||||
g_autoptr(GError) error = NULL;
|
||||
g_autoptr(OstreeRepo) repo = ostree_repo_open_at (fixture->tmpdir.fd, ".",
|
||||
NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
ostree_repo_lock_pop (repo, OSTREE_REPO_LOCK_SHARED, NULL, &error);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
g_test_trap_subprocess (NULL, 0, 0);
|
||||
g_test_trap_assert_failed ();
|
||||
g_test_trap_assert_stderr ("*ERROR*Cannot pop repo never locked repo lock\n");
|
||||
}
|
||||
|
||||
/* Unlocking after already unlocked */
|
||||
static void
|
||||
test_repo_lock_double_unlock (Fixture *fixture,
|
||||
gconstpointer test_data)
|
||||
{
|
||||
if (g_test_subprocess ())
|
||||
{
|
||||
g_autoptr(GError) error = NULL;
|
||||
g_autoptr(OstreeRepo) repo = ostree_repo_open_at (fixture->tmpdir.fd, ".",
|
||||
NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
ostree_repo_lock_push (repo, OSTREE_REPO_LOCK_SHARED, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
ostree_repo_lock_pop (repo, OSTREE_REPO_LOCK_SHARED, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
ostree_repo_lock_pop (repo, OSTREE_REPO_LOCK_SHARED, NULL, &error);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
g_test_trap_subprocess (NULL, 0, 0);
|
||||
g_test_trap_assert_failed ();
|
||||
g_test_trap_assert_stderr ("*ERROR*Cannot pop already unlocked repo lock\n");
|
||||
}
|
||||
|
||||
/* Unlocking the wrong type */
|
||||
static void
|
||||
test_repo_lock_unlock_wrong_type (Fixture *fixture,
|
||||
gconstpointer test_data)
|
||||
{
|
||||
if (g_test_subprocess ())
|
||||
{
|
||||
g_autoptr(GError) error = NULL;
|
||||
g_autoptr(OstreeRepo) repo = ostree_repo_open_at (fixture->tmpdir.fd, ".",
|
||||
NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
ostree_repo_lock_push (repo, OSTREE_REPO_LOCK_SHARED, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
ostree_repo_lock_pop (repo, OSTREE_REPO_LOCK_EXCLUSIVE, NULL, &error);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
g_test_trap_subprocess (NULL, 0, 0);
|
||||
g_test_trap_assert_failed ();
|
||||
g_test_trap_assert_stderr ("*ERROR*Repo exclusive lock pop requested, but none have been taken\n");
|
||||
}
|
||||
|
||||
/* Locking with single thread and multiple OstreeRepos */
|
||||
static void
|
||||
test_repo_lock_multi_repo (Fixture *fixture,
|
||||
gconstpointer test_data)
|
||||
{
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
/* Open two OstreeRepo instances */
|
||||
g_autoptr(OstreeRepo) repo1 = ostree_repo_open_at (fixture->tmpdir.fd, ".",
|
||||
NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_autoptr(OstreeRepo) repo2 = ostree_repo_open_at (fixture->tmpdir.fd, ".",
|
||||
NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
/* Single thread with multiple OstreeRepo's conflict */
|
||||
ostree_repo_lock_push (repo1, OSTREE_REPO_LOCK_SHARED, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
ostree_repo_lock_push (repo2, OSTREE_REPO_LOCK_SHARED, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
ostree_repo_lock_push (repo1, OSTREE_REPO_LOCK_EXCLUSIVE, NULL, &error);
|
||||
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK);
|
||||
g_clear_error (&error);
|
||||
ostree_repo_lock_pop (repo1, OSTREE_REPO_LOCK_SHARED, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
ostree_repo_lock_pop (repo2, OSTREE_REPO_LOCK_SHARED, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
/* Recursive lock should stay exclusive once acquired */
|
||||
ostree_repo_lock_push (repo1, OSTREE_REPO_LOCK_EXCLUSIVE, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
ostree_repo_lock_push (repo1, OSTREE_REPO_LOCK_SHARED, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
ostree_repo_lock_push (repo2, OSTREE_REPO_LOCK_SHARED, NULL, &error);
|
||||
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK);
|
||||
g_clear_error (&error);
|
||||
ostree_repo_lock_push (repo2, OSTREE_REPO_LOCK_EXCLUSIVE, NULL, &error);
|
||||
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK);
|
||||
g_clear_error (&error);
|
||||
ostree_repo_lock_pop (repo1, OSTREE_REPO_LOCK_SHARED, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
ostree_repo_lock_pop (repo1, OSTREE_REPO_LOCK_EXCLUSIVE, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
}
|
||||
|
||||
/* Locking from multiple threads with a single OstreeRepo */
|
||||
typedef struct {
|
||||
OstreeRepo *repo;
|
||||
guint step;
|
||||
} LockThreadData;
|
||||
|
||||
static gpointer
|
||||
lock_thread1 (gpointer thread_data)
|
||||
{
|
||||
LockThreadData *data = thread_data;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
/* Step 0: Take an exclusive lock */
|
||||
g_assert_cmpuint (data->step, ==, 0);
|
||||
g_test_message ("Thread 1: Push exclusive lock");
|
||||
ostree_repo_lock_push (data->repo, OSTREE_REPO_LOCK_EXCLUSIVE, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
data->step++;
|
||||
|
||||
/* Step 2: Take a shared lock */
|
||||
while (data->step != 2)
|
||||
g_thread_yield ();
|
||||
g_test_message ("Thread 1: Push shared lock");
|
||||
ostree_repo_lock_push (data->repo, OSTREE_REPO_LOCK_SHARED, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
data->step++;
|
||||
|
||||
/* Step 4: Pop both locks */
|
||||
while (data->step != 4)
|
||||
g_thread_yield ();
|
||||
g_test_message ("Thread 1: Pop shared lock");
|
||||
ostree_repo_lock_pop (data->repo, OSTREE_REPO_LOCK_SHARED, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_test_message ("Thread 1: Pop exclusive lock");
|
||||
ostree_repo_lock_pop (data->repo, OSTREE_REPO_LOCK_EXCLUSIVE, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
data->step++;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gpointer
|
||||
lock_thread2 (gpointer thread_data)
|
||||
{
|
||||
LockThreadData *data = thread_data;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
/* Step 1: Wait for the other thread to acquire a lock and then take a
|
||||
* shared lock.
|
||||
*/
|
||||
while (data->step != 1)
|
||||
g_thread_yield ();
|
||||
g_test_message ("Thread 2: Push shared lock");
|
||||
ostree_repo_lock_push (data->repo, OSTREE_REPO_LOCK_SHARED, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
data->step++;
|
||||
|
||||
/* Step 6: Pop lock */
|
||||
while (data->step != 6)
|
||||
g_thread_yield ();
|
||||
g_test_message ("Thread 2: Pop shared lock");
|
||||
ostree_repo_lock_pop (data->repo, OSTREE_REPO_LOCK_SHARED, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
data->step++;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
test_repo_lock_multi_thread (Fixture *fixture,
|
||||
gconstpointer test_data)
|
||||
{
|
||||
g_autoptr(GError) error = NULL;
|
||||
g_autoptr(OstreeRepo) repo1 = ostree_repo_open_at (fixture->tmpdir.fd, ".",
|
||||
NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_autoptr(OstreeRepo) repo2 = ostree_repo_open_at (fixture->tmpdir.fd, ".",
|
||||
NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
LockThreadData thread_data = {repo1, 0};
|
||||
GThread *thread1 = g_thread_new ("lock-thread-1", lock_thread1, &thread_data);
|
||||
GThread *thread2 = g_thread_new ("lock-thread-2", lock_thread2, &thread_data);
|
||||
|
||||
/* Step 3: Try to take a shared lock on repo2. This should fail since
|
||||
* thread1 still has an exclusive lock.
|
||||
*/
|
||||
while (thread_data.step != 3)
|
||||
g_thread_yield ();
|
||||
g_test_message ("Repo 2: Push failing shared lock");
|
||||
ostree_repo_lock_push (repo2, OSTREE_REPO_LOCK_SHARED, NULL, &error);
|
||||
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK);
|
||||
g_clear_error (&error);
|
||||
thread_data.step++;
|
||||
|
||||
/* Step 5: Try to a lock on repo2. A shared lock should succeed since
|
||||
* thread1 has dropped its exclusive lock.
|
||||
*/
|
||||
while (thread_data.step != 5)
|
||||
g_thread_yield ();
|
||||
g_test_message ("Repo 2: Push shared lock");
|
||||
ostree_repo_lock_push (repo2, OSTREE_REPO_LOCK_SHARED, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_test_message ("Repo 2: Push failing exclusive lock");
|
||||
ostree_repo_lock_push (repo2, OSTREE_REPO_LOCK_EXCLUSIVE, NULL, &error);
|
||||
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK);
|
||||
g_clear_error (&error);
|
||||
thread_data.step++;
|
||||
|
||||
/* Step 7: Now both threads have dropped their locks and taking an exclusive
|
||||
* lock should succeed.
|
||||
*/
|
||||
while (thread_data.step != 7)
|
||||
g_thread_yield ();
|
||||
g_test_message ("Repo 2: Push exclusive lock");
|
||||
ostree_repo_lock_push (repo2, OSTREE_REPO_LOCK_EXCLUSIVE, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_test_message ("Repo 2: Pop exclusive lock");
|
||||
ostree_repo_lock_pop (repo2, OSTREE_REPO_LOCK_EXCLUSIVE, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_test_message ("Repo 2: Pop shared lock");
|
||||
ostree_repo_lock_pop (repo2, OSTREE_REPO_LOCK_SHARED, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
thread_data.step++;
|
||||
|
||||
g_thread_join (thread1);
|
||||
g_thread_join (thread2);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char **argv)
|
||||
@@ -266,6 +584,20 @@ main (int argc,
|
||||
test_repo_get_min_free_space, teardown);
|
||||
g_test_add ("/repo/write_regfile_api", Fixture, NULL, setup,
|
||||
test_write_regfile_api, teardown);
|
||||
g_test_add ("/repo/autolock", Fixture, NULL, setup,
|
||||
test_repo_autolock, teardown);
|
||||
g_test_add ("/repo/lock/single", Fixture, NULL, lock_setup,
|
||||
test_repo_lock_single, teardown);
|
||||
g_test_add ("/repo/lock/unlock-never-locked", Fixture, NULL, lock_setup,
|
||||
test_repo_lock_unlock_never_locked, teardown);
|
||||
g_test_add ("/repo/lock/double-unlock", Fixture, NULL, lock_setup,
|
||||
test_repo_lock_double_unlock, teardown);
|
||||
g_test_add ("/repo/lock/unlock-wrong-type", Fixture, NULL, lock_setup,
|
||||
test_repo_lock_unlock_wrong_type, teardown);
|
||||
g_test_add ("/repo/lock/multi-repo", Fixture, NULL, lock_setup,
|
||||
test_repo_lock_multi_repo, teardown);
|
||||
g_test_add ("/repo/lock/multi-thread", Fixture, NULL, lock_setup,
|
||||
test_repo_lock_multi_thread, teardown);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
@@ -27,6 +27,9 @@ set -euo pipefail
|
||||
|
||||
echo "1..14"
|
||||
|
||||
# Ensure repo caching is in use.
|
||||
unset OSTREE_SKIP_CACHE
|
||||
|
||||
# This is explicitly opt in for testing
|
||||
export OSTREE_DUMMY_SIGN_ENABLED=1
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ echo 'ok documented symbols'
|
||||
|
||||
# ONLY update this checksum in release commits!
|
||||
cat > released-sha256.txt <<EOF
|
||||
d42f7000de88e3c7280c2d55ad3a5e2e7a8d968758fe1d66a95863e2f5269d3c ${released_syms}
|
||||
d4eb6d642150d9285b399c7a429603124aeda4215d3f62b92ad3956f04dd2dfe ${released_syms}
|
||||
EOF
|
||||
sha256sum -c released-sha256.txt
|
||||
|
||||
|
||||
@@ -53,10 +53,10 @@ test_sysroot_reload (gconstpointer data)
|
||||
goto out;
|
||||
g_assert (!changed);
|
||||
|
||||
if (!run_sync ("ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime", &error))
|
||||
if (!run_sync ("ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmain/x86_64-runtime", &error))
|
||||
goto out;
|
||||
|
||||
if (!run_sync ("ostree admin --sysroot=sysroot deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime", &error))
|
||||
if (!run_sync ("ostree admin --sysroot=sysroot deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime", &error))
|
||||
goto out;
|
||||
|
||||
if (!ostree_sysroot_load_if_changed (sysroot, &changed, NULL, &error))
|
||||
|
||||
@@ -49,7 +49,7 @@ GLib.setenv("OSTREE_SYSROOT_DEBUG", "mutable-deployments", true);
|
||||
let upstreamRepo = OSTree.Repo.new(Gio.File.new_for_path('testos-repo'));
|
||||
upstreamRepo.open(null);
|
||||
|
||||
let runtimeRef = 'testos/buildmaster/x86_64-runtime';
|
||||
let runtimeRef = 'testos/buildmain/x86_64-runtime';
|
||||
let [,rev] = upstreamRepo.resolve_rev(runtimeRef, false);
|
||||
|
||||
print("testos => " + rev);
|
||||
|
||||
Reference in new issue
Block a user