changeset 6300:874ca958025b

test-serve: replace copy/paste with shell function
author Patrick Mezard <pmezard@gmail.com>
date Mon, 17 Mar 2008 16:15:43 +0100
parents 653ddd1d7cd7
children 68cfd7d208a5
files tests/test-serve
diffstat 1 files changed, 15 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-serve	Tue Mar 18 04:07:39 2008 -0300
+++ b/tests/test-serve	Mon Mar 17 16:15:43 2008 +0100
@@ -1,5 +1,15 @@
 #!/bin/sh
 
+hgserve()
+{
+    hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid -v $@ \
+        | sed -e 's/:[0-9][0-9]*//g' -e 's/localhost\.localdomain/localhost/'
+    cat hg.pid >> "$DAEMON_PIDS"
+    sleep 1
+    kill `cat hg.pid`
+    sleep 1
+}
+
 hg init test
 cd test
 
@@ -14,38 +24,16 @@
 fi
 
 echo % With -v
-hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid -v \
-    | sed -e 's/:[0-9][0-9]*//g' -e 's/localhost\.localdomain/localhost/'
-cat hg.pid >> "$DAEMON_PIDS"
-sleep 1
-kill `cat hg.pid`
-sleep 1
+hgserve
 
 echo % With --prefix foo
-hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid -v --prefix foo \
-    | sed -e 's/:[0-9][0-9]*//g' -e 's/localhost\.localdomain/localhost/'
-cat hg.pid >> "$DAEMON_PIDS"
-sleep 1
-kill `cat hg.pid`
-sleep 1
+hgserve --prefix foo
 
 echo % With --prefix /foo
-hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid -v --prefix /foo \
-    | sed -e 's/:[0-9][0-9]*//g' -e 's/localhost\.localdomain/localhost/'
-cat hg.pid >> "$DAEMON_PIDS"
-sleep 1
-kill `cat hg.pid`
-sleep 1
+hgserve --prefix /foo
 
 echo % With --prefix foo/
-hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid -v --prefix foo/ \
-    | sed -e 's/:[0-9][0-9]*//g' -e 's/localhost\.localdomain/localhost/'
-cat hg.pid >> "$DAEMON_PIDS"
-sleep 1
-kill `cat hg.pid`
-sleep 1
+hgserve --prefix foo/
 
 echo % With --prefix /foo/
-hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid -v --prefix /foo/ \
-    | sed -e 's/:[0-9][0-9]*//g' -e 's/localhost\.localdomain/localhost/'
-cat hg.pid >> "$DAEMON_PIDS"
+hgserve --prefix /foo/