Patchwork [3,of,3] test-ssh: verify that stderr from remote is printed (issue4336)

login
register
mail settings
Submitter Gregory Szorc
Date Aug. 16, 2014, 5:37 p.m.
Message ID <e39b9a7cfa829d86a02b.1408210642@vm-ubuntu-main.gateway.sonic.net>
Download mbox | patch
Permalink /patch/5455/
State Accepted
Headers show

Comments

Gregory Szorc - Aug. 16, 2014, 5:37 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1408209566 25200
#      Sat Aug 16 10:19:26 2014 -0700
# Node ID e39b9a7cfa829d86a02b2b91bbecd1ca4680672d
# Parent  03583229bdf7dc6ee0c0edf082b092edae714307
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.
Matt Mackall - Aug. 18, 2014, 5:44 p.m.
On Sat, 2014-08-16 at 10:37 -0700, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc@gmail.com>
> # Date 1408209566 25200
> #      Sat Aug 16 10:19:26 2014 -0700
> # Node ID e39b9a7cfa829d86a02b2b91bbecd1ca4680672d
> # Parent  03583229bdf7dc6ee0c0edf082b092edae714307
> test-ssh: verify that stderr from remote is printed (issue4336)

These are queued for default, thanks.

Patch

diff --git a/tests/test-ssh.t b/tests/test-ssh.t
--- a/tests/test-ssh.t
+++ b/tests/test-ssh.t
@@ -359,8 +359,49 @@  Test hg-ssh in read-only mode:
   [255]
 
   $ 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
   Got arguments 1:user@dummy 2:hg -R remote serve --stdio
@@ -386,4 +427,6 @@  Test hg-ssh in read-only mode:
   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 '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