1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
#!/usr/bin/env bash
. ./wvtest-bup.sh || exit $?
. dev/lib.sh || exit $?
set -o pipefail
top="$(WVPASS pwd)" || exit $?
tmpdir="$(WVPASS wvmktempdir)" || exit $?
export BUP_DIR="$tmpdir/bup"
export GIT_DIR="$tmpdir/bup"
bup() { "$top/bup" "$@"; }
fs-size() { tar cf - "$@" | wc -c; }
WVSTART "compression"
WVPASS cd "$tmpdir"
D=compression0.tmp
WVPASS force-delete "$BUP_DIR"
WVPASS bup init
WVPASS mkdir $D
WVPASS bup index "$top/Documentation"
WVPASS bup save -n compression -0 --strip "$top/Documentation"
# Some platforms set -A by default when root, so just use it everywhere.
expected="$(WVPASS ls -A "$top/Documentation" | WVPASS sort)" || exit $?
actual="$(WVPASS bup ls -A compression/latest/ | WVPASS sort)" || exit $?
WVPASSEQ "$actual" "$expected"
compression_0_size=$(WVPASS fs-size "$BUP_DIR") || exit $?
D=compression9.tmp
WVPASS force-delete "$BUP_DIR"
WVPASS bup init
WVPASS mkdir $D
WVPASS bup index "$top/Documentation"
WVPASS bup save -n compression -9 --strip "$top/Documentation"
expected="$(ls -A "$top/Documentation" | sort)" || exit $?
actual="$(bup ls -A compression/latest/ | sort)" || exit $?
WVPASSEQ "$actual" "$expected"
compression_9_size=$(WVPASS fs-size "$BUP_DIR") || exit $?
WVPASS [ "$compression_9_size" -lt "$compression_0_size" ]
WVPASS rm -rf "$tmpdir"
|