[PATCH] tests: strip o/s-dependent error messages from some http tests

John Coomes John.Coomes at sun.com
Mon Mar 2 03:20:23 CST 2009


The error message from a failed http connection maps to the string
'Network unreachable' on solaris, but several tests expect 'Connection
refused'.  This patch strips that part of the output.  It also fixes a
minor problem in test-bad-pull where the exit value from an hg command
was lost because it was used in a pipeline.

-John


# HG changeset patch
# User John Coomes <john.coomes at sun.com>
# Date 1235784506 28800
# Node ID 40dd3138c567437a2da7e631be505cdbe965dc91
# Parent  6d99ff7b79b54f624eee18f2c1e3be6f6efed98a
tests: strip o/s-dependent error messages from some http tests

diff -r 6d99ff7b79b5 -r 40dd3138c567 tests/test-bad-pull
--- a/tests/test-bad-pull	Fri Feb 27 08:13:42 2009 -0600
+++ b/tests/test-bad-pull	Fri Feb 27 17:28:26 2009 -0800
@@ -1,7 +1,7 @@
 #!/bin/sh
 
-hg clone http://localhost:$HGPORT/ copy
-echo $?
+{ hg clone http://localhost:$HGPORT/ copy 2>&1; echo $?; } | \
+	sed 's/error:.*/error:/'
 test -d copy || echo copy: No such file or directory
 
 cat > dumb.py <<EOF
@@ -23,8 +23,7 @@
 # give the server some time to start running
 sleep 1
 
-http_proxy= hg clone http://localhost:$HGPORT/foo copy2 2>&1 | \
+{ http_proxy= hg clone http://localhost:$HGPORT/foo copy2 2>&1; echo $?; } | \
     sed -e 's/404.*/404/' -e 's/Date:.*/Date:/'
-echo $?
 
 kill $!
diff -r 6d99ff7b79b5 -r 40dd3138c567 tests/test-bad-pull.out
--- a/tests/test-bad-pull.out	Fri Feb 27 08:13:42 2009 -0600
+++ b/tests/test-bad-pull.out	Fri Feb 27 17:28:26 2009 -0800
@@ -1,5 +1,5 @@
-abort: error: Connection refused
+abort: error:
 255
 copy: No such file or directory
 abort: HTTP Error 404
-0
+255
diff -r 6d99ff7b79b5 -r 40dd3138c567 tests/test-http-proxy
--- a/tests/test-http-proxy	Fri Feb 27 08:13:42 2009 -0600
+++ b/tests/test-http-proxy	Fri Feb 27 17:28:26 2009 -0800
@@ -36,7 +36,8 @@
 http_proxy=http://user:passwd@localhost:$HGPORT1 hg clone --config http_proxy.always=True http://user:passwd@localhost:$HGPORT/ e
 
 echo %% bad host:port for proxy
-http_proxy=localhost:$HGPORT2 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ f
+http_proxy=localhost:$HGPORT2 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ f 2>&1 | \
+	sed 's/error:.*/error:/'
 
 echo %% do not use the proxy if it is in the no list
 http_proxy=localhost:$HGPORT1 hg clone --config http_proxy.no=localhost http://localhost:$HGPORT/ g
diff -r 6d99ff7b79b5 -r 40dd3138c567 tests/test-http-proxy.out
--- a/tests/test-http-proxy.out	Fri Feb 27 08:13:42 2009 -0600
+++ b/tests/test-http-proxy.out	Fri Feb 27 17:28:26 2009 -0800
@@ -48,7 +48,7 @@
 updating working directory
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 %% bad host:port for proxy
-abort: error: Connection refused
+abort: error:
 %% do not use the proxy if it is in the no list
 requesting all changes
 adding changesets
diff -r 6d99ff7b79b5 -r 40dd3138c567 tests/test-static-http
--- a/tests/test-static-http	Fri Feb 27 08:13:42 2009 -0600
+++ b/tests/test-static-http	Fri Feb 27 17:28:26 2009 -0800
@@ -2,8 +2,8 @@
 
 cp "$TESTDIR"/printenv.py .
 
-http_proxy= hg clone http://localhost:$HGPORT/ copy
-echo $?
+{ http_proxy= hg clone http://localhost:$HGPORT/ copy 2>&1; echo $?; } | \
+	sed 's/error:.*/error:/'
 test -d copy || echo copy: No such file or directory
 
 # This server doesn't do range requests so it's basically only good for
diff -r 6d99ff7b79b5 -r 40dd3138c567 tests/test-static-http.out
--- a/tests/test-static-http.out	Fri Feb 27 08:13:42 2009 -0600
+++ b/tests/test-static-http.out	Fri Feb 27 17:28:26 2009 -0800
@@ -1,4 +1,4 @@
-abort: error: Connection refused
+abort: error:
 255
 copy: No such file or directory
 changeset:   0:53e17d176ae6




More information about the Mercurial-devel mailing list