# HG changeset patch # User Mads Kiilerich # Date 1336344731 -7200 # Node ID 289fdcd4cb471a28ab115df75be22988a7ee08ac # Parent feb1fd2d13a9635561b09df4da378984bd740e9a tests: improve test of hg-ssh and make the test pass on windows diff -r feb1fd2d13a9 -r 289fdcd4cb47 tests/test-ssh.t --- a/tests/test-ssh.t Mon May 07 00:52:08 2012 +0200 +++ b/tests/test-ssh.t Mon May 07 00:52:11 2012 +0200 @@ -278,21 +278,36 @@ $ hg id --ssh "python \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo" 3fb238f49e8c -Test hg-ssh: +Test hg-ssh using a helper script that will restore PYTHONPATH (which might +have been cleared by a hg.exe wrapper) and invoke hg-ssh with the right +parameters: - $ SSH_ORIGINAL_COMMAND="'hg' -R 'a repo' serve --stdio" hg id --ssh "python \"$TESTDIR\"/../contrib/hg-ssh \"$TESTTMP/a repo\"" "ssh://user@dummy/a repo" + $ cat > ssh.sh << EOF + > userhost="\$1" + > SSH_ORIGINAL_COMMAND="\$2" + > export SSH_ORIGINAL_COMMAND + > PYTHONPATH="$PYTHONPATH" + > export PYTHONPATH + > python "$TESTDIR/../contrib/hg-ssh" "$TESTTMP/a repo" + > EOF + + $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a repo" 3fb238f49e8c - $ SSH_ORIGINAL_COMMAND="'hg' -R 'a repo' serve --stdio" hg id --ssh "python \"$TESTDIR\"/../contrib/hg-ssh \"$TESTTMP\"" "ssh://user@dummy/a repo" - remote: Illegal repository "$TESTTMP/a repo" (glob) + $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a'repo" + remote: Illegal repository "$TESTTMP/a'repo" (glob) abort: no suitable response from remote hg! [255] - $ SSH_ORIGINAL_COMMAND="'hg' -R 'a'repo' serve --stdio" hg id --ssh "python \"$TESTDIR\"/../contrib/hg-ssh \"$TESTTMP\"" "ssh://user@dummy/a repo" - remote: Illegal command "'hg' -R 'a'repo' serve --stdio": No closing quotation + $ hg id --ssh "sh ssh.sh" --remotecmd hacking "ssh://user@dummy/a'repo" + remote: Illegal command "hacking -R 'a'\''repo' serve --stdio" abort: no suitable response from remote hg! [255] + $ SSH_ORIGINAL_COMMAND="'hg' -R 'a'repo' serve --stdio" python "$TESTDIR/../contrib/hg-ssh" + Illegal command "'hg' -R 'a'repo' serve --stdio": No closing quotation + [255] + $ cat dummylog Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio Got arguments 1:user@dummy 2:hg -R /$TESTTMP/nonexistent serve --stdio