8 top="$(WVPASS pwd)" || exit $?
9 tmpdir="$(WVPASS wvmktempdir)" || exit $?
10 export BUP_DIR="$tmpdir/bup"
12 bup() { "$top/bup" "$@"; }
13 sha1sum() { "$top/dev/checksum" -t sha1 "$@"; }
19 # Be independent of git defaults or a configured defaultBranch
20 git --git-dir "$BUP_DIR" symbolic-ref HEAD refs/heads/main
22 WVPASS force-delete $D
25 WVPASS bup random 128k >$D/b
26 WVPASS mkdir $D/d $D/d/e
27 WVPASS bup random 512 >$D/f
35 WVPASS bup bloom -c $(ls -1 "$BUP_DIR"/objects/pack/*.idx|head -n1)
36 WVPASS rm "$BUP_DIR"/objects/pack/bup.bloom
38 WVPASS bup bloom -c $(ls -1 "$BUP_DIR"/objects/pack/*.idx|head -n1)
39 WVPASS bup bloom -d "$BUP_DIR"/objects/pack --ruin --force
40 WVFAIL bup bloom -c $(ls -1 "$BUP_DIR"/objects/pack/*.idx|head -n1)
41 WVPASS bup bloom --force -k 5
42 WVPASS bup bloom -c $(ls -1 "$BUP_DIR"/objects/pack/*.idx|head -n1)
46 WVPASS bup memtest -c1 -n100
47 WVPASS bup memtest -c1 -n100 --existing
50 WVSTART "save/git-fsck"
55 WVPASS bup random 4k | WVPASS bup split -b
56 (WVPASS cd "$top/test/sampledata" && WVPASS bup save -vvn main /) || exit $?
57 result="$(LC_ALL=C git fsck --full --strict 2>&1)" || exit $?
59 WVFAIL egrep -v 'dangling (commit|tree|blob)' |
60 WVPASS tee -a /dev/stderr |
61 WVPASS wc -l) || exit $?
66 WVSTART "pack name and idx same as git"
68 # reuse packs from previous test
69 WVPASS cd "$BUP_DIR"/objects/pack/
71 for pack in *.pack ; do
72 bup_idx_sha=$(sha1sum $(basename $pack .pack).idx) || exit $?
73 gitname=$(git index-pack $pack) || exit $?
74 # make sure we named it correctly (like git)
75 WVPASSEQ pack-$gitname.pack $pack
76 # make sure we wrote the index correctly
77 git_idx_sha=$(sha1sum $(basename $pack .pack).idx) || exit $?
78 WVPASSEQ "$bup_idx_sha" "$git_idx_sha"
84 WVPASS bup ftp "cat /main/latest/$tmpdir/$D/b" >$D/b.new
85 WVPASS bup ftp "cat /main/latest/$tmpdir/$D/f" >$D/f.new
86 WVPASS bup ftp "cat /main/latest/$tmpdir/$D/f"{,} >$D/f2.new
87 WVPASS bup ftp "cat /main/latest/$tmpdir/$D/a" >$D/a.new
88 WVPASSEQ "$(sha1sum <$D/b)" "$(sha1sum <$D/b.new)"
89 WVPASSEQ "$(sha1sum <$D/f)" "$(sha1sum <$D/f.new)"
90 WVPASSEQ "$(cat $D/f.new{,} | sha1sum)" "$(sha1sum <$D/f2.new)"
91 WVPASSEQ "$(sha1sum <$D/a)" "$(sha1sum <$D/a.new)"
95 WVFAIL bup tag -d v0.n 2>/dev/null
96 WVFAIL bup tag v0.n non-existant 2>/dev/null
97 WVPASSEQ "$(bup tag)" ""
98 WVPASS bup tag v0.1 main
99 WVPASSEQ "$(bup tag)" "v0.1"
100 WVFAIL bup tag v0.1 main
101 WVPASS bup tag -f v0.1 main
102 WVPASS bup tag -d v0.1
103 WVPASS bup tag -f -d v0.1
104 WVFAIL bup tag -d v0.1
109 INDEXFILE=tmpindexfile.tmp
110 WVPASS rm -f $INDEXFILE
111 WVPASS force-delete $D
113 export BUP_DIR="$D/.bup"
118 WVPASS bup index -ux $D
119 WVPASS bup save --strip -n bupdir $D
120 WVPASSEQ "$(bup ls -F bupdir/latest/)" "a
123 WVPASS bup index -f $INDEXFILE --exclude=$D/c -ux $D
124 WVPASS bup save --strip -n indexfile -f $INDEXFILE $D
125 WVPASSEQ "$(bup ls indexfile/latest/)" "a
129 WVSTART "import-rsnapshot"
131 export BUP_DIR="$tmpdir/$D/.bup"
132 WVPASS force-delete $D
135 WVPASS mkdir -p $D/hourly.0/buptest/a
136 WVPASS touch $D/hourly.0/buptest/a/b
137 WVPASS mkdir -p $D/hourly.0/buptest/c/d
138 WVPASS touch $D/hourly.0/buptest/c/d/e
140 WVPASS bup import-rsnapshot $D/
141 WVPASSEQ "$(bup ls -F buptest/latest/)" "a/
146 expect_py_ver=$(LC_CTYPE=C "$top/dev/python" \
147 -c 'import platform; print(platform.python_version())') \
149 actual_py_ver=$(bup features | grep Python: | sed -Ee 's/ +Python: //') || exit $?
150 WVPASSEQ "$expect_py_ver" "$actual_py_ver"
153 WVSTART id-other-than
154 result=$("$top/dev/id-other-than" --user 0) || exit $?
155 WVPASS echo "$result" | WVPASS grep -qE '.*:[0-9]+$'
156 result=$("$top/dev/id-other-than" --group 0) || exit $?
157 WVPASS echo "$result" | WVPASS grep -qE '.*:[0-9]+$'
160 WVPASS rm -rf "$tmpdir"