8 if test -z "$BUP_TEST_OTHER_BUP"; then
9 WVSKIP 'Other bup not specified by BUP_TEST_OTHER_BUP; skipping test'
13 seed="${BUP_TEST_RANDOM_SEED:-$RANDOM}"
15 WVSTART "split/join against $BUP_TEST_OTHER_BUP (random seed $seed)"
17 top="$(WVPASS pwd)" || exit $?
19 this_bup="${BUP_TEST_THIS_BUP:-$top/bup}"
21 this-bup() { "$this_bup" -d "$this_bup_dir" "$@"; }
22 other-bup() { "$BUP_TEST_OTHER_BUP" -d "$other_bup_dir" "$@"; }
24 this_version="$(WVPASS this-bup version)"
25 other_version="$(WVPASS other-bup version)"
29 # In bb0e9cbf3900e65d2fddbe888e6cb21c59b308df the packfile name
30 # hashing was changed to match git, which itself may have changed
31 # over time. Classify bup versions into categories based on the
32 # approach so we can know when we should expect the names to
36 # Versions are now generally 0.32 or 0.32+, but just look at
37 # the leading integers, and assume anything after indicates
42 0.[0-9][^0-9]*) echo 0 ;;
44 0.[12][0-9]) echo 0 ;;
45 0.[12][0-9][^0-9]*) echo 0 ;;
48 0.3[01][^0-9]*) echo 0 ;;
50 # Fix was added during 0.33~, but unfortunately, the
51 # base_version wasn't updated immediately after the release,
52 # so many of those commits report 0.32*. Given that, just
53 # treat all 0.32* as "who knows".
54 0.32|0.32[^0-9]*) echo 1 ;;
60 case "$(packname-flavor "$this_version")""$(packname-flavor "$other_version")" in
61 00|22) test_packnames=true ;;
62 *) test_packnames='' ;;
65 tmpdir="$(WVPASS wvmktempdir)" || exit $?
71 local size="$1" orig_dir
73 orig_dir="$(WVPASS pwd)"
75 WVSTART "split/join of $(($size / 1024))kb"
77 WVPASS mkdir split-join
80 this_bup_dir="$(WVPASS pwd)/this-bup"
81 other_bup_dir="$(WVPASS pwd)/other-bup"
86 WVPASS this-bup random --seed "$RANDOM" "$size" > data
88 WVPASS other-bup split -t data > other-split-tree
89 WVPASS this-bup split -t data > this-split-tree
90 WVPASSEQ "$(<other-split-tree)" "$(<this-split-tree)"
92 WVPASS other-bup join "$(<this-split-tree)" > other-join.data
93 WVPASS this-bup join "$(<this-split-tree)" > this-join.data
94 WVPASS cmp other-join.data this-join.data
96 if ! test "$test_packnames"; then
97 # Make sure there's just one of each file in each repo and
98 # compare those via cmp, then delete them.
99 WVPASS test -f other-bup/objects/pack/pack-*.idx
100 WVPASS test -f other-bup/objects/pack/pack-*.pack
101 WVPASS test -f this-bup/objects/pack/pack-*.idx
102 WVPASS test -f this-bup/objects/pack/pack-*.pack
103 WVPASS cmp {other,this}-bup/objects/pack/pack-*.idx
104 WVPASS cmp {other,this}-bup/objects/pack/pack-*.pack
105 WVPASS rm {other,this}-bup/objects/pack/pack-*.idx
106 WVPASS rm {other,this}-bup/objects/pack/pack-*.pack
107 # The bloom filter includes the (differing) idx names
108 WVPASS rm {other,this}-bup/objects/pack/bup.bloom
110 WVPASS "$top/dev/compare-trees" --no-times other-bup/ this-bup/
112 WVPASS cd "$orig_dir"
113 WVPASS rm -r split-join
119 test-split-join $(($RANDOM * 1024))
123 WVPASS rm -rf "$tmpdir"