diff options
author | Colin Walters <walters@verbum.org> | 2016-02-12 12:41:15 -0500 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2016-02-14 10:28:17 -0500 |
commit | f0b6b358cd012420c7011df1e1aa8a150b50e412 (patch) | |
tree | a092d707630cc886824803cb8247b92fd9274f86 /manual-tests | |
parent | 42c60effbe5037d674ce4b84979ccaf91edfad48 (diff) | |
download | ostree-f0b6b358cd012420c7011df1e1aa8a150b50e412.tar.gz |
manual-tests: New static-delta-generate-crosscheck.sh
I wanted to test static deltas vs a repo with "real" content
in it from Fedora Atomic.
Diffstat (limited to 'manual-tests')
-rwxr-xr-x | manual-tests/static-delta-generate-crosscheck.sh | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/manual-tests/static-delta-generate-crosscheck.sh b/manual-tests/static-delta-generate-crosscheck.sh new file mode 100755 index 00000000..4dbaab98 --- /dev/null +++ b/manual-tests/static-delta-generate-crosscheck.sh @@ -0,0 +1,62 @@ +#!/usr/bin/env bash +# +# Generate multiple variants of static deltas in a repo, then use them +# to upgrade in a test repository, verifying that fsck works. +# +# This test is manual so it's easy to run against arbitrary content. + +set -euo pipefail + +repo=$(pwd)/${1} +shift +branch=${1} +shift + +from=$(ostree --repo=${repo} rev-parse "${branch}"^) +to=$(ostree --repo=${repo} rev-parse ${branch}) + +tmpdir=$(mktemp -d /var/tmp/ostree-delta-check.XXXXXX) +cd ${tmpdir} +touch ${tmpdir}/.tmp +echo "Using tmpdir ${tmpdir}" + +cleanup_tmpdir() { + if test -f ${tmpdir}/.tmp; then + rm -rf ${tmpdir} + fi +} + +if test -z "${PRESERVE_TMP:-}"; then + trap cleanup_tmpdir EXIT +fi + +fatal() { + echo "$@" + exit 1 +} + +assert_streq() { + if ! test $1 = $2; then + fatal "assertion failed: $1 = $2" + fi +} + +validate_delta_options() { + mkdir testrepo + ostree --repo=testrepo init --mode=bare-user + ostree --repo=testrepo remote add --set=gpg-verify=false local file://${repo} + ostree --repo=${repo} static-delta generate $@ ${from} ${to} + ostree --repo=testrepo pull local ${branch}@${from} + assert_streq $(ostree --repo=testrepo rev-parse ${branch}) ${from} + ostree --repo=testrepo pull local ${branch} + assert_streq $(ostree --repo=testrepo rev-parse ${branch}) ${to} + ostree --repo=testrepo fsck + rm testrepo -rf +} + +set -x + +validate_delta_options +validate_delta_options --inline +validate_delta_options --disable-bsdiff + |