tests: Export OSTREE_SYSROOT in setup_os_repository

Eliminates the need for constantly passing --sysroot=sysroot, but
also makes ostree place remote configs for sysroot/ostree/repo in
sysroot/etc/ostree/remotes.d where they should have been all along.
This commit is contained in:
Matthew Barnes 2015-07-14 13:30:05 -04:00
parent 254def3584
commit df0cae4375
13 changed files with 83 additions and 71 deletions

View File

@ -31,13 +31,13 @@ ${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testo
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
export rev
# This initial deployment gets kicked off with some kernel arguments
${CMD_PREFIX} ostree admin --sysroot=sysroot deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
${CMD_PREFIX} ostree admin --sysroot=sysroot status | tee status.txt
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
${CMD_PREFIX} ostree admin status | tee status.txt
validate_bootloader
echo "ok deploy command"
${CMD_PREFIX} ostree admin --sysroot=sysroot --print-current-dir > curdir
${CMD_PREFIX} ostree admin --print-current-dir > curdir
assert_file_has_content curdir ^`pwd`/sysroot/ostree/deploy/testos/deploy/${rev}.0$
echo "ok --print-current-dir"
@ -51,12 +51,12 @@ assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'option
assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/vmlinuz-3.6.0 'a kernel'
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.0/etc/os-release 'NAME=TestOS'
assert_file_has_content sysroot/ostree/boot.1/testos/${bootcsum}/0/etc/os-release 'NAME=TestOS'
${CMD_PREFIX} ostree admin --sysroot=sysroot status
${CMD_PREFIX} ostree admin status
echo "ok layout"
${CMD_PREFIX} ostree admin --sysroot=sysroot deploy --os=testos testos:testos/buildmaster/x86_64-runtime
${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmaster/x86_64-runtime
# Need a new bootversion, sine we now have two deployments
assert_has_dir sysroot/boot/loader.0
assert_not_has_dir sysroot/boot/loader.1
@ -68,45 +68,45 @@ assert_not_has_dir sysroot/ostree/boot.1.1
assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'options.* root=LABEL=MOO'
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.1/etc/os-release 'NAME=TestOS'
assert_file_has_content sysroot/ostree/boot.0/testos/${bootcsum}/0/etc/os-release 'NAME=TestOS'
${CMD_PREFIX} ostree admin --sysroot=sysroot status
${CMD_PREFIX} ostree admin status
validate_bootloader
echo "ok second deploy"
${CMD_PREFIX} ostree admin --sysroot=sysroot deploy --os=testos testos:testos/buildmaster/x86_64-runtime
${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmaster/x86_64-runtime
# Keep the same bootversion
assert_has_dir sysroot/boot/loader.0
assert_not_has_dir sysroot/boot/loader.1
# But swap subbootversion
assert_has_dir sysroot/ostree/boot.0.0
assert_not_has_dir sysroot/ostree/boot.0.1
${CMD_PREFIX} ostree admin --sysroot=sysroot status
${CMD_PREFIX} ostree admin status
validate_bootloader
echo "ok third deploy (swap)"
${CMD_PREFIX} ostree admin --sysroot=sysroot os-init otheros
${CMD_PREFIX} ostree admin os-init otheros
${CMD_PREFIX} ostree admin --sysroot=sysroot deploy --os=otheros testos/buildmaster/x86_64-runtime
${CMD_PREFIX} ostree admin deploy --os=otheros testos/buildmaster/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-testos-1.conf
assert_has_file sysroot/boot/loader/entries/ostree-otheros-0.conf
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.1/etc/os-release 'NAME=TestOS'
assert_file_has_content sysroot/ostree/deploy/otheros/deploy/${rev}.0/etc/os-release 'NAME=TestOS'
${CMD_PREFIX} ostree admin --sysroot=sysroot status
${CMD_PREFIX} ostree admin status
validate_bootloader
echo "ok independent deploy"
${CMD_PREFIX} ostree admin --sysroot=sysroot deploy --retain --os=testos testos:testos/buildmaster/x86_64-runtime
${CMD_PREFIX} ostree admin deploy --retain --os=testos testos:testos/buildmaster/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-testos-0.conf
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.2/etc/os-release 'NAME=TestOS'
assert_has_file sysroot/boot/loader/entries/ostree-testos-2.conf
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/os-release 'NAME=TestOS'
${CMD_PREFIX} ostree admin --sysroot=sysroot status
${CMD_PREFIX} ostree admin status
validate_bootloader
echo "ok fourth deploy (retain)"
@ -115,14 +115,14 @@ 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 --sysroot=sysroot deploy --retain --os=testos testos:testos/buildmaster/x86_64-runtime
${CMD_PREFIX} ostree admin deploy --retain --os=testos testos:testos/buildmaster/x86_64-runtime
linktarget=$(readlink sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/a-new-broken-symlink)
test "${linktarget}" = /ENOENT
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/os-release 'NAME=TestOS'
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/os-release 'NAME=TestOS'
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/a-new-config-file 'a new local config file'
assert_not_has_file sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/aconfigfile
${CMD_PREFIX} ostree admin --sysroot=sysroot status
${CMD_PREFIX} ostree admin status
validate_bootloader
echo "ok deploy with modified /etc"
@ -133,34 +133,34 @@ newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos:testos
export newrev
assert_not_streq ${rev} ${newrev}
${CMD_PREFIX} ostree admin --sysroot=sysroot deploy --os=testos testos:testos/buildmaster/x86_64-runtime
${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmaster/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"
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/new-default-dir/moo "a new default dir and file"
# And persist /etc changes from before
assert_not_has_file sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/aconfigfile
${CMD_PREFIX} ostree admin --sysroot=sysroot status
${CMD_PREFIX} ostree admin status
validate_bootloader
echo "ok upgrade bare"
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 admin --sysroot=sysroot upgrade --os=testos
${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)
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 --sysroot=sysroot status
${CMD_PREFIX} ostree admin status
validate_bootloader
echo "ok upgrade"
originfile=$(${CMD_PREFIX} ostree admin --sysroot=sysroot --print-current-dir).origin
originfile=$(${CMD_PREFIX} ostree admin --print-current-dir).origin
cp ${originfile} saved-origin
${CMD_PREFIX} ostree admin --sysroot=sysroot set-origin --index=0 bacon --set=gpg-verify=false http://tasty.com
${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"
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote list -u > remotes.txt
assert_file_has_content remotes.txt 'bacon.*http://tasty.com'
@ -171,24 +171,24 @@ echo "ok set-origin"
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.0/etc/os-release 'NAME=TestOS'
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/os-release 'NAME=TestOS'
${CMD_PREFIX} ostree admin --sysroot=sysroot undeploy 1
${CMD_PREFIX} ostree admin undeploy 1
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/os-release 'NAME=TestOS'
assert_not_has_dir sysroot/ostree/deploy/testos/deploy/${rev}.0
${CMD_PREFIX} ostree admin --sysroot=sysroot undeploy 0
${CMD_PREFIX} ostree admin undeploy 0
assert_not_has_dir sysroot/ostree/deploy/testos/deploy/${newrev}.0
${CMD_PREFIX} ostree admin --sysroot=sysroot status
${CMD_PREFIX} ostree admin status
validate_bootloader
echo "ok undeploy"
if ${CMD_PREFIX} ostree admin --sysroot=sysroot deploy --os=unknown testos:testos/buildmaster/x86_64-runtime; then
if ${CMD_PREFIX} ostree admin deploy --os=unknown testos:testos/buildmaster/x86_64-runtime; then
assert_not_reached "Unexpected successful deploy of unknown OS"
fi
echo "ok deploy with unknown OS"
${CMD_PREFIX} ostree admin --sysroot=sysroot deploy --os=testos --karg-append=console=/dev/foo --karg-append=console=/dev/bar testos:testos/buildmaster/x86_64-runtime
${CMD_PREFIX} ostree admin --sysroot=sysroot 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/buildmaster/x86_64-runtime
${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmaster/x86_64-runtime
assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'console=/dev/foo.*console=/dev/bar'
validate_bootloader
@ -196,7 +196,7 @@ echo "ok deploy with multiple kernel args"
origrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
os_repository_new_commit 0 "test upgrade multiple kernel args"
${CMD_PREFIX} ostree admin --sysroot=sysroot upgrade --os=testos
${CMD_PREFIX} ostree admin upgrade --os=testos
newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
assert_not_streq ${origrev} ${newrev}
assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'console=/dev/foo.*console=/dev/bar'

View File

@ -255,8 +255,9 @@ EOF
cd ${test_tmpdir}
mkdir sysroot
${CMD_PREFIX} ostree admin --sysroot=sysroot init-fs sysroot
${CMD_PREFIX} ostree admin --sysroot=sysroot os-init testos
export OSTREE_SYSROOT=sysroot
${CMD_PREFIX} ostree admin init-fs sysroot
${CMD_PREFIX} ostree admin os-init testos
case $bootmode in
"syslinux")

View File

@ -23,6 +23,7 @@ set -e
echo "1..1"
# Exports OSTREE_SYSROOT so --sysroot not needed.
setup_os_repository "archive-z2" "syslinux"
echo "ok setup"
@ -33,7 +34,7 @@ ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
export rev
# This initial deployment gets kicked off with some kernel arguments
ostree admin --sysroot=sysroot deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
assert_has_dir sysroot/boot/ostree/testos-${bootcsum}
echo "ok deploy command"
@ -42,11 +43,11 @@ echo "ok deploy command"
bootcsum1=${bootcsum}
os_repository_new_commit
ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos file://$(pwd)/testos-repo testos/buildmaster/x86_64-runtime
ostree admin --sysroot=sysroot upgrade --os=testos
ostree admin upgrade --os=testos
bootcsum2=${bootcsum}
os_repository_new_commit "1"
bootcsum3=${bootcsum}
ostree admin --sysroot=sysroot upgrade --os=testos
ostree admin upgrade --os=testos
rev=${newrev}
newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
@ -60,7 +61,7 @@ assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/os-r
echo "ok deploy and GC /boot"
ostree admin --sysroot=sysroot cleanup
ostree admin cleanup
assert_has_dir sysroot/boot/ostree/testos-${bootcsum}
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/os-release 'NAME=TestOS'

View File

@ -23,6 +23,7 @@ set -e
echo "1..1"
# Exports OSTREE_SYSROOT so --sysroot not needed.
setup_os_repository "archive-z2" "syslinux"
echo "ok setup"
@ -34,7 +35,7 @@ rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmast
export rev
echo "rev=${rev}"
# This initial deployment gets kicked off with some kernel arguments
${CMD_PREFIX} ostree admin --sysroot=sysroot 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/buildmaster/x86_64-runtime
assert_has_dir sysroot/boot/ostree/testos-${bootcsum}
etc=sysroot/ostree/deploy/testos/deploy/${rev}.0/etc
@ -60,7 +61,7 @@ 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 admin --sysroot=sysroot upgrade --os=testos
${CMD_PREFIX} ostree admin upgrade --os=testos
newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
echo "newrev=${newrev}"
newroot=sysroot/ostree/deploy/testos/deploy/${newrev}.0
@ -99,7 +100,7 @@ ${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit -b testos/buildmas
cd ${test_tmpdir}
# Upgrade, check that we have it
${CMD_PREFIX} ostree admin --sysroot=sysroot upgrade --os=testos
${CMD_PREFIX} ostree admin upgrade --os=testos
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
assert_has_dir sysroot/ostree/deploy/testos/deploy/$rev.0/etc/initially-empty
@ -110,7 +111,7 @@ ${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit -b testos/buildmas
# Upgrade, check that we have the two new files
cd ${test_tmpdir}
${CMD_PREFIX} ostree admin --sysroot=sysroot upgrade --os=testos
${CMD_PREFIX} ostree admin upgrade --os=testos
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/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
@ -123,7 +124,7 @@ cd ${test_tmpdir}
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
newconfpath=sysroot/ostree/deploy/testos/deploy/${rev}.0/etc/somenewdir
echo "some content blah" > ${newconfpath}
if ${CMD_PREFIX} ostree admin --sysroot=sysroot upgrade --os=testos 2>err.txt; then
if ${CMD_PREFIX} ostree admin upgrade --os=testos 2>err.txt; then
assert_not_reached "upgrade should have failed"
fi
assert_file_has_content err.txt "Modified config file newly defaults to directory"
@ -136,7 +137,7 @@ ${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit -b testos/buildmas
cd ${test_tmpdir}
newconfpath=sysroot/ostree/deploy/testos/deploy/${rev}.0/etc/initially-empty/mynewfile
touch ${newconfpath}
${CMD_PREFIX} ostree admin --sysroot=sysroot upgrade --os=testos
${CMD_PREFIX} ostree admin upgrade --os=testos
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/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

View File

@ -23,6 +23,7 @@ set -e
echo "1..1"
# Exports OSTREE_SYSROOT so --sysroot not needed.
setup_os_repository "archive-z2" "grub2"
echo "ok setup"

View File

@ -23,6 +23,7 @@ set -e
echo "1..1"
# Exports OSTREE_SYSROOT so --sysroot not needed.
setup_os_repository "archive-z2" "syslinux"
echo "ok setup"
@ -33,19 +34,19 @@ ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
export rev
# This initial deployment gets kicked off with some kernel arguments
ostree admin --sysroot=sysroot deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
ostree admin --sysroot=sysroot deploy --karg=FOO=BAR --os=testos testos:testos/buildmaster/x86_64-runtime
ostree admin --sysroot=sysroot deploy --karg=TESTARG=TESTVALUE --os=testos testos:testos/buildmaster/x86_64-runtime
ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
ostree admin deploy --karg=FOO=BAR --os=testos testos:testos/buildmaster/x86_64-runtime
ostree admin deploy --karg=TESTARG=TESTVALUE --os=testos testos:testos/buildmaster/x86_64-runtime
assert_file_has_content sysroot/boot/loader/entries/ostree-testos-1.conf 'options.*FOO=BAR'
assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'options.*FOO=BAR'
assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'options.*TESTARG=TESTVALUE'
ostree admin --sysroot=sysroot deploy --karg=ANOTHERARG=ANOTHERVALUE --os=testos testos:testos/buildmaster/x86_64-runtime
ostree admin deploy --karg=ANOTHERARG=ANOTHERVALUE --os=testos testos:testos/buildmaster/x86_64-runtime
assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'options.*TESTARG=TESTVALUE'
assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'options.*ANOTHERARG=ANOTHERVALUE'
echo "ok deploy with --karg, but same config"
ostree admin --sysroot=sysroot deploy --karg-proc-cmdline --os=testos testos:testos/buildmaster/x86_64-runtime
ostree admin deploy --karg-proc-cmdline --os=testos testos:testos/buildmaster/x86_64-runtime
# Here we're asserting that the *host* system has a root= kernel
# argument. I think it's unlikely that anyone doesn't have one, but
# if this is not true for you, please file a bug!
@ -53,10 +54,10 @@ assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'option
echo "ok deploy --karg-proc-cmdline"
ostree admin --sysroot=sysroot status
ostree admin --sysroot=sysroot undeploy 0
ostree admin status
ostree admin undeploy 0
ostree admin --sysroot=sysroot deploy --os=testos --karg-append=APPENDARG=VALAPPEND --karg-append=APPENDARG=2NDAPPEND testos:testos/buildmaster/x86_64-runtime
ostree admin deploy --os=testos --karg-append=APPENDARG=VALAPPEND --karg-append=APPENDARG=2NDAPPEND testos:testos/buildmaster/x86_64-runtime
assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'options.*FOO=BAR'
assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'options.*TESTARG=TESTVALUE'
assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'options.*APPENDARG=VALAPPEND .*APPENDARG=2NDAPPEND'

View File

@ -23,6 +23,7 @@ set -e
echo "1..1"
# Exports OSTREE_SYSROOT so --sysroot not needed.
setup_os_repository "archive-z2" "syslinux"
echo "ok setup"
@ -31,28 +32,28 @@ echo "1..3"
${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 --sysroot=sysroot 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/buildmaster/x86_64-runtime
newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos:testos/buildmaster/x86_64-runtime)
assert_not_has_file sysroot/ostree/deploy/testos/deploy/$newrev.0/usr/include/foo.h
if ${CMD_PREFIX} ostree admin --sysroot=sysroot switch --os=testos testos/buildmaster/x86_64-runtime; then
if ${CMD_PREFIX} ostree admin switch --os=testos testos/buildmaster/x86_64-runtime; then
assert_not_reached "Switch to same ref unexpectedly succeeded"
fi
echo "ok switch expected error"
${CMD_PREFIX} ostree admin --sysroot=sysroot switch --os=testos testos/buildmaster/x86_64-devel
${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)
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 --sysroot=sysroot switch --os=testos anothertestos:testos/buildmaster/x86_64-devel
${CMD_PREFIX} ostree admin switch --os=testos anothertestos:testos/buildmaster/x86_64-devel
# Ok this is lame, need a better shell command to extract config, or switch to gjs
${CMD_PREFIX} ostree admin --sysroot=sysroot status > status.txt
${CMD_PREFIX} ostree admin status > status.txt
assert_file_has_content status.txt anothertestos
echo "ok switch remotes"
${CMD_PREFIX} ostree admin --sysroot=sysroot switch --os=testos testos:
${CMD_PREFIX} ostree admin switch --os=testos testos:
echo "ok switch remote only"

View File

@ -23,6 +23,7 @@ set -e
echo "1..1"
# Exports OSTREE_SYSROOT so --sysroot not needed.
setup_os_repository "archive-z2" "syslinux"
echo "ok setup"

View File

@ -24,6 +24,7 @@ set -e
echo "1..1"
# Exports OSTREE_SYSROOT so --sysroot not needed.
setup_os_repository "archive-z2" "uboot"
echo "ok setup"

View File

@ -24,6 +24,7 @@ set -e
echo "1..1"
# Exports OSTREE_SYSROOT so --sysroot not needed.
setup_os_repository "archive-z2" "syslinux"
echo "ok setup"
@ -31,32 +32,32 @@ echo "ok setup"
echo "1..5"
ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
ostree admin --sysroot=sysroot deploy --os=testos testos:testos/buildmaster/x86_64-runtime
ostree admin deploy --os=testos testos:testos/buildmaster/x86_64-runtime
ostree admin --sysroot=sysroot instutil set-kargs FOO=BAR
ostree admin --sysroot=sysroot instutil set-kargs FOO=BAZ FOO=BIF TESTARG=TESTVALUE
ostree admin instutil set-kargs FOO=BAR
ostree admin instutil set-kargs FOO=BAZ FOO=BIF TESTARG=TESTVALUE
assert_not_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'options.*FOO=BAR'
assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'options.*FOO=BAZ .*FOO=BIF'
assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'options.*TESTARG=TESTVALUE'
echo "ok instutil set-kargs (basic)"
ostree admin --sysroot=sysroot instutil set-kargs --merge FOO=BAR
ostree admin instutil set-kargs --merge FOO=BAR
assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'options.*FOO=BAZ .*FOO=BIF .*FOO=BAR'
assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'options.*TESTARG=TESTVALUE'
echo "ok instutil set-kargs --merge"
ostree admin --sysroot=sysroot instutil set-kargs --merge --replace=FOO=XXX
ostree admin instutil set-kargs --merge --replace=FOO=XXX
assert_not_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'options.*FOO=BAR'
assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'options.*FOO=XXX'
assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'options.*TESTARG=TESTVALUE'
echo "ok instutil set-kargs --replace"
ostree admin --sysroot=sysroot instutil set-kargs --merge --append=FOO=BAR --append=APPENDARG=VALAPPEND --append=APPENDARG=2NDAPPEND testos:testos/buildmaster/x86_64-runtime
ostree admin instutil set-kargs --merge --append=FOO=BAR --append=APPENDARG=VALAPPEND --append=APPENDARG=2NDAPPEND testos:testos/buildmaster/x86_64-runtime
assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'options.*FOO=XXX.*FOO=BAR'
assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'options.*APPENDARG=VALAPPEND .*APPENDARG=2NDAPPEND'
echo "ok instutil set-kargs --append"
ostree admin --sysroot=sysroot instutil set-kargs --import-proc-cmdline
ostree admin instutil set-kargs --import-proc-cmdline
# Here we're asserting that the *host* system has a root= kernel
# argument. I think it's unlikely that anyone doesn't have one, but
# if this is not true for you, please file a bug!

View File

@ -23,6 +23,7 @@ set -e
echo "1..1"
# Exports OSTREE_SYSROOT so --sysroot not needed.
setup_os_repository "archive-z2" "syslinux"
echo "ok setup"
@ -36,7 +37,7 @@ rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmast
export rev
echo "rev=${rev}"
# This initial deployment gets kicked off with some kernel arguments
${CMD_PREFIX} ostree admin --sysroot=sysroot 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/buildmaster/x86_64-runtime
assert_has_dir sysroot/boot/ostree/testos-${bootcsum}
parallel_cmd=parallel
@ -45,9 +46,9 @@ if parallel --help | grep -q -e --no-notice; then
fi
count=$(($(getconf _NPROCESSORS_ONLN) * 2))
seq "${count}" | ${parallel_cmd} -n0 ${CMD_PREFIX} ostree admin --sysroot=sysroot 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/buildmaster/x86_64-runtime
${CMD_PREFIX} ostree admin --sysroot=sysroot status > status.txt
${CMD_PREFIX} ostree admin status > status.txt
grep "testos ${rev}" status.txt | wc -l > status-matches.txt
assert_file_has_content status-matches.txt $((${count} + 1))

View File

@ -23,6 +23,7 @@ set -e
echo "1..1"
# Exports OSTREE_SYSROOT so --sysroot not needed.
setup_os_repository "archive-z2" "syslinux"
echo "ok setup"
@ -36,22 +37,22 @@ rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmast
export rev
echo "rev=${rev}"
# This initial deployment gets kicked off with some kernel arguments
${CMD_PREFIX} ostree admin --sysroot=sysroot 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/buildmaster/x86_64-runtime
assert_has_dir sysroot/boot/ostree/testos-${bootcsum}
# This should be a no-op
${CMD_PREFIX} ostree admin --sysroot=sysroot upgrade --os=testos
${CMD_PREFIX} ostree admin upgrade --os=testos
# Now reset to an older revision
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo reset testos/buildmaster/x86_64-runtime{,^}
if ${CMD_PREFIX} ostree admin --sysroot=sysroot upgrade --os=testos 2>upgrade-err.txt; then
if ${CMD_PREFIX} ostree admin upgrade --os=testos 2>upgrade-err.txt; then
assert_not_reached 'upgrade unexpectedly succeeded'
fi
assert_file_has_content upgrade-err.txt 'chronologically older'
echo 'ok upgrade will not go backwards'
${CMD_PREFIX} ostree admin --sysroot=sysroot upgrade --os=testos --allow-downgrade
${CMD_PREFIX} ostree admin upgrade --os=testos --allow-downgrade
echo 'ok upgrade backwards'

View File

@ -23,6 +23,7 @@ set -e
echo "1..1"
# Exports OSTREE_SYSROOT so --sysroot not needed.
setup_os_repository "archive-z2" "syslinux"
echo "ok setup"
@ -34,11 +35,11 @@ rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmast
export rev
echo "rev=${rev}"
# This initial deployment gets kicked off with some kernel arguments
${CMD_PREFIX} ostree admin --sysroot=sysroot 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/buildmaster/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
if ${CMD_PREFIX} ostree admin --sysroot=sysroot upgrade --os=testos 2>err.txt; then
if ${CMD_PREFIX} ostree admin upgrade --os=testos 2>err.txt; then
assert_not_reached "upgrade unexpectedly succeeded"
fi
assert_file_has_content err.txt "Use.*subscription.*online"
@ -46,6 +47,6 @@ 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 --sysroot=sysroot switch --os=testos otheros:testos/buildmaster/x86_64-runtime
${CMD_PREFIX} ostree admin switch --os=testos otheros:testos/buildmaster/x86_64-runtime
echo "ok switch"