]> arthur.barton.de Git - bup.git/commitdiff
test-compression.sh: use "tar ... | wc -c" instead of du.
authorRob Browning <rlb@defaultvalue.org>
Mon, 17 Feb 2014 18:39:05 +0000 (12:39 -0600)
committerRob Browning <rlb@defaultvalue.org>
Mon, 17 Feb 2014 18:46:46 +0000 (12:46 -0600)
This test was failing on a ZFS system with compression enabled because
du wasn't summing the actual file sizes.  To fix that, use tar/wc so
that we'll calculate the actual tree size without having to worry
about the portability of du's --apparent-size argument.

Thanks to Björn Seifert <seifert@oern.de> for reporting the problem
and Greg Troxel <gdt@lexort.com> for suggesting this fix.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
t/test-compression.sh

index 9e3c02d1fc15c76efea8f48e9a7eeefa039db632..3fd4ea1bd51b3b28b582af688b3be42fc8dd0dfd 100755 (executable)
@@ -11,6 +11,7 @@ export BUP_DIR="$tmpdir/bup"
 export GIT_DIR="$tmpdir/bup"
 
 bup() { "$top/bup" "$@"; }
+fs-size() { tar cf - "$@" | wc -c; }
 
 WVSTART "compression"
 WVPASS cd "$tmpdir"
@@ -25,7 +26,7 @@ WVPASS bup save -n compression -0 --strip "$top/Documentation"
 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 du -k -s "$BUP_DIR" | WVPASS cut -f1) || exit $?
+compression_0_size=$(WVPASS fs-size "$BUP_DIR") || exit $?
 
 D=compression9.tmp
 WVPASS force-delete "$BUP_DIR"
@@ -36,7 +37,7 @@ 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 du -k -s "$BUP_DIR" | WVPASS cut -f1) || exit $?
+compression_9_size=$(WVPASS fs-size "$BUP_DIR") || exit $?
 
 WVPASS [ "$compression_9_size" -lt "$compression_0_size" ]