[PATCH 3 of 4 bfiles] tests: make ssh verification code (from test-sshstore) a function in common

david.douard at logilab.fr david.douard at logilab.fr
Tue Dec 1 13:05:12 CST 2009


# HG changeset patch
# User David Douard <david.douard at logilab.fr>
# Date 1259691358 -3600
# Node ID 8f95c8aa0f93bbe517c5612d52e3ebca4c2fd67e
# Parent  cae8ee45627db044f7c8375165e7e0738dc6d74a
tests: make ssh verification code (from test-sshstore) a function in common

diff --git a/tests/common b/tests/common
--- a/tests/common
+++ b/tests/common
@@ -74,3 +74,12 @@
         echo "pass: $dir/ does not exist"
     fi
 }
+
+assertssh() {
+    # 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
+}
diff --git a/tests/test-sshstore b/tests/test-sshstore
--- a/tests/test-sshstore
+++ b/tests/test-sshstore
@@ -2,14 +2,8 @@
 
 # Test bfiles' SSHStore.
 
-# 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"


More information about the Mercurial-devel mailing list