test-serve: replace copy/paste with shell function
authorPatrick Mezard <pmezard@gmail.com>
Mon, 17 Mar 2008 16:15:43 +0100
changeset 6300 874ca958025b
parent 6299 653ddd1d7cd7
child 6301 68cfd7d208a5
test-serve: replace copy/paste with shell function
tests/test-serve
--- 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/