D2381: tests: store protocol payload in files

2018-02-22 Thread indygreg (Gregory Szorc)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG02782e6e2c38: tests: store protocol payload in files 
(authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2381?vs=5967&id=5999

REVISION DETAIL
  https://phab.mercurial-scm.org/D2381

AFFECTED FILES
  tests/test-ssh-proto.t

CHANGE DETAILS

diff --git a/tests/test-ssh-proto.t b/tests/test-ssh-proto.t
--- a/tests/test-ssh-proto.t
+++ b/tests/test-ssh-proto.t
@@ -463,13 +463,14 @@
 
 Send an upgrade request to a server that supports upgrade
 
-  $ hg -R server serve --stdio << EOF
-  > upgrade this-is-some-token proto=exp-ssh-v2-0001
-  > hello
-  > between
-  > pairs 81
-  > 
-
-  > EOF
+  >>> with open('payload', 'wb') as fh:
+  ... fh.write(b'upgrade this-is-some-token proto=exp-ssh-v2-0001\n')
+  ... fh.write(b'hello\n')
+  ... fh.write(b'between\n')
+  ... fh.write(b'pairs 81\n')
+  ... 
fh.write(b'-')
+
+  $ hg -R server serve --stdio < payload
   upgraded this-is-some-token exp-ssh-v2-0001
   383
   capabilities: lookup changegroupsubset branchmap pushkey known getbundle 
unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ 
unbundle=HG10GZ,HG10BZ,HG10UN
@@ -540,29 +541,31 @@
 
 Command after upgrade to version 2 is processed
 
-  $ hg -R server serve --stdio << EOF
-  > upgrade this-is-some-token proto=exp-ssh-v2-0001
-  > hello
-  > between
-  > pairs 81
-  > 
-hello
-  > EOF
+  >>> with open('payload', 'wb') as fh:
+  ... fh.write(b'upgrade this-is-some-token proto=exp-ssh-v2-0001\n')
+  ... fh.write(b'hello\n')
+  ... fh.write(b'between\n')
+  ... fh.write(b'pairs 81\n')
+  ... 
fh.write(b'-')
+  ... fh.write(b'hello\n')
+  $ hg -R server serve --stdio < payload
   upgraded this-is-some-token exp-ssh-v2-0001
   383
   capabilities: lookup changegroupsubset branchmap pushkey known getbundle 
unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ 
unbundle=HG10GZ,HG10BZ,HG10UN
   384
   capabilities: lookup changegroupsubset branchmap pushkey known getbundle 
unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ 
unbundle=HG10GZ,HG10BZ,HG10UN
 
 Multiple upgrades is not allowed
 
-  $ hg -R server serve --stdio << EOF
-  > upgrade this-is-some-token proto=exp-ssh-v2-0001
-  > hello
-  > between
-  > pairs 81
-  > 
-upgrade
 another-token proto=irrelevant
-  > hello
-  > EOF
+  >>> with open('payload', 'wb') as fh:
+  ... fh.write(b'upgrade this-is-some-token proto=exp-ssh-v2-0001\n')
+  ... fh.write(b'hello\n')
+  ... fh.write(b'between\n')
+  ... fh.write(b'pairs 81\n')
+  ... 
fh.write(b'-')
+  ... fh.write(b'upgrade another-token proto=irrelevant\n')
+  ... fh.write(b'hello\n')
+  $ hg -R server serve --stdio < payload
   upgraded this-is-some-token exp-ssh-v2-0001
   383
   capabilities: lookup changegroupsubset branchmap pushkey known getbundle 
unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ 
unbundle=HG10GZ,HG10BZ,HG10UN



To: indygreg, #hg-reviewers, yuja
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2381: tests: store protocol payload in files

2018-02-21 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Upcoming changes to version 2 of the SSH protocol will introduce
  binary components to the protocol. It will be easier to eliminate
  trailing newlines and use binary in the tests if the protocol
  payload is being generated by Python.
  
  So use inline Python to write payloads to files and pipe those files
  to server processes instead of shell strings/variables.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2381

AFFECTED FILES
  tests/test-ssh-proto.t

CHANGE DETAILS

diff --git a/tests/test-ssh-proto.t b/tests/test-ssh-proto.t
--- a/tests/test-ssh-proto.t
+++ b/tests/test-ssh-proto.t
@@ -463,13 +463,14 @@
 
 Send an upgrade request to a server that supports upgrade
 
-  $ hg -R server serve --stdio << EOF
-  > upgrade this-is-some-token proto=exp-ssh-v2-0001
-  > hello
-  > between
-  > pairs 81
-  > 
-
-  > EOF
+  >>> with open('payload', 'wb') as fh:
+  ... fh.write(b'upgrade this-is-some-token proto=exp-ssh-v2-0001\n')
+  ... fh.write(b'hello\n')
+  ... fh.write(b'between\n')
+  ... fh.write(b'pairs 81\n')
+  ... 
fh.write(b'-')
+
+  $ hg -R server serve --stdio < payload
   upgraded this-is-some-token exp-ssh-v2-0001
   383
   capabilities: lookup changegroupsubset branchmap pushkey known getbundle 
unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ 
unbundle=HG10GZ,HG10BZ,HG10UN
@@ -540,29 +541,31 @@
 
 Command after upgrade to version 2 is processed
 
-  $ hg -R server serve --stdio << EOF
-  > upgrade this-is-some-token proto=exp-ssh-v2-0001
-  > hello
-  > between
-  > pairs 81
-  > 
-hello
-  > EOF
+  >>> with open('payload', 'wb') as fh:
+  ... fh.write(b'upgrade this-is-some-token proto=exp-ssh-v2-0001\n')
+  ... fh.write(b'hello\n')
+  ... fh.write(b'between\n')
+  ... fh.write(b'pairs 81\n')
+  ... 
fh.write(b'-')
+  ... fh.write(b'hello\n')
+  $ hg -R server serve --stdio < payload
   upgraded this-is-some-token exp-ssh-v2-0001
   383
   capabilities: lookup changegroupsubset branchmap pushkey known getbundle 
unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ 
unbundle=HG10GZ,HG10BZ,HG10UN
   384
   capabilities: lookup changegroupsubset branchmap pushkey known getbundle 
unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ 
unbundle=HG10GZ,HG10BZ,HG10UN
 
 Multiple upgrades is not allowed
 
-  $ hg -R server serve --stdio << EOF
-  > upgrade this-is-some-token proto=exp-ssh-v2-0001
-  > hello
-  > between
-  > pairs 81
-  > 
-upgrade
 another-token proto=irrelevant
-  > hello
-  > EOF
+  >>> with open('payload', 'wb') as fh:
+  ... fh.write(b'upgrade this-is-some-token proto=exp-ssh-v2-0001\n')
+  ... fh.write(b'hello\n')
+  ... fh.write(b'between\n')
+  ... fh.write(b'pairs 81\n')
+  ... 
fh.write(b'-')
+  ... fh.write(b'upgrade another-token proto=irrelevant\n')
+  ... fh.write(b'hello\n')
+  $ hg -R server serve --stdio < payload
   upgraded this-is-some-token exp-ssh-v2-0001
   383
   capabilities: lookup changegroupsubset branchmap pushkey known getbundle 
unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ 
unbundle=HG10GZ,HG10BZ,HG10UN



To: indygreg, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel