killdaemons: take file argument explicitely

It makes it easier to use as a generic replacement for kill utility,
mostly for Windows tests.
This commit is contained in:
Patrick Mezard 2012-08-20 22:36:51 +02:00
parent d56e57416a
commit 7d8680da1f
13 changed files with 29 additions and 28 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python
import os, time, errno, signal
import os, sys, time, errno, signal
if os.name =='nt':
import ctypes
@ -49,5 +49,6 @@ def killdaemons(pidfile, tryhard=True, remove=False, logfn=None):
pass
if __name__ == '__main__':
killdaemons(os.environ['DAEMON_PIDS'])
path, = sys.argv[1:]
killdaemons(path)

View File

@ -24,7 +24,7 @@
> echo % $3 and $4 disallowed should both give 403
> "$TESTDIR/get-with-headers.py" localhost:$HGPORT "archive/tip.$3" | head -n 1
> "$TESTDIR/get-with-headers.py" localhost:$HGPORT "archive/tip.$4" | head -n 1
> "$TESTDIR/killdaemons.py"
> "$TESTDIR/killdaemons.py" $DAEMON_PIDS
> cat errors.log
> cp .hg/hgrc-base .hg/hgrc
> }
@ -93,7 +93,7 @@ invalid arch type should give 404
testing: test-archive-2c0277f05ed4/foo OK
No errors detected in compressed data of archive.zip.
$ "$TESTDIR/killdaemons.py"
$ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
$ hg archive -t tar test.tar
$ tar tf test.tar

View File

@ -1260,7 +1260,7 @@ Static files
Stop and restart with HGENCODING=cp932 and preferuncompressed
$ "$TESTDIR/killdaemons.py"
$ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
$ HGENCODING=cp932 hg serve --config server.preferuncompressed=True -n test \
> -p $HGPORT -d --pid-file=hg.pid -E errors.log
$ cat hg.pid >> $DAEMON_PIDS
@ -1288,7 +1288,7 @@ heads
ERRORS ENCOUNTERED
$ cat errors.log
$ "$TESTDIR/killdaemons.py"
$ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
$ cd ..

View File

@ -291,7 +291,7 @@ diff removed file
set up hgweb with git diffs
$ "$TESTDIR/killdaemons.py"
$ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
$ hg serve --config 'diff.git=1' -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
$ cat hg.pid >> $DAEMON_PIDS
@ -936,7 +936,7 @@ test import rev as raw-rev
raw revision with diff block numbers
$ "$TESTDIR/killdaemons.py"
$ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
$ cat <<EOF > .hg/hgrc
> [web]
> templates = rawdiff
@ -973,7 +973,7 @@ raw revision with diff block numbers
@@ -0,0 +1,1 @@
+b
$ "$TESTDIR/killdaemons.py"
$ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
$ rm .hg/hgrc rawdiff/map
$ rmdir rawdiff
$ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log

View File

@ -299,7 +299,7 @@ try bad style
stop and restart
$ "$TESTDIR/killdaemons.py"
$ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
$ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log
$ cat hg.pid >> $DAEMON_PIDS

View File

@ -657,7 +657,7 @@ Test [paths] '**' extension
Test collapse = True
$ "$TESTDIR/killdaemons.py"
$ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
$ cat >> paths.conf <<EOF
> [web]
> collapse=true
@ -723,7 +723,7 @@ Test subrepositories inside intermediate directories
Test descend = False
$ "$TESTDIR/killdaemons.py"
$ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
$ cat >> paths.conf <<EOF
> descend=false
> EOF
@ -784,7 +784,7 @@ Test [paths] '*' in a repo root
$ hg id http://localhost:$HGPORT1/astar
8580ff50825a
$ "$TESTDIR/killdaemons.py"
$ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
$ cat > paths.conf <<EOF
> [paths]
> t/a = $root/a
@ -812,7 +812,7 @@ Test [paths] '*' in a repo root
Test collapse = True
$ "$TESTDIR/killdaemons.py"
$ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
$ cat >> paths.conf <<EOF
> [web]
> collapse=true
@ -837,7 +837,7 @@ Test collapse = True
test descend = False
$ "$TESTDIR/killdaemons.py"
$ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
$ cat >> paths.conf <<EOF
> descend=false
> EOF
@ -857,7 +857,7 @@ test descend = False
/t/a/
/t/b/
$ "$TESTDIR/killdaemons.py"
$ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
$ cat > paths.conf <<EOF
> [paths]
> nostore = $root/nostore
@ -956,7 +956,7 @@ rss-log with basedir /
$ "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 'a/rss-log' | grep '<guid'
<guid isPermaLink="true">http://hg.example.com:8080/a/rev/8580ff50825a</guid>
$ "$TESTDIR/killdaemons.py"
$ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
$ hg serve --config web.baseurl=http://hg.example.com:8080/foo/ -p $HGPORT2 -d \
> --pid-file=hg.pid --webdir-conf collections.conf \
> -A access-collections-2.log -E error-collections-2.log

View File

@ -545,7 +545,7 @@ hgweb highlightcss friendly
errors encountered
$ cat errors.log
$ "$TESTDIR/killdaemons.py"
$ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
Change the pygments style
@ -579,7 +579,7 @@ errors encountered
$ hg ci -Ama
adding eucjp.txt
$ hgserveget () {
> "$TESTDIR/killdaemons.py"
> "$TESTDIR/killdaemons.py" $DAEMON_PIDS
> echo % HGENCODING="$1" hg serve
> HGENCODING="$1" hg serve -p $HGPORT -d -n test --pid-file=hg.pid -E errors.log
> cat hg.pid >> $DAEMON_PIDS

View File

@ -200,7 +200,7 @@ Test display of largefiles in hgweb
-rw-r--r-- 9 normal4
$ "$TESTDIR/killdaemons.py"
$ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
#endif
Test archiving the various revisions. These hit corner cases known with
@ -1166,7 +1166,7 @@ largefiles can be pushed locally (issue3583)
[255]
used all HGPORTs, kill all daemons
$ "$TESTDIR/killdaemons.py"
$ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
#endif
vanilla clients locked out from largefiles ssh repos
@ -1252,7 +1252,7 @@ Push a largefiles repository to a served empty repository
$ rm -rf empty
used all HGPORTs, kill all daemons
$ "$TESTDIR/killdaemons.py"
$ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
#endif

View File

@ -28,7 +28,7 @@ Cloning with a password in the URL should not save the password in .hg/hgrc:
$ cat test3/.hg/hgrc
[paths]
default = http://foo@localhost:$HGPORT/
$ "$TESTDIR/killdaemons.py"
$ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
expect error, cloning not allowed
@ -40,7 +40,7 @@ expect error, cloning not allowed
requesting all changes
abort: authorization failed
[255]
$ "$TESTDIR/killdaemons.py"
$ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
serve errors

View File

@ -17,7 +17,7 @@
> cat hg.pid >> $DAEMON_PIDS
> hg --cwd ../test2 push http://localhost:$HGPORT/
> exitstatus=$?
> "$TESTDIR/killdaemons.py"
> "$TESTDIR/killdaemons.py" $DAEMON_PIDS
> echo % serve errors
> cat errors.log
> return $exitstatus

View File

@ -70,7 +70,7 @@ subrepo debug for 'main' clone
source ../sub
revision 863c1745b441bd97a8c4a096e87793073f4fb215
$ "$TESTDIR/killdaemons.py"
$ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
subrepo paths with ssh urls

View File

@ -35,7 +35,7 @@ Setup HTTP server control:
> cat hg.pid >> $DAEMON_PIDS
> }
$ tstop() {
> "$TESTDIR/killdaemons.py"
> "$TESTDIR/killdaemons.py" $DAEMON_PIDS
> cp $HGRCPATH-withcap $HGRCPATH
> }

View File

@ -23,7 +23,7 @@ Setup HTTP server control:
> cat hg.pid >> $DAEMON_PIDS
> }
$ tstop() {
> "$TESTDIR/killdaemons.py"
> "$TESTDIR/killdaemons.py" $DAEMON_PIDS
> }
Both are empty: