From 246a7a5cc21cefa57a908f4374a7e19766fb89cc Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 22 Mar 2018 12:47:07 -0400 Subject: [PATCH] tests/payload-link: Just test a single duplicate object We were previously assuming that the host content had duplicates, which...hopefully it doesn't! We shouldn't rely on that. Also this test is slow in production and flaky. Let's just test a single duplicate object. Closes: #1509 Approved by: jlebon --- tests/installed/itest-payload-link.sh | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/tests/installed/itest-payload-link.sh b/tests/installed/itest-payload-link.sh index 7469f43e..f0576d82 100755 --- a/tests/installed/itest-payload-link.sh +++ b/tests/installed/itest-payload-link.sh @@ -31,9 +31,16 @@ prepare_tmpdir /var/tmp trap _tmpdir_cleanup EXIT ostree --repo=repo init --mode=archive echo -e '[archive]\nzlib-level=1\n' >> repo/config -host_nonremoteref=$(echo ${host_refspec} | sed 's,[^:]*:,,') -ostree --repo=repo pull-local /ostree/repo ${host_commit} -ostree --repo=repo refs ${host_commit} --create=${host_nonremoteref} + +mkdir content +cd content +dd if=/dev/urandom of=bigobject bs=4k count=2560 +cp --reflink=auto bigobject bigobject2 +# Different metadata, same content +chown bin:bin bigobject2 +cd .. +ostree --repo=repo commit -b dupobjects --consume --selinux-policy=/ --tree=dir=content +ostree --repo=repo summary -u run_tmp_webserver $(pwd)/repo @@ -53,23 +60,24 @@ if ! blkdev=$(losetup --find --show $(pwd)/testblk.img); then exit 0 fi +# This filesystem must support reflinks mkfs.xfs -m reflink=1 ${blkdev} mount ${blkdev} mnt cd mnt -# Test that coreutils will do reflink +# Test that reflink is really there (not just --reflink=auto) touch a cp --reflink a b mkdir repo ostree --repo=repo init ostree config --repo=repo set core.payload-link-threshold 0 ostree --repo=repo remote add origin --set=gpg-verify=false ${origin} -ostree --repo=repo pull --disable-static-deltas origin ${host_nonremoteref} +ostree --repo=repo pull --disable-static-deltas origin dupobjects find repo -type l -name '*.payload-link' >payload-links.txt -assert_not_streq "$(wc -l < payload-links.txt)" "0" +assert_streq "$(wc -l < payload-links.txt)" "1" -# Disable logging for inner loop, otherwise it'd be enormous +# Disable logging for inner loop set +x cat payload-links.txt | while read i; do payload_checksum=$(basename $(dirname $i))$(basename $i .payload-link)