changeset 28549:e01bd7385f4f

tests: reorder hg serve commands chg currently does not support hg serve -d. It has a quick path testing if the command is hg serve -d and fallbacks to hg if so. But the test only works if "serve" is the first argument since the test wants to avoid false positives (for example, "-r serve" is different). This patch reorders "hg server" commands in tests, making them chg friendly.
author Jun Wu <quark@fb.com>
date Tue, 15 Mar 2016 09:51:54 +0000
parents b7a31068cc80
children e2b9145e35d8
files tests/test-bookmarks-pushpull.t tests/test-bundle2-exchange.t tests/test-fetch.t tests/test-hgweb.t tests/test-http-bundle1.t tests/test-http-proxy.t tests/test-http.t tests/test-https.t tests/test-largefiles-wireproto.t tests/test-pull-r.t tests/test-ssh-bundle1.t tests/test-transplant.t
diffstat 12 files changed, 28 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-bookmarks-pushpull.t	Sun Feb 14 01:06:12 2016 +0900
+++ b/tests/test-bookmarks-pushpull.t	Tue Mar 15 09:51:54 2016 +0000
@@ -290,7 +290,7 @@
 We want to use http because it is stateless and therefore more susceptible to
 race conditions
 
-  $ hg -R pull-race serve -p $HGPORT -d --pid-file=pull-race.pid -E main-error.log
+  $ hg serve -R pull-race -p $HGPORT -d --pid-file=pull-race.pid -E main-error.log
   $ cat pull-race.pid >> $DAEMON_PIDS
 
   $ hg clone -q http://localhost:$HGPORT/ pull-race2
@@ -308,7 +308,7 @@
 
   $ cd ..
   $ killdaemons.py
-  $ hg -R pull-race serve -p $HGPORT -d --pid-file=pull-race.pid -E main-error.log
+  $ hg serve -R pull-race -p $HGPORT -d --pid-file=pull-race.pid -E main-error.log
   $ cat pull-race.pid >> $DAEMON_PIDS
   $ cd pull-race2
   $ hg -R $TESTTMP/pull-race book
@@ -345,7 +345,7 @@
 (new config need server restart)
 
   $ killdaemons.py
-  $ hg -R ../pull-race serve -p $HGPORT -d --pid-file=../pull-race.pid -E main-error.log
+  $ hg serve -R ../pull-race -p $HGPORT -d --pid-file=../pull-race.pid -E main-error.log
   $ cat ../pull-race.pid >> $DAEMON_PIDS
 
   $ hg -R $TESTTMP/pull-race book
@@ -404,7 +404,7 @@
   > allow_push = *
   > EOF
 
-  $ hg -R ../a serve -p $HGPORT2 -d --pid-file=../hg2.pid
+  $ hg serve -R ../a -p $HGPORT2 -d --pid-file=../hg2.pid
   $ cat ../hg2.pid >> $DAEMON_PIDS
 
   $ hg push http://localhost:$HGPORT2/
@@ -787,7 +787,7 @@
   > allow_push = *
   > EOF
   $ killdaemons.py
-  $ hg -R ../issue4455-dest serve -p $HGPORT -d --pid-file=../issue4455.pid -E ../issue4455-error.log
+  $ hg serve -R ../issue4455-dest -p $HGPORT -d --pid-file=../issue4455.pid -E ../issue4455-error.log
   $ cat ../issue4455.pid >> $DAEMON_PIDS
 
 Local push
--- a/tests/test-bundle2-exchange.t	Sun Feb 14 01:06:12 2016 +0900
+++ b/tests/test-bundle2-exchange.t	Tue Mar 15 09:51:54 2016 +0000
@@ -301,7 +301,7 @@
 
 pull over http
 
-  $ hg -R main serve -p $HGPORT -d --pid-file=main.pid -E main-error.log
+  $ hg serve -R main -p $HGPORT -d --pid-file=main.pid -E main-error.log
   $ cat main.pid >> $DAEMON_PIDS
 
   $ hg -R other pull http://localhost:$HGPORT/ -r 42ccdea3bb16 --bookmark book_42cc
@@ -372,7 +372,7 @@
 
 push over http
 
-  $ hg -R other serve -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
+  $ hg serve -R other -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
   $ cat other.pid >> $DAEMON_PIDS
 
   $ hg -R main phase --public 32af7686d403
@@ -498,7 +498,7 @@
   > EOF
 
   $ killdaemons.py
-  $ hg -R other serve -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
+  $ hg serve -R other -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
   $ cat other.pid >> $DAEMON_PIDS
 
 Doing the actual push: Abort error
@@ -596,7 +596,7 @@
   > EOF
 
   $ killdaemons.py
-  $ hg -R other serve -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
+  $ hg serve -R other -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
   $ cat other.pid >> $DAEMON_PIDS
 
   $ hg -R main push other -r e7ec4e813ba6
@@ -661,7 +661,7 @@
   > pretxnchangegroup = sh -c "echo 'Fail early!'; false"
   > EOF
   $ killdaemons.py # reload http config
-  $ hg -R other serve -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
+  $ hg serve -R other -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
   $ cat other.pid >> $DAEMON_PIDS
 
   $ hg -R main push other -r e7ec4e813ba6
@@ -785,7 +785,7 @@
   > mandatorypart=$TESTTMP/mandatorypart.py
   > EOF
   $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS # reload http config
-  $ hg -R other serve -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
+  $ hg serve -R other -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
   $ cat other.pid >> $DAEMON_PIDS
 
 (Failure from a hook)
@@ -857,7 +857,7 @@
   > prepushkey.failpush =
   > EOF
   $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS # reload http config
-  $ hg -R other serve -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
+  $ hg serve -R other -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
   $ cat other.pid >> $DAEMON_PIDS
 
   $ hg -R main push other -r e7ec4e813ba6
--- a/tests/test-fetch.t	Sun Feb 14 01:06:12 2016 +0900
+++ b/tests/test-fetch.t	Tue Mar 15 09:51:54 2016 +0000
@@ -64,7 +64,7 @@
   a
   b
   c
-  $ hg --cwd a serve -a localhost -p $HGPORT -d --pid-file=hg.pid
+  $ hg serve --cwd a -a localhost -p $HGPORT -d --pid-file=hg.pid
   $ cat a/hg.pid >> "$DAEMON_PIDS"
 
 fetch over http, no auth
--- a/tests/test-hgweb.t	Sun Feb 14 01:06:12 2016 +0900
+++ b/tests/test-hgweb.t	Tue Mar 15 09:51:54 2016 +0000
@@ -700,7 +700,7 @@
 Uncaught exceptions result in a logged error and canned HTTP response
 
   $ killdaemons.py
-  $ hg --config extensions.hgweberror=$TESTDIR/hgweberror.py serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
+  $ hg serve --config extensions.hgweberror=$TESTDIR/hgweberror.py -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
   $ cat hg.pid >> $DAEMON_PIDS
 
   $ get-with-headers.py localhost:$HGPORT 'raiseerror' transfer-encoding content-type
@@ -716,7 +716,7 @@
 
 Uncaught exception after partial content sent
 
-  $ hg --config extensions.hgweberror=$TESTDIR/hgweberror.py serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
+  $ hg serve --config extensions.hgweberror=$TESTDIR/hgweberror.py -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
   $ cat hg.pid >> $DAEMON_PIDS
   $ get-with-headers.py localhost:$HGPORT 'raiseerror?partialresponse=1' transfer-encoding content-type
   200 Script output follows
--- a/tests/test-http-bundle1.t	Sun Feb 14 01:06:12 2016 +0900
+++ b/tests/test-http-bundle1.t	Tue Mar 15 09:51:54 2016 +0000
@@ -22,7 +22,7 @@
   adding foo.d/baR.d.hg/bAR
   adding foo.d/foo
   $ hg serve -p $HGPORT -d --pid-file=../hg1.pid -E ../error.log
-  $ hg --config server.uncompressed=False serve -p $HGPORT1 -d --pid-file=../hg2.pid
+  $ hg serve --config server.uncompressed=False -p $HGPORT1 -d --pid-file=../hg2.pid
 
 Test server address cannot be reused
 
@@ -163,7 +163,7 @@
   > def extsetup():
   >     common.permhooks.insert(0, perform_authentication)
   > EOT
-  $ hg --config extensions.x=userpass.py serve -p $HGPORT2 -d --pid-file=pid \
+  $ hg serve --config extensions.x=userpass.py -p $HGPORT2 -d --pid-file=pid \
   >    --config server.preferuncompressed=True \
   >    --config web.push_ssl=False --config web.allow_push=* -A ../access.log
   $ cat pid >> $DAEMON_PIDS
--- a/tests/test-http-proxy.t	Sun Feb 14 01:06:12 2016 +0900
+++ b/tests/test-http-proxy.t	Tue Mar 15 09:51:54 2016 +0000
@@ -11,7 +11,7 @@
   $ echo a > a
   $ hg ci -Ama -d '1123456789 0'
   adding a
-  $ hg --config server.uncompressed=True serve -p $HGPORT -d --pid-file=hg.pid
+  $ hg serve --config server.uncompressed=True -p $HGPORT -d --pid-file=hg.pid
   $ cat hg.pid >> $DAEMON_PIDS
   $ cd ..
   $ tinyproxy.py $HGPORT1 localhost >proxy.log 2>&1 </dev/null &
--- a/tests/test-http.t	Sun Feb 14 01:06:12 2016 +0900
+++ b/tests/test-http.t	Tue Mar 15 09:51:54 2016 +0000
@@ -13,7 +13,7 @@
   adding foo.d/baR.d.hg/bAR
   adding foo.d/foo
   $ hg serve -p $HGPORT -d --pid-file=../hg1.pid -E ../error.log
-  $ hg --config server.uncompressed=False serve -p $HGPORT1 -d --pid-file=../hg2.pid
+  $ hg serve --config server.uncompressed=False -p $HGPORT1 -d --pid-file=../hg2.pid
 
 Test server address cannot be reused
 
@@ -154,7 +154,7 @@
   > def extsetup():
   >     common.permhooks.insert(0, perform_authentication)
   > EOT
-  $ hg --config extensions.x=userpass.py serve -p $HGPORT2 -d --pid-file=pid \
+  $ hg serve --config extensions.x=userpass.py -p $HGPORT2 -d --pid-file=pid \
   >    --config server.preferuncompressed=True \
   >    --config web.push_ssl=False --config web.allow_push=* -A ../access.log
   $ cat pid >> $DAEMON_PIDS
--- a/tests/test-https.t	Sun Feb 14 01:06:12 2016 +0900
+++ b/tests/test-https.t	Tue Mar 15 09:51:54 2016 +0000
@@ -264,7 +264,7 @@
 
 Test server cert which isn't valid yet
 
-  $ hg -R test serve -p $HGPORT1 -d --pid-file=hg1.pid --certificate=server-not-yet.pem
+  $ hg serve -R test -p $HGPORT1 -d --pid-file=hg1.pid --certificate=server-not-yet.pem
   $ cat hg1.pid >> $DAEMON_PIDS
   $ hg -R copy-pull pull --config web.cacerts=pub-not-yet.pem https://localhost:$HGPORT1/
   pulling from https://localhost:$HGPORT1/
@@ -273,7 +273,7 @@
 
 Test server cert which no longer is valid
 
-  $ hg -R test serve -p $HGPORT2 -d --pid-file=hg2.pid --certificate=server-expired.pem
+  $ hg serve -R test -p $HGPORT2 -d --pid-file=hg2.pid --certificate=server-expired.pem
   $ cat hg2.pid >> $DAEMON_PIDS
   $ hg -R copy-pull pull --config web.cacerts=pub-expired.pem https://localhost:$HGPORT2/
   pulling from https://localhost:$HGPORT2/
--- a/tests/test-largefiles-wireproto.t	Sun Feb 14 01:06:12 2016 +0900
+++ b/tests/test-largefiles-wireproto.t	Tue Mar 15 09:51:54 2016 +0000
@@ -45,7 +45,7 @@
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
 largefiles clients still work with vanilla servers
-  $ hg --config extensions.largefiles=! serve -R r1 -d -p $HGPORT1 --pid-file hg.pid
+  $ hg serve --config extensions.largefiles=! -R r1 -d -p $HGPORT1 --pid-file hg.pid
   $ cat hg.pid >> $DAEMON_PIDS
   $ hg clone http://localhost:$HGPORT1 r3
   requesting all changes
@@ -149,7 +149,7 @@
   $ hg commit -m "m2"
   Invoking status precommit hook
   A f2
-  $ hg --config extensions.largefiles=! -R ../r6 serve -d -p $HGPORT --pid-file ../hg.pid
+  $ hg serve --config extensions.largefiles=! -R ../r6 -d -p $HGPORT --pid-file ../hg.pid
   $ cat ../hg.pid >> $DAEMON_PIDS
   $ hg push http://localhost:$HGPORT
   pushing to http://localhost:$HGPORT/
--- a/tests/test-pull-r.t	Sun Feb 14 01:06:12 2016 +0900
+++ b/tests/test-pull-r.t	Tue Mar 15 09:51:54 2016 +0000
@@ -112,7 +112,7 @@
   > [hooks]
   > outgoing.makecommit = hg ci -Am 'racy commit'; echo committed in pull-race
   > EOF
-  $ hg -R ../repo serve -p $HGPORT2 -d --pid-file=../repo.pid
+  $ hg serve -R ../repo -p $HGPORT2 -d --pid-file=../repo.pid
   $ cat ../repo.pid >> $DAEMON_PIDS
   $ hg pull --rev default --update http://localhost:$HGPORT2/
   pulling from http://localhost:$HGPORT2/
--- a/tests/test-ssh-bundle1.t	Sun Feb 14 01:06:12 2016 +0900
+++ b/tests/test-ssh-bundle1.t	Tue Mar 15 09:51:54 2016 +0000
@@ -377,8 +377,8 @@
   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
+  $ SSH_ORIGINAL_COMMAND="'hg' serve -R 'a'repo' --stdio" python "$TESTDIR/../contrib/hg-ssh"
+  Illegal command "'hg' serve -R 'a'repo' --stdio": No closing quotation
   [255]
 
 Test hg-ssh in read-only mode:
--- a/tests/test-transplant.t	Sun Feb 14 01:06:12 2016 +0900
+++ b/tests/test-transplant.t	Tue Mar 15 09:51:54 2016 +0000
@@ -321,7 +321,7 @@
 
 remote transplant with pull
 
-  $ hg -R ../t serve -p $HGPORT -d --pid-file=../t.pid
+  $ hg serve -R ../t -p $HGPORT -d --pid-file=../t.pid
   $ cat ../t.pid >> $DAEMON_PIDS
 
   $ hg clone -r 0 ../t ../rp