-# Very simple metadata tests -- "make install" to a temp directory,
-# then check that bup meta can reproduce the metadata correctly
-# (according to coreutils stat) via create, extract, build-tree, and
-# settle-up. The current use of stat is crude, and this does not test
-# devices, varying users/groups, acls, attrs, etc.
-WVSTART "meta"
-# Create a test tree and collect its info via stat(1).
-(
- set -e
- rm -rf "${TOP}/bupmeta.tmp"
- mkdir -p "${TOP}/bupmeta.tmp"
- make DESTDIR="${TOP}/bupmeta.tmp/src" install
- mkdir "${TOP}/bupmeta.tmp/src/misc"
- cp -a cmd/bup-* "${TOP}/bupmeta.tmp/src/misc/"
- cd "${TOP}/bupmeta.tmp/src"
- find . | sort | xargs stat \
- | sed 's/Inode: [0-9]\+//' \
- | sed '/^ \+Size: /d' \
- | sed '/^Change: /d' \
- > ../src-stat
-) || exit 1
-# Use the test tree to check bup meta.
-(
- cd "${TOP}/bupmeta.tmp" || exit 1
- WVPASS bup meta --create --recurse --file src.meta src
- mkdir src-restore || exit 1
- cd src-restore || exit 1
- WVPASS bup meta --extract --file ../src.meta
- WVPASS test -d src
- (
- set -e
- cd src
- find . | sort | xargs stat \
- | sed 's/Inode: [0-9]\+//' \
- | sed '/^ \+Size: /d' \
- | sed '/^Change: /d' \
- > ../../src-restore-stat
- ) || exit 1
- WVPASS diff -u ../src-stat ../src-restore-stat
- rm -rf src
- WVPASS bup meta --start-extract --file ../src.meta
- WVPASS test -d src
- WVPASS bup meta --finish-extract --file ../src.meta
- (
- set -e
- cd src
- find . | sort | xargs stat \
- | sed 's/Inode: [0-9]\+//' \
- | sed '/^ \+Size: /d' \
- | sed '/^Change: /d' \
- > ../../src-restore-stat
- ) || exit 1
- WVPASS diff -u ../src-stat ../src-restore-stat
-)
+WVSTART "tag"
+WVFAIL bup tag -d v0.n 2>/dev/null
+WVFAIL bup tag v0.n non-existant 2>/dev/null
+WVPASSEQ "$(bup tag)" ""
+WVPASS bup tag v0.1 master
+WVPASSEQ "$(bup tag)" "v0.1"
+WVFAIL bup tag v0.1 master
+WVPASS bup tag -f v0.1 master
+WVPASS bup tag -d v0.1
+WVPASS bup tag -f -d v0.1
+WVFAIL bup tag -d v0.1
+
+
+WVSTART "indexfile"
+D=indexfile.tmp
+INDEXFILE=tmpindexfile.tmp
+WVPASS rm -f $INDEXFILE
+WVPASS force-delete $D
+WVPASS mkdir $D
+export BUP_DIR="$D/.bup"
+WVPASS bup init
+WVPASS touch $D/a
+WVPASS touch $D/b
+WVPASS mkdir $D/c
+WVPASS bup index -ux $D
+WVPASS bup save --strip -n bupdir $D
+WVPASSEQ "$(bup ls -F bupdir/latest/)" "a
+b
+c/"
+WVPASS bup index -f $INDEXFILE --exclude=$D/c -ux $D
+WVPASS bup save --strip -n indexfile -f $INDEXFILE $D
+WVPASSEQ "$(bup ls indexfile/latest/)" "a
+b"
+
+
+WVSTART "import-rsnapshot"
+D=rsnapshot.tmp
+export BUP_DIR="$tmpdir/$D/.bup"
+WVPASS force-delete $D
+WVPASS mkdir $D
+WVPASS bup init
+WVPASS mkdir -p $D/hourly.0/buptest/a
+WVPASS touch $D/hourly.0/buptest/a/b
+WVPASS mkdir -p $D/hourly.0/buptest/c/d
+WVPASS touch $D/hourly.0/buptest/c/d/e
+WVPASS true
+WVPASS bup import-rsnapshot $D/
+WVPASSEQ "$(bup ls -F buptest/latest/)" "a/
+c/"
+