test-ssh: verify that stderr from remote is printed (issue4336)
authorGregory Szorc <gregory.szorc@gmail.com>
Sat, 16 Aug 2014 10:19:26 -0700
changeset 22247 8341c677c204
parent 22246 331cbf088c4c
child 22248 75618a223e18
test-ssh: verify that stderr from remote is printed (issue4336) The issue fixed in the previous patch was uncovered by implementing an extension that printed additional output locally before the push command completed. This test emulates that. If this change is applied before the previous patch, the test will fail on Linux, with the local output being printed before the "remote: " lines.
tests/test-ssh.t
--- a/tests/test-ssh.t	Sat Aug 16 10:28:59 2014 -0700
+++ b/tests/test-ssh.t	Sat Aug 16 10:19:26 2014 -0700
@@ -360,6 +360,47 @@
 
   $ cd ..
 
+stderr from remote commands should be printed before stdout from local code (issue4336)
+
+  $ hg clone remote stderr-ordering
+  updating to branch default
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd stderr-ordering
+  $ cat >> localwrite.py << EOF
+  > from mercurial import exchange, extensions
+  > 
+  > def wrappedpush(orig, repo, *args, **kwargs):
+  >     res = orig(repo, *args, **kwargs)
+  >     repo.ui.write('local stdout\n')
+  >     return res
+  > 
+  > def extsetup(ui):
+  >     extensions.wrapfunction(exchange, 'push', wrappedpush)
+  > EOF
+
+  $ cat >> .hg/hgrc << EOF
+  > [paths]
+  > default-push = ssh://user@dummy/remote
+  > [ui]
+  > ssh = python "$TESTDIR/dummyssh"
+  > [extensions]
+  > localwrite = localwrite.py
+  > EOF
+
+  $ echo localwrite > foo
+  $ hg commit -m 'testing localwrite'
+  $ hg push
+  pushing to ssh://user@dummy/remote
+  searching for changes
+  remote: adding changesets
+  remote: adding manifests
+  remote: adding file changes
+  remote: added 1 changesets with 1 changes to 1 files
+  remote: KABOOM
+  local stdout
+
+  $ cd ..
+
   $ 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
@@ -387,3 +428,5 @@
   Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
   Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
   Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
+  Got arguments 1:user@dummy 2:hg -R remote serve --stdio
+  changegroup-in-remote hook: HG_NODE=65c38f4125f9602c8db4af56530cc221d93b8ef8 HG_SOURCE=serve HG_URL=remote:ssh:127.0.0.1