[PATCH] tests: don't just silently strip port numbers

Mads Kiilerich mads at kiilerich.com
Sun Feb 7 19:54:28 CST 2010


# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1265594021 -3600
# Node ID ca09a98df4b8fb49b0f79aeee2b949454aa68c19
# Parent  2bcb99f9ea5667e8323fd764ed583adfe522fba0
tests: don't just silently strip port numbers

diff --git a/tests/test-fetch b/tests/test-fetch
--- a/tests/test-fetch
+++ b/tests/test-fetch
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 # adjust to non-default HGPORT, e.g. with run-tests.py -j
-hideport() { sed "s/localhost:$HGPORT/localhost:20059/"; }
+hideport() { sed "s/localhost:$HGPORT/localhost:\$HGPORT/"; }
 hidehash() { sed "s/changeset 3:............ merges/changeset 3:... merges/"; }
 
 echo "[extensions]" >> $HGRCPATH
diff --git a/tests/test-fetch.out b/tests/test-fetch.out
--- a/tests/test-fetch.out
+++ b/tests/test-fetch.out
@@ -36,7 +36,7 @@
 b
 c
 % fetch over http, no auth
-pulling from http://localhost:20059/
+pulling from http://localhost:$HGPORT/
 searching for changes
 adding changesets
 adding manifests
@@ -47,9 +47,9 @@
 merging with 1:5e056962225c
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 new changeset 3:... merges remote changes with local
-Automated merge with http://localhost:20059/
+Automated merge with http://localhost:$HGPORT/
 % fetch over http with auth (should be hidden in desc)
-pulling from http://user:***@localhost:20059/
+pulling from http://user:***@localhost:$HGPORT/
 searching for changes
 adding changesets
 adding manifests
@@ -60,7 +60,7 @@
 merging with 1:5e056962225c
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 new changeset 3:... merges remote changes with local
-Automated merge with http://localhost:20059/
+Automated merge with http://localhost:$HGPORT/
 updating to branch default
 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
 updating to branch default
diff --git a/tests/test-http b/tests/test-http
--- a/tests/test-http
+++ b/tests/test-http
@@ -14,7 +14,7 @@
 hg --config server.uncompressed=True serve -p $HGPORT -d --pid-file=../hg1.pid
 hg serve -p $HGPORT1 -d --pid-file=../hg2.pid
 # Test server address cannot be reused
-hg serve -p $HGPORT1 2>&1 | sed -e "s/abort: cannot start server at ':$HGPORT1':.*/abort: cannot start server at ':20060':/"
+hg serve -p $HGPORT1 2>&1 | sed -e "s/abort: cannot start server at ':$HGPORT1':.*/abort: cannot start server at ':\$HGPORT1':/"
 cd ..
 cat hg1.pid hg2.pid >> $DAEMON_PIDS
 
@@ -39,5 +39,5 @@
 cd copy-pull
 echo '[hooks]' >> .hg/hgrc
 echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc
-hg pull | sed -e 's,:[0-9][0-9]*/,/,'
+hg pull | sed -e "s,:$HGPORT1/,:\$HGPORT1/,"
 cd ..
diff --git a/tests/test-http-clone-r b/tests/test-http-clone-r
--- a/tests/test-http-clone-r
+++ b/tests/test-http-clone-r
@@ -66,14 +66,14 @@
 hg verify
 cd ..
 cd test-1
-hg pull -r 4 http://localhost:$HGPORT/ 2>&1 | sed -e 's,:[0-9][0-9]*/,/,'
+hg pull -r 4 http://localhost:$HGPORT/ 2>&1 | sed -e "s,:$HGPORT/,:\$HGPORT/,"
 hg verify
-hg pull http://localhost:$HGPORT/ 2>&1 | sed -e 's,:[0-9][0-9]*/,/,'
+hg pull http://localhost:$HGPORT/ 2>&1 | sed -e "s,:$HGPORT/,:\$HGPORT/,"
 cd ..
 cd test-2
-hg pull -r 5 http://localhost:$HGPORT/ 2>&1 | sed -e 's,:[0-9][0-9]*/,/,'
+hg pull -r 5 http://localhost:$HGPORT/ 2>&1 | sed -e "s,:$HGPORT/,:\$HGPORT/,"
 hg verify
-hg pull http://localhost:$HGPORT/ 2>&1 | sed -e 's,:[0-9][0-9]*/,/,'
+hg pull http://localhost:$HGPORT/ 2>&1 | sed -e "s,:$HGPORT/,:\$HGPORT/,"
 hg verify
 cd ..
 cat error.log
diff --git a/tests/test-http-clone-r.out b/tests/test-http-clone-r.out
--- a/tests/test-http-clone-r.out
+++ b/tests/test-http-clone-r.out
@@ -148,7 +148,7 @@
 crosschecking files in changesets and manifests
 checking files
 4 files, 9 changesets, 7 total revisions
-pulling from http://localhost/
+pulling from http://localhost:$HGPORT/
 searching for changes
 adding changesets
 adding manifests
@@ -160,14 +160,14 @@
 crosschecking files in changesets and manifests
 checking files
 1 files, 3 changesets, 2 total revisions
-pulling from http://localhost/
+pulling from http://localhost:$HGPORT/
 searching for changes
 adding changesets
 adding manifests
 adding file changes
 added 6 changesets with 5 changes to 4 files
 (run 'hg update' to get a working copy)
-pulling from http://localhost/
+pulling from http://localhost:$HGPORT/
 searching for changes
 adding changesets
 adding manifests
@@ -179,7 +179,7 @@
 crosschecking files in changesets and manifests
 checking files
 1 files, 5 changesets, 3 total revisions
-pulling from http://localhost/
+pulling from http://localhost:$HGPORT/
 searching for changes
 adding changesets
 adding manifests
diff --git a/tests/test-http.out b/tests/test-http.out
--- a/tests/test-http.out
+++ b/tests/test-http.out
@@ -2,7 +2,7 @@
 adding foo.d/bAr.hg.d/BaR
 adding foo.d/baR.d.hg/bAR
 adding foo.d/foo
-abort: cannot start server at ':20060':
+abort: cannot start server at ':$HGPORT1':
 % clone via stream
 streaming all changes
 XXX files to transfer, XXX bytes of data
@@ -37,8 +37,8 @@
 4 files, 1 changesets, 4 total revisions
 adding bar
 % pull
-changegroup hook: HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_SOURCE=pull HG_URL=http://localhost/ 
-pulling from http://localhost/
+changegroup hook: HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_SOURCE=pull HG_URL=http://localhost:$HGPORT1/ 
+pulling from http://localhost:$HGPORT1/
 searching for changes
 adding changesets
 adding manifests
diff --git a/tests/test-incoming-outgoing b/tests/test-incoming-outgoing
--- a/tests/test-incoming-outgoing
+++ b/tests/test-incoming-outgoing
@@ -14,8 +14,8 @@
 
 hg init new
 # http incoming
-hg -R new incoming http://localhost:$HGPORT/ | sed -e 's,:[0-9][0-9]*/,/,'
-hg -R new incoming -r 4 http://localhost:$HGPORT/ | sed -e 's,:[0-9][0-9]*/,/,'
+hg -R new incoming http://localhost:$HGPORT/ | sed -e "s,:$HGPORT/,:\$HGPORT/,"
+hg -R new incoming -r 4 http://localhost:$HGPORT/ | sed -e "s,:$HGPORT/,:\$HGPORT/,"
 # local incoming
 hg -R new incoming test
 hg -R new incoming -r 4 test
@@ -25,7 +25,7 @@
 hg -R new incoming -l 2 -p --git test
 
 # test with --bundle
-hg -R new incoming --bundle test.hg http://localhost:$HGPORT/ | sed -e 's,:[0-9][0-9]*/,/,'
+hg -R new incoming --bundle test.hg http://localhost:$HGPORT/ | sed -e "s,:$HGPORT/,:\$HGPORT/,"
 hg -R new incoming --bundle test2.hg test
 
 # test the resulting bundles
@@ -50,5 +50,5 @@
 hg -R test-dev outgoing test
 echo "% limit to 3 changesets"
 hg -R test-dev outgoing -l 3 test
-hg -R test-dev outgoing http://localhost:$HGPORT/ | sed -e 's,:[0-9][0-9]*/,/,'
-hg -R test-dev outgoing -r 11 http://localhost:$HGPORT/ | sed -e 's,:[0-9][0-9]*/,/,'
+hg -R test-dev outgoing http://localhost:$HGPORT/ | sed -e "s,:$HGPORT/,:\$HGPORT/,"
+hg -R test-dev outgoing -r 11 http://localhost:$HGPORT/ | sed -e "s,:$HGPORT/,:\$HGPORT/,"
diff --git a/tests/test-incoming-outgoing.out b/tests/test-incoming-outgoing.out
--- a/tests/test-incoming-outgoing.out
+++ b/tests/test-incoming-outgoing.out
@@ -4,7 +4,7 @@
 crosschecking files in changesets and manifests
 checking files
 1 files, 9 changesets, 9 total revisions
-comparing with http://localhost/
+comparing with http://localhost:$HGPORT/
 changeset:   0:9cb21d99fe27
 user:        test
 date:        Mon Jan 12 13:46:40 1970 +0000
@@ -51,7 +51,7 @@
 date:        Mon Jan 12 13:46:40 1970 +0000
 summary:     8
 
-comparing with http://localhost/
+comparing with http://localhost:$HGPORT/
 changeset:   0:9cb21d99fe27
 user:        test
 date:        Mon Jan 12 13:46:40 1970 +0000
@@ -189,7 +189,7 @@
  0
 +1
 
-comparing with http://localhost/
+comparing with http://localhost:$HGPORT/
 changeset:   0:9cb21d99fe27
 user:        test
 date:        Mon Jan 12 13:46:40 1970 +0000
@@ -358,7 +358,7 @@
 date:        Mon Jan 12 13:46:40 1970 +0000
 summary:     11
 
-comparing with http://localhost/
+comparing with http://localhost:$HGPORT/
 searching for changes
 changeset:   9:3741c3ad1096
 user:        test
@@ -386,7 +386,7 @@
 date:        Mon Jan 12 13:46:40 1970 +0000
 summary:     13
 
-comparing with http://localhost/
+comparing with http://localhost:$HGPORT/
 searching for changes
 changeset:   9:3741c3ad1096
 user:        test
diff --git a/tests/test-pull b/tests/test-pull
--- a/tests/test-pull
+++ b/tests/test-pull
@@ -11,13 +11,13 @@
 cat hg.pid >> $DAEMON_PIDS
 cd ..
 
-hg clone --pull http://localhost:$HGPORT/ copy | sed -e 's,:[0-9][0-9]*/,/,'
+hg clone --pull http://localhost:$HGPORT/ copy | sed -e "s,:$HGPORT/,:\$HGPORT/,"
 cd copy
 hg verify
 hg co
 cat foo
 hg manifest --debug
-hg pull | sed -e 's,:[0-9][0-9]*/,/,'
+hg pull | sed -e "s,:$HGPORT/,:\$HGPORT/,"
 
 echo % issue 622
 cd ..
diff --git a/tests/test-pull-http b/tests/test-pull-http
--- a/tests/test-pull-http
+++ b/tests/test-pull-http
@@ -18,7 +18,7 @@
 echo 'allowpull = false' >> .hg/hgrc
 hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
 cat hg.pid >> $DAEMON_PIDS
-hg clone http://localhost:$HGPORT/ test3 | sed -e 's,:[0-9][0-9]*/,/,'
+hg clone http://localhost:$HGPORT/ test3 | sed -e "s,:$HGPORT/,:\$HGPORT/,"
 "$TESTDIR/killdaemons.py"
 echo % serve errors
 cat errors.log
@@ -26,7 +26,7 @@
 req() {
 	hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
 	cat hg.pid >> $DAEMON_PIDS
-	hg --cwd ../test pull http://localhost:$HGPORT/ | sed -e 's,:[0-9][0-9]*/,/,'
+	hg --cwd ../test pull http://localhost:$HGPORT/ | sed -e "s,:$HGPORT/,:\$HGPORT/,"
 	kill `cat hg.pid`
 	echo % serve errors
 	cat errors.log
diff --git a/tests/test-pull-http.out b/tests/test-pull-http.out
--- a/tests/test-pull-http.out
+++ b/tests/test-pull-http.out
@@ -7,6 +7,6 @@
 % serve errors
 % expect error, pulling not allowed
 abort: authorization failed
-pulling from http://localhost/
+pulling from http://localhost:$HGPORT/
 searching for changes
 % serve errors
diff --git a/tests/test-pull.out b/tests/test-pull.out
--- a/tests/test-pull.out
+++ b/tests/test-pull.out
@@ -19,7 +19,7 @@
 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 foo
 2ed2a3912a0b24502043eae84ee4b279c18b90dd 644   foo
-pulling from http://localhost/
+pulling from http://localhost:$HGPORT/
 searching for changes
 no changes found
 % issue 622
diff --git a/tests/test-push-http b/tests/test-push-http
--- a/tests/test-push-http
+++ b/tests/test-push-http
@@ -16,7 +16,7 @@
 req() {
 	hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
 	cat hg.pid >> $DAEMON_PIDS
-	hg --cwd ../test2 push http://localhost:$HGPORT/ | sed -e 's,:[0-9][0-9]*/,/,'
+	hg --cwd ../test2 push http://localhost:$HGPORT/ | sed -e "s,:$HGPORT/,:\$HGPORT/,"
 	kill `cat hg.pid`
 	echo % serve errors
 	cat errors.log
diff --git a/tests/test-push-http.out b/tests/test-push-http.out
--- a/tests/test-push-http.out
+++ b/tests/test-push-http.out
@@ -2,22 +2,22 @@
 updating to branch default
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 % expect ssl error
-pushing to http://localhost/
+pushing to http://localhost:$HGPORT/
 searching for changes
 ssl required
 % serve errors
 % expect authorization error
 abort: authorization failed
-pushing to http://localhost/
+pushing to http://localhost:$HGPORT/
 searching for changes
 % serve errors
 % expect authorization error: must have authorized user
 abort: authorization failed
-pushing to http://localhost/
+pushing to http://localhost:$HGPORT/
 searching for changes
 % serve errors
 % expect success
-pushing to http://localhost/
+pushing to http://localhost:$HGPORT/
 searching for changes
 adding changesets
 adding manifests
@@ -28,11 +28,11 @@
 rolling back last transaction
 % expect authorization error: all users denied
 abort: authorization failed
-pushing to http://localhost/
+pushing to http://localhost:$HGPORT/
 searching for changes
 % serve errors
 % expect authorization error: some users denied, users must be authenticated
 abort: authorization failed
-pushing to http://localhost/
+pushing to http://localhost:$HGPORT/
 searching for changes
 % serve errors
diff --git a/tests/test-static-http b/tests/test-static-http
--- a/tests/test-static-http
+++ b/tests/test-static-http
@@ -34,7 +34,7 @@
 
 cd ..
 
-hg clone static-http://localhost:$HGPORT/remote local | sed -e 's,:[0-9][0-9]*/,/,'
+hg clone static-http://localhost:$HGPORT/remote local | sed -e "s,:$HGPORT/,:\$HGPORT/,"
 
 cd local
 hg verify
@@ -47,13 +47,13 @@
 cd ../local
 echo '[hooks]' >> .hg/hgrc
 echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc
-hg pull | sed -e 's,:[0-9][0-9]*/,/,'
+hg pull | sed -e "s,:$HGPORT/,:\$HGPORT/,"
 
 echo '% trying to push'
 hg update
 echo more foo >> bar
 hg commit -m"test" -d "100000000 0"
-hg push | sed -e 's,:[0-9][0-9]*/,/,'
+hg push | sed -e "s,:$HGPORT/,:\$HGPORT/,"
 
 echo '% test with "/" URI (issue 747)'
 cd ..
@@ -62,26 +62,26 @@
 hg add a
 hg ci -ma
 
-hg clone static-http://localhost:$HGPORT/ local2 | sed -e 's,:[0-9][0-9]*/,/,'
+hg clone static-http://localhost:$HGPORT/ local2 | sed -e "s,:$HGPORT/,:\$HGPORT/,"
 
 cd local2
 hg verify
 cat a
-hg paths | sed -e 's,:[0-9][0-9]*/,/,'
+hg paths | sed -e "s,:$HGPORT/,:\$HGPORT/,"
 
 echo '% test with empty repo (issue965)'
 cd ..
 hg init remotempty
 
-hg clone static-http://localhost:$HGPORT/remotempty local3 | sed -e 's,:[0-9][0-9]*/,/,'
+hg clone static-http://localhost:$HGPORT/remotempty local3 | sed -e "s,:$HGPORT/,:\$HGPORT/,"
 
 cd local3
 hg verify
-hg paths | sed -e 's,:[0-9][0-9]*/,/,'
+hg paths | sed -e "s,:$HGPORT/,:\$HGPORT/,"
 
 echo '% test with non-repo'
 cd ..
 mkdir notarepo
-hg clone static-http://localhost:$HGPORT/notarepo local3 2>&1 | sed -e 's,:[0-9][0-9]*/,/,'
+hg clone static-http://localhost:$HGPORT/notarepo local3 2>&1 | sed -e "s,:$HGPORT/,:\$HGPORT/,"
 
 kill $!
diff --git a/tests/test-static-http.out b/tests/test-static-http.out
--- a/tests/test-static-http.out
+++ b/tests/test-static-http.out
@@ -21,8 +21,8 @@
 1 files, 1 changesets, 1 total revisions
 foo
 adding quux
-changegroup hook: HG_NODE=34401e0e9971e9720b613d9089ffa9a6eefb3d2d HG_SOURCE=pull HG_URL=http://localhost/remote 
-pulling from static-http://localhost/remote
+changegroup hook: HG_NODE=34401e0e9971e9720b613d9089ffa9a6eefb3d2d HG_SOURCE=pull HG_URL=http://localhost:$HGPORT/remote 
+pulling from static-http://localhost:$HGPORT/remote
 searching for changes
 adding changesets
 adding manifests
@@ -32,7 +32,7 @@
 % trying to push
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 abort: cannot lock static-http repository
-pushing to static-http://localhost/remote
+pushing to static-http://localhost:$HGPORT/remote
 % test with "/" URI (issue 747)
 requesting all changes
 adding changesets
@@ -47,7 +47,7 @@
 checking files
 1 files, 1 changesets, 1 total revisions
 a
-default = static-http://localhost/
+default = static-http://localhost:$HGPORT/
 % test with empty repo (issue965)
 no changes found
 updating to branch default
@@ -57,6 +57,6 @@
 crosschecking files in changesets and manifests
 checking files
 0 files, 0 changesets, 0 total revisions
-default = static-http://localhost/remotempty
+default = static-http://localhost:$HGPORT/remotempty
 % test with non-repo
-abort: 'http://localhost/notarepo' does not appear to be an hg repository!
+abort: 'http://localhost:$HGPORT/notarepo' does not appear to be an hg repository!


More information about the Mercurial-devel mailing list