[PATCH 2 of 2 hg-bfiles] test-sshstore-verify: new test to check hg verify command with sshstore

david.douard at logilab.fr david.douard at logilab.fr
Thu Nov 19 14:46:31 CST 2009


# HG changeset patch
# User David Douard <david.douard at logilab.fr>
# Date 1258393114 -3600
# Node ID fe3769b0baf1bd7730e0bba2a5e73e3b8204aa8f
# Parent  20fde2fd8d2a456ea24a3ee25878d0888271b609
test-sshstore-verify: new test to check hg verify command with sshstore

This test is for now mostly an adapted copy of test-verify.

diff --git a/tests/test-sshstore-verify b/tests/test-sshstore-verify
new file mode 100755
--- /dev/null
+++ b/tests/test-sshstore-verify
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+# Test bfiles' SSHStore.
+
+. "$TESTDIR/common"
+
+# skip test if "ssh localhost" does not work
+assertssh
+createrc
+
+cat >> $HGRCPATH <<__EOF__
+[bfiles]
+store = ssh://localhost/$STOREDIR/
+__EOF__
+
+tar -xf $TESTDIR/test-store.tar
+hg clone -q -U $TESTDIR/test-repo1.bundle repo1
+
+bfverify() {
+    /bin/echo hg bfverify "$@"
+    ($hg bfverify "$@" && echo PASS || echo FAIL) 2>&1 | filterpaths
+
+
+    #$hg bfverify "$@" 2>&1 | filterpaths
+    #if [ $? = 0 ]; then
+    #    echo PASS
+    #else
+    #    echo FAIL
+    #fi
+}
+
+echo "% successful bfverify"
+cd repo1
+hg update 3
+bfverify
+
+bfverify --contents
+bfverify --all
+bfverify --contents --all
+
+echo "% damage store: normal bfverify does not notice, but --contents does"
+storefile=$STOREDIR/big1/`cat .hgbfiles/big1`
+cp -p $storefile $HGTMP/save
+echo x >> $storefile
+bfverify
+bfverify --contents
+
+echo "% remove file from store; normal bfverify notices"
+rm $storefile
+bfverify || echo FAIL 2>&1 | filterpaths
+mv $HGTMP/save $storefile
+
+echo "% add junk to the store; nothing notices (yet)"
+touch $STOREDIR/junkfile
+mkdir $STOREDIR/junkdir
+touch $STOREDIR/junkdir/ffffffffffffffffffffffffffffffffffffffff
+touch $STOREDIR/big1/ffffffffffffffffffffffffffffffffffffffff
+bfverify
+bfverify --all
+
+exit 0
diff --git a/tests/test-sshstore-verify.out b/tests/test-sshstore-verify.out
new file mode 100644
--- /dev/null
+++ b/tests/test-sshstore-verify.out
@@ -0,0 +1,47 @@
+hg clone -q -U $TESTDIR/test-repo1.bundle repo1
+% successful bfverify
+hg update 3
+5 files updated, 0 files merged, 0 files removed, 0 files unresolved
+hg bfverify
+searching 1 changesets for big files
+verified existence of 3 revisions of 3 big files
+PASS
+hg bfverify --contents
+searching 1 changesets for big files
+verified contents of 3 revisions of 3 big files
+PASS
+hg bfverify --all
+searching 5 changesets for big files
+verified existence of 6 revisions of 5 big files
+PASS
+hg bfverify --contents --all
+searching 5 changesets for big files
+verified contents of 6 revisions of 5 big files
+PASS
+% damage store: normal bfverify does not notice, but --contents does
+hg bfverify
+searching 1 changesets for big files
+verified existence of 3 revisions of 3 big files
+PASS
+hg bfverify --contents
+searching 1 changesets for big files
+changeset 3:0d9a8f376302: big1: contents differ
+  ($HGTMP/test-sshstore-verify/store/big1/d52500312b0201d2d2ef3803e384195a9ce68b2f)
+verified contents of 3 revisions of 3 big files
+FAIL
+% remove file from store; normal bfverify notices
+hg bfverify
+searching 1 changesets for big files
+changeset 3:0d9a8f376302: big1 missing
+  ($HGTMP/test-sshstore-verify/store/big1/d52500312b0201d2d2ef3803e384195a9ce68b2f)
+verified existence of 3 revisions of 3 big files
+FAIL
+% add junk to the store; nothing notices (yet)
+hg bfverify
+searching 1 changesets for big files
+verified existence of 3 revisions of 3 big files
+PASS
+hg bfverify --all
+searching 5 changesets for big files
+verified existence of 6 revisions of 5 big files
+PASS


More information about the Mercurial-devel mailing list