New upstream version 2019.2

This commit is contained in:
Simon McVittie committed 2019-04-29 08:36:24 +01:00
commit bd32d1e5de
79 files changed
+2910 -1852

No files matched your search

+13 -3
View File
@@ -21,7 +21,7 @@
set -euo pipefail
echo "1..$((25 + ${extra_admin_tests:-0}))"
echo "1..$((26 + ${extra_admin_tests:-0}))"
function validate_bootloader() {
cd ${test_tmpdir};
@@ -60,7 +60,7 @@ validate_bootloader
echo "ok deploy command"
${CMD_PREFIX} ostree admin --print-current-dir > curdir
assert_file_has_content curdir ^`pwd`/sysroot/ostree/deploy/testos/deploy/${rev}.0$
assert_file_has_content curdir ^`pwd`/sysroot/ostree/deploy/testos/deploy/${rev}\.0$
echo "ok --print-current-dir"
@@ -239,7 +239,7 @@ 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"
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote list -u > remotes.txt
assert_file_has_content remotes.txt 'bacon.*http://tasty.com'
assert_file_has_content remotes.txt 'bacon.*http://tasty\.com'
cp saved-origin ${originfile}
validate_bootloader
@@ -280,6 +280,16 @@ validate_bootloader
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)$"
os_repository_new_commit 0 0 testos/buildmaster/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)$"
echo "ok no duplicate version strings in title"
# Test upgrade with and without --override-commit
# See https://github.com/GNOME/ostree/pull/147
${CMD_PREFIX} ostree pull --repo=sysroot/ostree/repo --commit-metadata-only --depth=-1 testos:testos/buildmaster/x86_64-runtime
+1 -1
View File
@@ -245,7 +245,7 @@ EOF
$OSTREE commit ${COMMIT_ARGS} -b branch-with-commitmsg -F commitmsg.txt -s 'a message' $test_tmpdir/checkout-test2-4
$OSTREE log branch-with-commitmsg > log.txt
assert_file_has_content log.txt '^ *This is a long$'
assert_file_has_content log.txt '^ *Build-Host:.*example.com$'
assert_file_has_content log.txt '^ *Build-Host:.*example\.com$'
assert_file_has_content log.txt '^ *Crunchy-With.*true$'
$OSTREE refs --delete branch-with-commitmsg
echo "ok commit body file"
-2
View File
@@ -22,8 +22,6 @@
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <linux/magic.h>
#include <sys/vfs.h>
#include "libglnx.h"
#include "libostreetest.h"
+9 -2
View File
@@ -355,6 +355,11 @@ setup_os_boot_grub2() {
esac
}
setup_os_boot_configured_bootloader() {
bootloader_keyval=$1
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo config set ${bootloader_keyval}
}
setup_os_repository () {
mode=$1
shift
@@ -448,6 +453,9 @@ EOF
*grub2*)
setup_os_boot_grub2 "${bootmode}"
;;
sysroot\.bootloader*)
setup_os_boot_configured_bootloader "${bootmode}"
;;
esac
cd ${test_tmpdir}
@@ -465,6 +473,7 @@ os_repository_new_commit ()
boot_checksum_iteration=${1:-0}
content_iteration=${2:-0}
branch=${3:-testos/buildmaster/x86_64-runtime}
export version=${4:-$(date "+%Y%m%d.${content_iteration}")}
echo "BOOT ITERATION: $boot_checksum_iteration"
cd ${test_tmpdir}/osdata
kver=3.6.0
@@ -499,8 +508,6 @@ os_repository_new_commit ()
echo "content iteration ${content_iteration}" > usr/bin/content-iteration
export version=$(date "+%Y%m%d.${content_iteration}")
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --add-metadata-string "version=${version}" -b $branch -s "Build"
cd ${test_tmpdir}
}
+1 -1
View File
@@ -65,7 +65,7 @@ read_config()
populate_menu()
{
# Default to /boot if OSTREE_BOOT_PARTITION is not set and /boot is on the same device than ostree/repo
# Default to /boot if OSTREE_BOOT_PARTITION is not set and /boot is on the same device as /ostree/repo
if [ -z ${OSTREE_BOOT_PARTITION+x} ] && [ -d /boot/ostree ] && [ -d /ostree/repo ] && [ $(stat -c '%d' /boot/ostree) -eq $(stat -c '%d' /ostree/repo) ]; then
boot_prefix="/boot"
else
+1 -1
View File
@@ -368,7 +368,7 @@ repo_init --no-gpg-verify
${CMD_PREFIX} ostree --repo=repo pull origin main@${prev_rev}
${CMD_PREFIX} ostree --repo=repo pull --dry-run --require-static-deltas origin ${delta_target} >dry-run-pull.txt
# Compression can vary, so we support 400-699
delta_dry_run_regexp='Delta update: 0/1 parts, 0 bytes/[456][0-9][0-9] bytes, 455 bytes total uncompressed'
delta_dry_run_regexp='Delta update: 0/1 parts, 0[  ]bytes/[456][0-9][0-9][  ]bytes, 455[  ]bytes total uncompressed'
assert_file_has_content dry-run-pull.txt "${delta_dry_run_regexp}"
rev=$(${CMD_PREFIX} ostree --repo=repo rev-parse origin:main)
assert_streq "${prev_rev}" "${rev}"
+1 -1
View File
@@ -55,7 +55,7 @@ ${CMD_PREFIX} ostree --repo=ostree-srv/repo static-delta generate ${remote_ref}
${CMD_PREFIX} ostree --repo=ostree-srv/repo summary -u
${CMD_PREFIX} ostree --repo=repo pull origin ${remote_ref}@${prev_rev}
${CMD_PREFIX} ostree --repo=repo pull --dry-run --require-static-deltas origin ${remote_ref} >dry-run-pull.txt
assert_file_has_content dry-run-pull.txt 'Delta update: 0/1 parts, 0 bytes/[45][0-9].[0-9] kB, 1.[678] MB total uncompressed'
assert_file_has_content dry-run-pull.txt 'Delta update: 0/1 parts, 0 bytes/[45][0-9]\.[0-9][  ]kB, 1\.[678][  ]MB total uncompressed'
${CMD_PREFIX} ostree --repo=repo pull --require-static-deltas origin ${remote_ref}
final_rev=$(${CMD_PREFIX} ostree --repo=repo rev-parse origin:${remote_ref})
assert_streq "${rev}" "${final_rev}"
+53
View File
@@ -0,0 +1,53 @@
#!/bin/bash
#
# Copyright (C) 2019 Robert Fairley <rfairley@redhat.com>
#
# SPDX-License-Identifier: LGPL-2.0+
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
set -euo pipefail
. $(dirname $0)/libtest.sh
# Exports OSTREE_SYSROOT so --sysroot not needed.
setup_os_repository "archive" "sysroot.bootloader none"
extra_admin_tests=1
. $(dirname $0)/admin-test.sh
# Test that the bootloader configuration "none" generates BLS config snippets.
cd ${test_tmpdir}
rm httpd osdata testos-repo sysroot -rf
setup_os_repository "archive" "sysroot.bootloader none"
${CMD_PREFIX} ostree pull-local --repo=sysroot/ostree/repo --remote testos testos-repo testos/buildmaster/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
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'
assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/initramfs-3.6.0.img 'an initramfs'
echo "ok generate bls config on first deployment"
# TODO: add tests to try setting with an unsupported bootloader config,
# once https://github.com/ostreedev/ostree/issues/1827 is solved.
# The tests should check that the following commands fail:
# ${CMD_PREFIX} ostree --repo=sysroot/ostree/repo config set sysroot.bootloader unsupported_bootloader
# ${CMD_PREFIX} ostree --repo=sysroot/ostree/repo config set sysroot.bootloader ""
+2 -2
View File
@@ -46,13 +46,13 @@ ${CMD_PREFIX} ostree admin upgrade --os=testos --pull-only --os=testos > out.txt
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_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)
# 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
assert_not_file_has_content out.txt 'No update available'
assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'TestOS 42 1.0.10'
assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'TestOS 42 1\.0\.10'
assert_has_dir sysroot/ostree/deploy/testos/deploy/${parent_rev}.0
assert_has_dir sysroot/ostree/deploy/testos/deploy/${rev}.0
${CMD_PREFIX} ostree admin upgrade --os=testos --deploy-only --os=testos > out.txt
+48 -4
View File
@@ -23,7 +23,7 @@ set -euo pipefail
. $(dirname $0)/libtest.sh
echo '1..2'
echo '1..3'
ostree_repo_init repo
${CMD_PREFIX} ostree remote add --repo=repo --set=xa.title=Flathub --set=xa.title-is-set=true flathub https://dl.flathub.org/repo/
@@ -34,13 +34,19 @@ ${CMD_PREFIX} ostree config --repo=repo get --group=core repo_version >> list.tx
${CMD_PREFIX} ostree config --repo=repo get --group='remote "flathub"' 'xa.title' >> list.txt
${CMD_PREFIX} ostree config --repo=repo get --group='remote "flathub"' 'xa.title-is-set' >> list.txt
${CMD_PREFIX} ostree config --repo=repo get --group='remote "org.mozilla.FirefoxRepo"' url >> list.txt
${CMD_PREFIX} cat list.txt
${CMD_PREFIX} cat list.txt
assert_file_has_content list.txt "bare"
assert_file_has_content list.txt "1"
assert_file_has_content list.txt "Flathub"
assert_file_has_content list.txt "true"
assert_file_has_content list.txt "http://example.com/ostree/repo/"
assert_file_has_content list.txt "http://example\.com/ostree/repo/"
# Check that it errors out if too many arguments are given
if ${CMD_PREFIX} ostree config --repo=repo get --group=core lock-timeout-secs extra 2>err.txt; then
assert_not_reached "ostree config get should error out if too many arguments are given"
fi
assert_file_has_content err.txt "error: Too many arguments given"
echo "ok config get"
${CMD_PREFIX} ostree config --repo=repo set core.mode bare-user-only
@@ -51,5 +57,43 @@ ${CMD_PREFIX} ostree config --repo=repo set --group='remote "org.mozilla.Firefox
assert_file_has_content repo/config "bare-user-only"
assert_file_has_content repo/config "Nightly Flathub"
assert_file_has_content repo/config "false"
assert_file_has_content repo/config "http://example.com/ostree/"
assert_file_has_content repo/config "http://example\.com/ostree/"
# Check that it errors out if too many arguments are given
if ${CMD_PREFIX} ostree config --repo=repo set --group=core lock-timeout-secs 120 extra 2>err.txt; then
assert_not_reached "ostree config set should error out if too many arguments are given"
fi
assert_file_has_content err.txt "error: Too many arguments given"
echo "ok config set"
# Check that "ostree config unset" works
${CMD_PREFIX} ostree config --repo=repo set core.lock-timeout-secs 60
assert_file_has_content repo/config "lock-timeout-secs=60"
${CMD_PREFIX} ostree config --repo=repo unset core.lock-timeout-secs
assert_not_file_has_content repo/config "lock-timeout-secs="
# Check that "ostree config get" errors out on the key
if ${CMD_PREFIX} ostree config --repo=repo get core.lock-timeout-secs 2>err.txt; then
assert_not_reached "ostree config get should not work after unsetting a key"
fi
# Check for any character where quotation marks would be as they appear differently in the Fedora and Debian
# test suites (“” and '' respectively). See: https://github.com/ostreedev/ostree/pull/1839
assert_file_has_content err.txt "error: Key file does not have key .lock-timeout-secs. in group .core."
# Check that it's idempotent
${CMD_PREFIX} ostree config --repo=repo unset core.lock-timeout-secs
assert_not_file_has_content repo/config "lock-timeout-secs="
# Check that the group doesn't need to exist
${CMD_PREFIX} ostree config --repo=repo unset --group='remote "aoeuhtns"' 'xa.title'
# Check that the key doesn't need to exist
${CMD_PREFIX} ostree config --repo=repo set --group='remote "aoeuhtns"' 'xa.title-is-set' 'false'
${CMD_PREFIX} ostree config --repo=repo unset --group='remote "aoeuhtns"' 'xa.title'
# Check that it errors out if too many arguments are given
if ${CMD_PREFIX} ostree config --repo=repo unset core.lock-timeout-secs extra 2>err.txt; then
assert_not_reached "ostree config unset should error out if too many arguments are given"
fi
assert_file_has_content err.txt "error: Too many arguments given"
echo "ok config unset"
+12 -12
View File
@@ -56,9 +56,9 @@ ${CMD_PREFIX} ostree --repo=local-repo create-usb dest-mount1 org.example.Collec
assert_has_dir dest-mount1/.ostree/repo
${CMD_PREFIX} ostree --repo=dest-mount1/.ostree/repo refs --collections > dest-refs
assert_file_has_content dest-refs "^(org.example.Collection1, test-1)$"
assert_file_has_content dest-refs "^(org.example.Collection1, test-2)$"
assert_not_file_has_content dest-refs "^(org.example.Collection1, test-3)$"
assert_file_has_content dest-refs "^(org\.example\.Collection1, test-1)$"
assert_file_has_content dest-refs "^(org\.example\.Collection1, test-2)$"
assert_not_file_has_content dest-refs "^(org\.example\.Collection1, test-3)$"
assert_has_file dest-mount1/.ostree/repo/summary
echo "ok 1 simple usb"
@@ -83,7 +83,7 @@ ${CMD_PREFIX} ostree --repo=local-repo create-usb --destination-repo some-dest d
assert_has_dir "dest-mount3/some-dest"
assert_symlink_has_content "dest-mount3/.ostree/repos.d/00-generated" "/some-dest$"
${CMD_PREFIX} ostree --repo=dest-mount3/.ostree/repos.d/00-generated refs --collections > dest-refs
assert_file_has_content dest-refs "^(org.example.Collection1, test-1)$"
assert_file_has_content dest-refs "^(org\.example\.Collection1, test-1)$"
assert_has_file dest-mount3/.ostree/repos.d/00-generated/summary
echo "ok 3 usb in non-standard location"
@@ -93,13 +93,13 @@ ${CMD_PREFIX} ostree --repo=local-repo create-usb --destination-repo some-dest d
assert_has_dir "dest-mount3/some-dest"
assert_symlink_has_content "dest-mount3/.ostree/repos.d/00-generated" "/some-dest$"
${CMD_PREFIX} ostree --repo=dest-mount3/.ostree/repos.d/00-generated refs --collections > dest-refs
assert_file_has_content dest-refs "^(org.example.Collection1, test-1)$"
assert_file_has_content dest-refs "^(org.example.Collection1, test-2)$"
assert_file_has_content dest-refs "^(org.example.Collection1, test-3)$"
assert_file_has_content dest-refs "^(org\.example\.Collection1, test-1)$"
assert_file_has_content dest-refs "^(org\.example\.Collection1, test-2)$"
assert_file_has_content dest-refs "^(org\.example\.Collection1, test-3)$"
${CMD_PREFIX} ostree --repo=dest-mount3/.ostree/repos.d/00-generated summary -v > dest-summary
assert_file_has_content dest-summary "(org.example.Collection1, test-1)$"
assert_file_has_content dest-summary "(org.example.Collection1, test-2)$"
assert_file_has_content dest-summary "(org.example.Collection1, test-3)$"
assert_file_has_content dest-summary "(org\.example\.Collection1, test-1)$"
assert_file_has_content dest-summary "(org\.example\.Collection1, test-2)$"
assert_file_has_content dest-summary "(org\.example\.Collection1, test-3)$"
echo "ok 4 adding ref to an existing usb"
@@ -109,7 +109,7 @@ ostree_repo_init finder-repo
${CMD_PREFIX} ostree --repo=finder-repo remote add remote1 file://$(pwd)/just-needed-for-the-keyring --collection-id org.example.Collection1 --gpg-import="${test_tmpdir}/gpghome/key1.asc"
${test_builddir}/repo-finder-mount finder-repo dest-mount1 org.example.Collection1 test-1 org.example.Collection1 test-2 &> out
assert_file_has_content out "^0 .*_2Fdest-mount1_2F.ostree_2Frepo_remote1.trustedkeys.gpg org.example.Collection1 test-1 $(ostree --repo=repo show test-1)$"
assert_file_has_content out "^0 .*_2Fdest-mount1_2F.ostree_2Frepo_remote1.trustedkeys.gpg org.example.Collection1 test-2 $(ostree --repo=repo show test-2)$"
assert_file_has_content out "^0 .*_2Fdest-mount1_2F\.ostree_2Frepo_remote1\.trustedkeys\.gpg org\.example\.Collection1 test-1 $(ostree --repo=repo show test-1)$"
assert_file_has_content out "^0 .*_2Fdest-mount1_2F\.ostree_2Frepo_remote1\.trustedkeys\.gpg org\.example\.Collection1 test-2 $(ostree --repo=repo show test-2)$"
echo "ok 5 find from usb repo"
+2
View File
@@ -135,6 +135,8 @@ rm temp-repo -rf
echo 'ok generate'
${CMD_PREFIX} ostree --repo=repo static-delta show ${origrev}-${newrev} > show.txt
assert_file_has_content show.txt "From: ${origrev}"
assert_file_has_content show.txt "To: ${newrev}"
assert_file_has_content show.txt 'Endianness: \(little\|big\)'
echo 'ok show'
+54 -54
View File
@@ -60,8 +60,8 @@ assert_file_has_content refs "^os-remote:os/amd64/master$"
${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\.AppsCollection, app1)$"
assert_file_has_content refs "^(org\.example\.OsCollection, os/amd64/master)$"
assert_file_has_content refscount "^2$"
# Create a local mirror repository where we pull the branches *in mirror mode* from the two remotes.
@@ -80,8 +80,8 @@ ls -1 local-mirror/refs/remotes | wc -l > remotescount
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\.AppsCollection, app1)$"
assert_file_has_content refs "^(org\.example\.OsCollection, os/amd64/master)$"
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)$"
@@ -90,69 +90,69 @@ for repo in local local-mirror; do
# Try finding an update for an existing branch.
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.AppsCollection app1 > 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 "^1/1 refs were found.$"
assert_not_file_has_content find "^No results.$"
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 "^1/1 refs were found\.$"
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
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 "^ - 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 "^2/2 refs were found.$"
assert_not_file_has_content find "^No results.$"
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 "^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
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 "^ - 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 "^3/3 refs were found.$"
assert_not_file_has_content find "^No results.$"
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 "^3/3 refs were found\.$"
assert_not_file_has_content find "^No results\.$"
# Find an update and a non-existent branch.
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.AppsCollection app1 org.example.AppsCollection not-an-app > 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, not-an-app) = (not found)$"
assert_file_has_content find "^ - (org.example.AppsCollection, app1) = $(cat app1-checksum)$"
assert_file_has_content find "^ - Keyring: apps-remote\.trustedkeys\.gpg$"
assert_file_has_content find "^ - (org\.example\.AppsCollection, not-an-app) = (not found)$"
assert_file_has_content find "^ - (org\.example\.AppsCollection, app1) = $(cat app1-checksum)$"
assert_file_has_content find "^Refs not found in any remote:$"
assert_file_has_content find "^ - (org.example.AppsCollection, not-an-app)$"
assert_file_has_content find "^1/2 refs were found.$"
assert_not_file_has_content find "^No results.$"
assert_file_has_content find "^ - (org\.example\.AppsCollection, not-an-app)$"
assert_file_has_content find "^1/2 refs were found\.$"
assert_not_file_has_content find "^No results\.$"
# Do all the above, but pull this time.
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.AppsCollection app1 > pull || true
assert_file_has_content pull "^1/1 refs were found.$"
assert_file_has_content pull "^Pulled 1/1 refs successfully.$"
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 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
assert_file_has_content pull "^2/2 refs were found.$"
assert_file_has_content pull "^Pulled 2/2 refs successfully.$"
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)
${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
assert_file_has_content pull "^3/3 refs were found.$"
assert_file_has_content pull "^Pulled 3/3 refs successfully.$"
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)
${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.$"
assert_file_has_content pull "^1/2 refs were found\.$"
assert_not_file_has_content pull "Failed to pull some refs from the remotes"
assert_ref $repo app1 $(cat app1-checksum)
assert_not_ref $repo not-an-app
@@ -168,15 +168,15 @@ 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
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 "^1/1 refs were found.$"
assert_not_file_has_content find "^No results.$"
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 "^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
assert_file_has_content pull "^1/1 refs were found.$"
assert_file_has_content pull "^Pulled 1/1 refs successfully.$"
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)
@@ -195,18 +195,18 @@ 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
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 "^ - 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 "^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 "^1/1 refs were found.$"
assert_not_file_has_content find "^No results.$"
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 "^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
assert_file_has_content pull "^1/1 refs were found.$"
assert_file_has_content pull "^Pulled 1/1 refs successfully.$"
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)
done
@@ -222,15 +222,15 @@ 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
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 "^1/1 refs were found.$"
assert_not_file_has_content find "^No results.$"
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 "^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
assert_file_has_content pull "^1/1 refs were found.$"
assert_file_has_content pull "^Pulled 1/1 refs successfully.$"
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)
done
+20 -20
View File
@@ -61,7 +61,7 @@ set_up_repo_with_collection_id
# fsck at this point should succeed
${CMD_PREFIX} ostree fsck --repo=repo > fsck
assert_file_has_content fsck "^Validating refs in collections...$"
assert_file_has_content fsck "^Validating refs in collections\.\.\.$"
# Drop the commit the ref points to, and drop the original ref so that fsck doesn’t prematurely fail on that.
find repo/objects -name '*.commit' -delete -print | wc -l > commitcount
@@ -73,8 +73,8 @@ rm repo/refs/heads/ref1
if ${CMD_PREFIX} ostree fsck --repo=repo > fsck; then
assert_not_reached "fsck unexpectedly succeeded after deleting commit!"
fi
assert_file_has_content fsck "^Validating refs...$"
assert_file_has_content fsck "^Validating refs in collections...$"
assert_file_has_content fsck "^Validating refs\.\.\.$"
assert_file_has_content fsck "^Validating refs in collections\.\.\.$"
echo "ok 1 fsck-collections"
@@ -84,8 +84,8 @@ set_up_repo_with_collection_id
rm -rf repo/refs/mirrors
${CMD_PREFIX} ostree fsck --repo=repo > fsck
assert_file_has_content fsck "^Validating refs...$"
assert_file_has_content fsck "^Validating refs in collections...$"
assert_file_has_content fsck "^Validating refs\.\.\.$"
assert_file_has_content fsck "^Validating refs in collections\.\.\.$"
echo "ok 2 fsck-collections in old repository"
@@ -101,7 +101,7 @@ if ${CMD_PREFIX} ostree fsck --repo=repo --verify-bindings > fsck 2> fsck-error;
assert_not_reached "fsck unexpectedly succeeded after adding unbound ref!"
fi
assert_file_has_content fsck-error "Commit has no requested ref ‘new-ref’ in ref binding metadata (‘ref1’)"
assert_file_has_content fsck "^Validating refs...$"
assert_file_has_content fsck "^Validating refs\.\.\.$"
echo "ok 3 fsck detects missing ref bindings"
@@ -114,8 +114,8 @@ if ${CMD_PREFIX} ostree fsck --repo=repo --verify-bindings > fsck 2> fsck-error;
assert_not_reached "fsck unexpectedly succeeded after adding unbound ref!"
fi
assert_file_has_content fsck-error "Commit has no requested ref ‘new-ref’ in ref binding metadata (‘ref1’)"
assert_file_has_content fsck "^Validating refs...$"
assert_file_has_content fsck "^Validating refs in collections...$"
assert_file_has_content fsck "^Validating refs\.\.\.$"
assert_file_has_content fsck "^Validating refs in collections\.\.\.$"
echo "ok 4 fsck detects missing collection–ref bindings"
@@ -127,9 +127,9 @@ ${CMD_PREFIX} ostree --repo=repo refs --collections --create=org.example.Collect
if ${CMD_PREFIX} ostree fsck --repo=repo --verify-bindings > fsck 2> fsck-error; then
assert_not_reached "fsck unexpectedly succeeded after adding unbound ref!"
fi
assert_file_has_content fsck-error "Commit has collection ID ‘org.example.Collection’ in collection binding metadata, while the remote it came from has collection ID ‘org.example.Collection2’"
assert_file_has_content fsck "^Validating refs...$"
assert_file_has_content fsck "^Validating refs in collections...$"
assert_file_has_content fsck-error "Commit has collection ID ‘org\.example\.Collection’ in collection binding metadata, while the remote it came from has collection ID ‘org\.example\.Collection2’"
assert_file_has_content fsck "^Validating refs\.\.\.$"
assert_file_has_content fsck "^Validating refs in collections\.\.\.$"
echo "ok 5 fsck detects missing collection–ref bindings"
@@ -139,7 +139,7 @@ ${CMD_PREFIX} ostree --repo=repo refs --delete ref1
# fsck at this point should succeed
${CMD_PREFIX} ostree fsck --repo=repo > fsck
assert_file_has_content fsck "^Validating refs in collections...$"
assert_file_has_content fsck "^Validating refs in collections\.\.\.$"
echo "ok 6 fsck ignores unreferenced ref bindings"
@@ -147,9 +147,9 @@ echo "ok 6 fsck ignores unreferenced ref bindings"
if ${CMD_PREFIX} ostree fsck --repo=repo --verify-back-refs > fsck 2> fsck-error; then
assert_not_reached "fsck unexpectedly succeeded after adding unbound ref!"
fi
assert_file_has_content fsck-error "Collection–ref (org.example.Collection, ref1) in bindings for commit .* does not exist"
assert_file_has_content fsck "^Validating refs...$"
assert_file_has_content fsck "^Validating refs in collections...$"
assert_file_has_content fsck-error "Collection–ref (org\.example\.Collection, ref1) in bindings for commit .* does not exist"
assert_file_has_content fsck "^Validating refs\.\.\.$"
assert_file_has_content fsck "^Validating refs in collections\.\.\.$"
echo "ok 7 fsck ignores unreferenced ref bindings"
@@ -161,7 +161,7 @@ set_up_repo_without_collection_id
# fsck at this point should succeed
${CMD_PREFIX} ostree fsck --repo=repo --verify-bindings > fsck
assert_file_has_content fsck "^Validating refs in collections...$"
assert_file_has_content fsck "^Validating refs in collections\.\.\.$"
# Drop the commit the ref points to, and drop the original ref so that fsck doesn’t prematurely fail on that.
find repo/objects -name '*.commit' -delete -print | wc -l > commitcount
@@ -173,7 +173,7 @@ rm repo/refs/heads/ref3
if ${CMD_PREFIX} ostree fsck --repo=repo --verify-bindings > fsck; then
assert_not_reached "fsck unexpectedly succeeded after deleting commit!"
fi
assert_file_has_content fsck "^Validating refs...$"
assert_file_has_content fsck "^Validating refs\.\.\.$"
echo "ok 8 fsck-collections"
@@ -187,7 +187,7 @@ if ${CMD_PREFIX} ostree fsck --repo=repo --verify-bindings > fsck 2> fsck-error;
assert_not_reached "fsck unexpectedly succeeded after adding unbound ref!"
fi
assert_file_has_content fsck-error "Commit has no requested ref ‘new-ref’ in ref binding metadata (‘ref3’, ‘ref4’)"
assert_file_has_content fsck "^Validating refs...$"
assert_file_has_content fsck "^Validating refs\.\.\.$"
echo "ok 9 fsck detects missing ref bindings"
@@ -197,7 +197,7 @@ ${CMD_PREFIX} ostree --repo=repo refs --delete ref3
# fsck at this point should succeed
${CMD_PREFIX} ostree fsck --repo=repo > fsck
assert_file_has_content fsck "^Validating refs...$"
assert_file_has_content fsck "^Validating refs\.\.\.$"
echo "ok 10 fsck ignores unreferenced ref bindings"
@@ -206,6 +206,6 @@ if ${CMD_PREFIX} ostree fsck --repo=repo --verify-back-refs > fsck 2> fsck-error
assert_not_reached "fsck unexpectedly succeeded after adding unbound ref!"
fi
assert_file_has_content fsck-error "Ref ‘ref3’ in bindings for commit .* does not exist"
assert_file_has_content fsck "^Validating refs...$"
assert_file_has_content fsck "^Validating refs\.\.\.$"
echo "ok 11 fsck ignores unreferenced ref bindings"
+1 -1
View File
@@ -30,6 +30,6 @@ cd ${test_tmpdir}
# Check that initialising a repository with a collection ID results in the ID being in the config.
mkdir repo
ostree_repo_init repo --collection-id org.example.Collection
assert_file_has_content repo/config "^collection-id=org.example.Collection$"
assert_file_has_content repo/config "^collection-id=org\.example\.Collection$"
echo "ok init-collections"
+70 -6
View File
@@ -79,7 +79,6 @@ test_get_value_with_default (void)
/* Avoid that g_return_val_if_fail causes the test to fail. */
always_fatal_mask = g_log_set_always_fatal (0);
g_assert_false (ot_keyfile_get_value_with_default (g_keyfile,
NULL,
"value_foo",
@@ -124,11 +123,75 @@ test_get_value_with_default (void)
g_clear_pointer (&out, g_free);
g_assert_false (ot_keyfile_get_value_with_default (g_keyfile,
"a_fake_section",
"a_value_true",
"no value",
&out,
&error));
"a_fake_section",
"a_value_true",
"no value",
&out,
&error));
g_clear_error (&error);
g_clear_pointer (&out, g_free);
}
static void
test_get_value_with_default_group_optional (void)
{
g_autoptr(GError) error = NULL;
g_autofree char *out = NULL;
GLogLevelFlags always_fatal_mask;
const char *section = "section";
/* Avoid that g_return_val_if_fail causes the test to fail. */
always_fatal_mask = g_log_set_always_fatal (0);
g_assert_false (ot_keyfile_get_value_with_default_group_optional (g_keyfile,
NULL,
"value_foo",
"none",
&out,
&error));
g_clear_pointer (&out, g_free);
g_assert_false (ot_keyfile_get_value_with_default_group_optional (g_keyfile,
section,
NULL,
"none",
&out,
&error));
g_clear_pointer (&out, g_free);
g_assert_false (ot_keyfile_get_value_with_default_group_optional (g_keyfile,
section,
NULL,
"something",
&out,
&error));
g_clear_pointer (&out, g_free);
/* Restore the old mask. */
g_log_set_always_fatal (always_fatal_mask);
g_assert (ot_keyfile_get_value_with_default_group_optional (g_keyfile,
section,
"value_foo",
"none",
&out,
&error));
g_assert_cmpstr (out, ==, "foo");
g_clear_pointer (&out, g_free);
g_assert (ot_keyfile_get_value_with_default_group_optional (g_keyfile,
section,
"a_not_existing_value",
"correct",
&out,
&error));
g_assert_cmpstr (out, ==, "correct");
g_clear_pointer (&out, g_free);
g_assert (ot_keyfile_get_value_with_default_group_optional (g_keyfile,
"an_optional_section",
"a_value_true",
"no value",
&out,
&error));
g_clear_error (&error);
g_clear_pointer (&out, g_free);
}
@@ -191,6 +254,7 @@ int main (int argc, char **argv)
g_test_add_func ("/keyfile-utils/get-boolean-with-default", test_get_boolean_with_default);
g_test_add_func ("/keyfile-utils/get-value-with-default", test_get_value_with_default);
g_test_add_func ("/keyfile-utils/get-value-with-default-group-optional", test_get_value_with_default_group_optional);
g_test_add_func ("/keyfile-utils/copy-group", test_copy_group);
ret = g_test_run();
+1 -1
View File
@@ -83,7 +83,7 @@ do
${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmaster/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"
assert_file_has_content sysroot/boot/"$(get_key_from_bootloader_conf sysroot/boot/loader/entries/ostree-2-testos.conf 'devicetree')" "my \.dtb file"
assert_not_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'initrd'
echo "ok switching from initramfs to no initramfs sysroot with devicetree layout=$layout"
+1 -1
View File
@@ -146,7 +146,7 @@ assert_file_has_content summary.txt "* main"
assert_file_has_content summary.txt "* other"
assert_file_has_content summary.txt "* yet-another"
assert_file_has_content summary.txt "found 1 signature"
assert_file_has_content summary.txt "Good signature from \"Ostree Tester <test@test.com>\""
assert_file_has_content summary.txt "Good signature from \"Ostree Tester <test@test\.com>\""
grep static-deltas summary.txt > static-deltas.txt
assert_file_has_content static-deltas.txt \
$(${OSTREE} --repo=repo rev-parse origin:main)
+10 -10
View File
@@ -46,11 +46,11 @@ assert_file_has_content refscount "^5$"
${CMD_PREFIX} ostree --repo=repo refs > refs
assert_file_has_content refs "^test\-1$"
assert_file_has_content refs "^test\-5$"
assert_not_file_has_content refs "org.example.Collection"
assert_not_file_has_content refs "org\.example\.Collection"
${CMD_PREFIX} ostree --repo=repo refs --collections > refs
assert_file_has_content refs "^(org.example.Collection, test-1)$"
assert_file_has_content refs "^(org.example.Collection, test-5)$"
assert_file_has_content refs "^(org\.example\.Collection, test-1)$"
assert_file_has_content refs "^(org\.example\.Collection, test-5)$"
# Similarly, the collection IDs should only be listed when filtering if --collections is passed.
${CMD_PREFIX} ostree --repo=repo refs --list org.example.Collection | wc -l > refscount
@@ -102,8 +102,8 @@ assert_file_has_content refs "^ctest$"
assert_not_file_has_content refs "^ctest-mirror$"
${CMD_PREFIX} ostree --repo=repo refs --collections > refs
assert_file_has_content refs "^(org.example.Collection, ctest)$"
assert_file_has_content refs "^(org.example.NewCollection, ctest-mirror)$"
assert_file_has_content refs "^(org\.example\.Collection, ctest)$"
assert_file_has_content refs "^(org\.example\.NewCollection, ctest-mirror)$"
# Remote refs should be listed if they have collection IDs
@@ -116,13 +116,13 @@ ${CMD_PREFIX} ostree --repo=repo remote add --no-gpg-verify --collection-id org.
${CMD_PREFIX} ostree --repo=repo pull collection-repo-remote rcommit
${CMD_PREFIX} ostree --repo=repo refs --collections > refs
assert_file_has_content refs "^(org.example.RemoteCollection, rcommit)$"
assert_file_has_content refs "^(org\.example\.RemoteCollection, rcommit)$"
${CMD_PREFIX} ostree --repo=repo refs --collections org.example.RemoteCollection > refs
assert_file_has_content refs "^(org.example.RemoteCollection, rcommit)$"
assert_file_has_content refs "^(org\.example\.RemoteCollection, rcommit)$"
${CMD_PREFIX} ostree --repo=repo refs --collections org.example.NonexistentID > refs
assert_not_file_has_content refs "^(org.example.RemoteCollection, rcommit)$"
assert_not_file_has_content refs "^(org\.example\.RemoteCollection, rcommit)$"
cd ${test_tmpdir}
mkdir no-collection-repo
@@ -147,8 +147,8 @@ ${CMD_PREFIX} ostree --repo=repo refs --collections
rm -rf repo/refs/mirrors
${CMD_PREFIX} ostree --repo=repo refs --collections --create=org.example.NewCollection:ctest-mirror ctest
${CMD_PREFIX} ostree --repo=repo refs --collections > refs
assert_file_has_content refs "^(org.example.Collection, ctest)$"
assert_file_has_content refs "^(org.example.NewCollection, ctest-mirror)$"
assert_file_has_content refs "^(org\.example\.Collection, ctest)$"
assert_file_has_content refs "^(org\.example\.NewCollection, ctest-mirror)$"
rm -rf repo/refs/mirrors
${CMD_PREFIX} ostree refs --repo=repo --collections --delete org.example.NonexistentCollection
+19 -7
View File
@@ -23,7 +23,7 @@ set -euo pipefail
. $(dirname $0)/libtest.sh
echo '1..14'
echo '1..16'
setup_test_repository "bare"
$OSTREE remote add origin http://example.com/ostree/gnome
@@ -51,18 +51,18 @@ $OSTREE remote list > list.txt
assert_file_has_content list.txt "origin"
assert_file_has_content list.txt "another"
assert_file_has_content list.txt "another-noexist"
assert_not_file_has_content list.txt "http://example.com/ostree/gnome"
assert_not_file_has_content list.txt "http://another.com/repo"
assert_not_file_has_content list.txt "http://another-noexist.example.com/anotherrepo"
assert_not_file_has_content list.txt "http://example\.com/ostree/gnome"
assert_not_file_has_content list.txt "http://another\.com/repo"
assert_not_file_has_content list.txt "http://another-noexist\.example\.com/anotherrepo"
echo "ok remote list"
$OSTREE remote list --show-urls > list.txt
assert_file_has_content list.txt "origin"
assert_file_has_content list.txt "another"
assert_file_has_content list.txt "another-noexist"
assert_file_has_content list.txt "http://example.com/ostree/gnome"
assert_file_has_content list.txt "http://another.com/repo"
assert_file_has_content list.txt "http://another-noexist.example.com/anotherrepo"
assert_file_has_content list.txt "http://example\.com/ostree/gnome"
assert_file_has_content list.txt "http://another\.com/repo"
assert_file_has_content list.txt "http://another-noexist\.example\.com/anotherrepo"
echo "ok remote list with urls"
cd ${test_tmpdir}
@@ -106,3 +106,15 @@ assert_not_file_has_content list.txt "origin"
# Can't grep for 'another' because of 'another-noexist'
assert_file_has_content list.txt "another-noexist"
echo "ok remote list remaining"
# Both --if-not-exists and --force cannot be used
if $OSTREE remote add --if-not-exists --force yetanother http://yetanother.com/repo 2>/dev/null; then
assert_not_reached "Adding remote with --if-not-exists and --force unexpectedly succeeded"
fi
echo "ok remote add fail --if-not-exists and --force"
# Overwrite with --force
$OSTREE remote add --force another http://another.example.com/anotherrepo
$OSTREE remote list --show-urls > list.txt
assert_file_has_content list.txt "^another \+http://another\.example\.com/anotherrepo$"
echo "ok remote add --force"
+53 -3
View File
@@ -34,7 +34,7 @@ function assertNotEquals(a, b) {
throw new Error("assertion failed " + JSON.stringify(a) + " != " + JSON.stringify(b));
}
print('1..6')
print('1..9')
let remotesDir = Gio.File.new_for_path('remotes.d');
remotesDir.make_directory(null);
@@ -45,6 +45,10 @@ remoteConfig.set_value('remote "foo"', 'url', 'http://foo')
let remoteConfigFile = remotesDir.get_child('foo.conf')
remoteConfig.save_to_file(remoteConfigFile.get_path())
let remoteOptions = GLib.Variant.new('a{sv}', {
'branches': GLib.Variant.new('as', ['test']),
});
// Use the full Repo constructor to set remotes-config-dir
let repoFile = Gio.File.new_for_path('repo');
let repo = new OSTree.Repo({path: repoFile,
@@ -60,7 +64,7 @@ print("ok read-remotes-config-dir");
// Adding a remote should not go in the remotes.d dir unless this is a
// system repo or add-remotes-config-dir is set to true
repo.remote_add('bar', 'http://bar', null, null);
repo.remote_add('bar', 'http://bar', remoteOptions, null);
remotes = repo.remote_list()
assertNotEquals(remotes.indexOf('bar'), -1);
assertEquals(remotesDir.get_child('bar.conf').query_exists(null), false);
@@ -81,7 +85,7 @@ let repoConfig = repo.copy_config();
repoConfig.set_boolean('core', 'add-remotes-config-dir', true);
repo.write_config(repoConfig);
repo.reload_config(null);
repo.remote_add('baz', 'http://baz', null, null);
repo.remote_add('baz', 'http://baz', remoteOptions, null);
remotes = repo.remote_list()
assertNotEquals(remotes.indexOf('baz'), -1);
assertEquals(remotesDir.get_child('baz.conf').query_exists(null), true);
@@ -114,3 +118,49 @@ try {
}
print("ok config-remote-in-config-dir-fails");
// Replacing a non-existent remote should succeed. This should go in the
// config dir since add-remote-config-dir is set to true above
repo.remote_change(null, OSTree.RepoRemoteChange.REPLACE,
'nonexistent', 'http://nonexistent',
null, null);
remotes = repo.remote_list();
assertNotEquals(remotes.indexOf('nonexistent'), -1);
assertEquals(remotesDir.get_child('nonexistent.conf').query_exists(null), true);
print("ok replace-missing-remote-succeeds");
// Test replacing remote options in config dir. This should remove the
// branches setting above
repo.remote_change(null, OSTree.RepoRemoteChange.REPLACE, 'baz',
'http://baz2', null, null);
remoteConfigFile = remotesDir.get_child('baz.conf');
remoteConfig = GLib.KeyFile.new();
remoteConfig.load_from_file(remoteConfigFile.get_path(),
GLib.KeyFileFlags.NONE);
assertEquals(remoteConfig.get_value('remote "baz"', 'url'), 'http://baz2');
try {
remoteConfig.get_string_list('remote "baz"', 'branches');
throw new Error('baz remote should not have branches option');
} catch (e) {
if (!(e.matches(GLib.KeyFileError, GLib.KeyFileError.KEY_NOT_FOUND)))
throw e;
}
print("ok replace-remote-in-config-dir");
// Test replacing remote options in config file. This should remove the
// branches setting above
repo.remote_change(null, OSTree.RepoRemoteChange.REPLACE, 'bar',
'http://bar2', null, null);
repoConfig = repo.get_config();
assertEquals(repoConfig.get_value('remote "bar"', 'url'), 'http://bar2');
try {
repoConfig.get_string_list('remote "bar"', 'branches');
throw new Error('bar remote should not have branches option');
} catch (e) {
if (!(e.matches(GLib.KeyFileError, GLib.KeyFileError.KEY_NOT_FOUND)))
throw e;
}
print("ok replace-remote-in-config-file");
+7 -7
View File
@@ -101,9 +101,9 @@ for fs_type in ext4 vfat; do
assert_has_dir "${usb_mount}"/.ostree/repo
${CMD_PREFIX} ostree --repo="${usb_mount}"/.ostree/repo refs --collections > dest-refs
assert_file_has_content dest-refs "^(org.example.Collection1, test-1)$"
assert_file_has_content dest-refs "^(org.example.Collection1, test-2)$"
assert_not_file_has_content dest-refs "^(org.example.Collection1, test-3)$"
assert_file_has_content dest-refs "^(org\.example\.Collection1, test-1)$"
assert_file_has_content dest-refs "^(org\.example\.Collection1, test-2)$"
assert_not_file_has_content dest-refs "^(org\.example\.Collection1, test-3)$"
assert_has_file "${usb_mount}"/.ostree/repo/summary
# Pull into a second local repository (theoretically, a separate computer).
@@ -112,15 +112,15 @@ for fs_type in ext4 vfat; do
${CMD_PREFIX} ostree --repo=peer-repo_$fs_type remote add remote1 file://just-here-for-the-keyring --collection-id org.example.Collection1 --gpg-import="${test_tmpdir}/gpghome/key1.asc"
${CMD_PREFIX} ostree --repo=peer-repo_$fs_type find-remotes --finders=mount org.example.Collection1 test-1 > find-results
assert_not_file_has_content find-results "^No results.$"
assert_not_file_has_content find-results "^No results\.$"
assert_file_has_content find-results "^Result 0: file://${usb_mount}"
assert_file_has_content find-results "(org.example.Collection1, test-1) = $(cat ref1-checksum)$"
assert_file_has_content find-results "(org\.example\.Collection1, test-1) = $(cat ref1-checksum)$"
${CMD_PREFIX} ostree --repo=peer-repo_$fs_type find-remotes --finders=mount --pull org.example.Collection1 test-1 > pull-results
assert_file_has_content pull-results "^Pulled 1/1 refs successfully.$"
assert_file_has_content pull-results "^Pulled 1/1 refs successfully\.$"
${CMD_PREFIX} ostree --repo=peer-repo_$fs_type refs --collections > refs
assert_file_has_content refs "^(org.example.Collection1, test-1)$"
assert_file_has_content refs "^(org\.example\.Collection1, test-1)$"
${SUDO} umount "${MOUNT_INTEGRATION_DEV}"
+8 -8
View File
@@ -43,19 +43,19 @@ done
${CMD_PREFIX} ostree --repo=repo summary --update
${CMD_PREFIX} ostree --repo=repo summary --view > summary
assert_file_has_content summary "(org.example.Collection, test-1)$"
assert_file_has_content summary "(org.example.Collection, test-2)$"
assert_file_has_content summary "(org.example.Collection, test-3)$"
assert_file_has_content summary "(org.example.Collection, test-4)$"
assert_file_has_content summary "(org.example.Collection, test-5)$"
assert_file_has_content summary "^Collection ID (ostree\.summary\.collection-id): org.example.Collection$"
assert_file_has_content summary "(org\.example\.Collection, test-1)$"
assert_file_has_content summary "(org\.example\.Collection, test-2)$"
assert_file_has_content summary "(org\.example\.Collection, test-3)$"
assert_file_has_content summary "(org\.example\.Collection, test-4)$"
assert_file_has_content summary "(org\.example\.Collection, test-5)$"
assert_file_has_content summary "^Collection ID (ostree\.summary\.collection-id): org\.example\.Collection$"
# Test that mirrored branches are listed too.
${CMD_PREFIX} ostree --repo=repo refs --collections --create=org.example.OtherCollection:test-1-mirror test-1
${CMD_PREFIX} ostree --repo=repo summary --update
${CMD_PREFIX} ostree --repo=repo summary --view > summary
assert_file_has_content summary "(org.example.OtherCollection, test-1-mirror)$"
assert_file_has_content summary "(org\.example\.OtherCollection, test-1-mirror)$"
# Test that remote refs are listed, but only if they have collection IDs
cd ${test_tmpdir}
@@ -68,7 +68,7 @@ ${CMD_PREFIX} ostree --repo=repo pull collection-repo-remote rcommit
${CMD_PREFIX} ostree --repo=repo summary --update
${CMD_PREFIX} ostree --repo=repo summary --view > summary
assert_file_has_content summary "(org.example.RemoteCollection, rcommit)$"
assert_file_has_content summary "(org\.example\.RemoteCollection, rcommit)$"
cd ${test_tmpdir}
mkdir no-collection-repo
+4 -9
View File
@@ -58,12 +58,7 @@ assert_file_has_content summary "^map: {}$"
echo "ok 1 update summary"
# Test again, but with collections enabled in the repository (if supported).
if ! ostree --version | grep -q -e '- experimental'; then
echo "ok 2 # skip No experimental API is compiled in"
exit 0
fi
# Test again, but with collections enabled in the repository.
cd ${test_tmpdir}
rm -rf repo
ostree_repo_init repo --collection-id org.example.Collection1
@@ -95,12 +90,12 @@ assert_file_has_content summary "^map: {}$"
# Check the ostree-metadata ref has also been created with the same content and appropriate bindings.
${CMD_PREFIX} ostree --repo=repo refs --collections > refs
assert_file_has_content refs "^(org.example.Collection1, ostree-metadata)$"
assert_file_has_content refs "^(org\.example\.Collection1, ostree-metadata)$"
${CMD_PREFIX} ostree --repo=repo show ostree-metadata --raw > metadata
assert_file_has_content metadata "'map': <@a{sv} {}>"
assert_file_has_content metadata "'ostree.ref-binding': <\['ostree-metadata'\]>"
assert_file_has_content metadata "'ostree.collection-binding': <'org.example.Collection1'>"
assert_file_has_content metadata "'ostree\.ref-binding': <\['ostree-metadata'\]>"
assert_file_has_content metadata "'ostree\.collection-binding': <'org\.example\.Collection1'>"
# There should be 5 commits in the ostree-metadata branch, since we’ve updated the summary 5 times.
${CMD_PREFIX} ostree --repo=repo log ostree-metadata | grep 'commit ' | wc -l > commit-count
+1 -1
View File
@@ -54,7 +54,7 @@ echo 'ok documented symbols'
# ONLY update this checksum in release commits!
cat > released-sha256.txt <<EOF
ae2946567160d4a47c8a7d000b87306895ee72cdd339e157d21c839e4b2c003a ${released_syms}
26f500134a55d678dd8ce6ba971c9e05cd4848b50ab895abc32cde1cffb5ad28 ${released_syms}
EOF
sha256sum -c released-sha256.txt
+2 -2
View File
@@ -42,8 +42,8 @@ echo "ok commit with xattrs"
${CMD_PREFIX} ostree --repo=repo checkout test2 test2-checkout2
getfattr -m . test2-checkout2/firstfile > attrs
assert_file_has_content attrs '^user.ostree-test'
assert_file_has_content attrs '^user.test0'
assert_file_has_content attrs '^user\.ostree-test'
assert_file_has_content attrs '^user\.test0'
getfattr -n user.ostree-test --only-values test2-checkout2/firstfile > v0
assert_file_has_content v0 '^testvalue$'
getfattr -n user.test0 --only-values test2-checkout2/firstfile > v1