[PATCH 1 of 2 hg-bfiles] tests, test-sshstore: add a function in common to check ssh is working

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


# HG changeset patch
# User David Douard <david.douard at logilab.fr>
# Date 1258392941 -3600
# Node ID 20fde2fd8d2a456ea24a3ee25878d0888271b609
# Parent  302666bd3ff5cea246ce74efa108f58e4d48c8f0
tests, test-sshstore: add a function in common to check ssh is working

diff --git a/tests/common b/tests/common
--- a/tests/common
+++ b/tests/common
@@ -67,3 +67,11 @@
         echo "pass: $dir/ does not exist"
     fi
 }
+
+assertssh() {
+    sshout=`ssh -n localhost -o BatchMode=yes "echo foo" 2>&1`
+    if [ "$sshout" != "foo" ]; then
+	echo "skipped: no ssh access to localhost"
+	exit 80
+    fi
+}
\ No newline at end of file
diff --git a/tests/test-sshstore b/tests/test-sshstore
--- a/tests/test-sshstore
+++ b/tests/test-sshstore
@@ -2,28 +2,22 @@
 
 # Test bfiles' SSHStore.
 
+. "$TESTDIR/common"
+
 # skip test if "ssh localhost" does not work
-sshout=`ssh -n localhost -o BatchMode=yes "echo foo" 2>&1`
-if [ "$sshout" != "foo" ]; then
-    echo "skipped: no ssh access to localhost"
-    exit 80
-fi
-
-. "$TESTDIR/common"
+assertssh
 createrc
 
 echo "% setup"
 tar -xf $TESTDIR/test-store.tar
 
-storedir=$PWD/store
-
 hg clone -q -U $TESTDIR/test-repo1.bundle repo1
 cd repo1
 
 user=${LOGNAME:-USER}
 cat >> $HGRCPATH <<__EOF__
 [bfiles]
-store = ssh://$user@localhost/$storedir/
+store = ssh://$user@localhost/$STOREDIR/
 __EOF__
 
 echo "% rev 1: get big1, big2"


More information about the Mercurial-devel mailing list