-if [ "x$rsync_enable_ssh_tests" != xyes ]
-then
- echo "Skipping SSH tests because $rsync_enable_ssh_tests is not set"
- exit 77
+SSH="$scratchdir/pretend-ssh"
+
+cat >"$SSH" <<'EOT'
+while : ; do
+ case "$1" in
+ -*) shift ;;
+ localhost) shift; break ;;
+ *) exit 1 ;;
+ esac
+done
+
+eval "${@}"
+EOT
+chmod +x "$SSH"
+
+if test x"$rsync_enable_ssh_tests" = xyes; then
+ if type ssh >/dev/null ; then
+ SSH=ssh
+ fi