##// END OF EJS Templates
tests: add killdaemons helper script
Matt Mackall -
r7344:58fd3c71 default
parent child Browse files
Show More
@@ -0,0 +1,25 b''
1 #!/usr/bin/env python
2
3 import os, sys, time, errno, signal
4
5 # Kill off any leftover daemon processes
6 try:
7 fp = file(os.environ['DAEMON_PIDS'])
8 for line in fp:
9 try:
10 pid = int(line)
11 except ValueError:
12 continue
13 try:
14 os.kill(pid, 0)
15 os.kill(pid, signal.SIGTERM)
16 for i in range(10):
17 time.sleep(0.05)
18 os.kill(pid, 0)
19 os.kill(pid, signal.SIGKILL)
20 except OSError, err:
21 if err.errno != errno.ESRCH:
22 raise
23 fp.close()
24 except IOError:
25 pass
@@ -24,7 +24,7 b' test_archtype() {'
24 echo % $3 and $4 disallowed should both give 403
24 echo % $3 and $4 disallowed should both give 403
25 "$TESTDIR/get-with-headers.py" localhost:$HGPORT "/archive/tip.$3" | head -n 1
25 "$TESTDIR/get-with-headers.py" localhost:$HGPORT "/archive/tip.$3" | head -n 1
26 "$TESTDIR/get-with-headers.py" localhost:$HGPORT "/archive/tip.$4" | head -n 1
26 "$TESTDIR/get-with-headers.py" localhost:$HGPORT "/archive/tip.$4" | head -n 1
27 kill `cat hg.pid`
27 "$TESTDIR/killdaemons.py"
28 cat errors.log
28 cat errors.log
29 cp .hg/hgrc-base .hg/hgrc
29 cp .hg/hgrc-base .hg/hgrc
30 }
30 }
@@ -63,6 +63,8 b' http_proxy= python getarchive.py "$TIP" '
63 http_proxy= python getarchive.py "$TIP" zip > archive.zip
63 http_proxy= python getarchive.py "$TIP" zip > archive.zip
64 unzip -t archive.zip | sed "s/$QTIP/TIP/"
64 unzip -t archive.zip | sed "s/$QTIP/TIP/"
65
65
66 "$TESTDIR/killdaemons.py"
67
66 hg archive -t tar test.tar
68 hg archive -t tar test.tar
67 tar tf test.tar
69 tar tf test.tar
68
70
@@ -37,6 +37,7 b' echo % should merge c into a'
37 hg --cwd c fetch -d '4 0' -m 'automated merge' ../a
37 hg --cwd c fetch -d '4 0' -m 'automated merge' ../a
38 ls c
38 ls c
39
39
40 netstat -tnap 2>/dev/null | grep $HGPORT | grep LISTEN
40 hg --cwd a serve -a localhost -p $HGPORT -d --pid-file=hg.pid
41 hg --cwd a serve -a localhost -p $HGPORT -d --pid-file=hg.pid
41 cat a/hg.pid >> "$DAEMON_PIDS"
42 cat a/hg.pid >> "$DAEMON_PIDS"
42
43
@@ -169,4 +170,6 b" echo '% parent should be 0 (fetch did no"
169 hg -R n2 parents --template '{rev}\n'
170 hg -R n2 parents --template '{rev}\n'
170 rm -fr n1 n2
171 rm -fr n1 n2
171
172
173 "$TESTDIR/killdaemons.py"
174
172 true
175 true
General Comments 0
You need to be logged in to leave comments. Login now