changeset 17466:d5a3bda6e170

killdaemons: take file argument explicitely It makes it easier to use as a generic replacement for kill utility, mostly for Windows tests.
author Patrick Mezard <patrick@mezard.eu>
date Mon, 20 Aug 2012 22:36:51 +0200
parents 2d4a096e213c
children 448d0c452140
files tests/killdaemons.py tests/test-archive.t tests/test-hgweb-commands.t tests/test-hgweb-diffs.t tests/test-hgweb.t tests/test-hgwebdir.t tests/test-highlight.t tests/test-largefiles.t tests/test-pull-http.t tests/test-push-http.t tests/test-subrepo-relative-path.t tests/test-treediscovery-legacy.t tests/test-treediscovery.t
diffstat 13 files changed, 29 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/tests/killdaemons.py	Sun Aug 19 18:06:15 2012 +0200
+++ b/tests/killdaemons.py	Mon Aug 20 22:36:51 2012 +0200
@@ -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 @@
         pass
 
 if __name__ == '__main__':
-    killdaemons(os.environ['DAEMON_PIDS'])
+    path, = sys.argv[1:]
+    killdaemons(path)
 
--- a/tests/test-archive.t	Sun Aug 19 18:06:15 2012 +0200
+++ b/tests/test-archive.t	Mon Aug 20 22:36:51 2012 +0200
@@ -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 @@
       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
--- a/tests/test-hgweb-commands.t	Sun Aug 19 18:06:15 2012 +0200
+++ b/tests/test-hgweb-commands.t	Mon Aug 20 22:36:51 2012 +0200
@@ -1260,7 +1260,7 @@
 
 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 @@
 ERRORS ENCOUNTERED
 
   $ cat errors.log
-  $ "$TESTDIR/killdaemons.py"
+  $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
 
   $ cd ..
 
--- a/tests/test-hgweb-diffs.t	Sun Aug 19 18:06:15 2012 +0200
+++ b/tests/test-hgweb-diffs.t	Mon Aug 20 22:36:51 2012 +0200
@@ -291,7 +291,7 @@
 
 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 @@
 
 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 @@
   @@ -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
--- a/tests/test-hgweb.t	Sun Aug 19 18:06:15 2012 +0200
+++ b/tests/test-hgweb.t	Mon Aug 20 22:36:51 2012 +0200
@@ -299,7 +299,7 @@
 
 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
 
--- a/tests/test-hgwebdir.t	Sun Aug 19 18:06:15 2012 +0200
+++ b/tests/test-hgwebdir.t	Mon Aug 20 22:36:51 2012 +0200
@@ -657,7 +657,7 @@
 
 Test collapse = True
 
-  $ "$TESTDIR/killdaemons.py"
+  $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
   $ cat >> paths.conf <<EOF
   > [web]
   > collapse=true
@@ -723,7 +723,7 @@
 
 Test descend = False
 
-  $ "$TESTDIR/killdaemons.py"
+  $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
   $ cat >> paths.conf <<EOF
   > descend=false
   > EOF
@@ -784,7 +784,7 @@
   $ 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 collapse = True
 
-  $ "$TESTDIR/killdaemons.py"
+  $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
   $ cat >> paths.conf <<EOF
   > [web]
   > collapse=true
@@ -837,7 +837,7 @@
 
 test descend = False
 
-  $ "$TESTDIR/killdaemons.py"
+  $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
   $ cat >> paths.conf <<EOF
   > descend=false
   > EOF
@@ -857,7 +857,7 @@
   /t/a/
   /t/b/
   
-  $ "$TESTDIR/killdaemons.py"
+  $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
   $ cat > paths.conf <<EOF
   > [paths]
   > nostore = $root/nostore
@@ -956,7 +956,7 @@
 
   $ "$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
--- a/tests/test-highlight.t	Sun Aug 19 18:06:15 2012 +0200
+++ b/tests/test-highlight.t	Mon Aug 20 22:36:51 2012 +0200
@@ -545,7 +545,7 @@
 errors encountered
 
   $ cat errors.log
-  $ "$TESTDIR/killdaemons.py"
+  $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
 
 Change the pygments style
 
@@ -579,7 +579,7 @@
   $ 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
--- a/tests/test-largefiles.t	Sun Aug 19 18:06:15 2012 +0200
+++ b/tests/test-largefiles.t	Mon Aug 20 22:36:51 2012 +0200
@@ -200,7 +200,7 @@
   -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 @@
   [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 @@
   $ rm -rf empty
 
 used all HGPORTs, kill all daemons
-  $ "$TESTDIR/killdaemons.py"
+  $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
 
 #endif
 
--- a/tests/test-pull-http.t	Sun Aug 19 18:06:15 2012 +0200
+++ b/tests/test-pull-http.t	Mon Aug 20 22:36:51 2012 +0200
@@ -28,7 +28,7 @@
   $ 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 @@
   requesting all changes
   abort: authorization failed
   [255]
-  $ "$TESTDIR/killdaemons.py"
+  $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
 
 serve errors
 
--- a/tests/test-push-http.t	Sun Aug 19 18:06:15 2012 +0200
+++ b/tests/test-push-http.t	Mon Aug 20 22:36:51 2012 +0200
@@ -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
--- a/tests/test-subrepo-relative-path.t	Sun Aug 19 18:06:15 2012 +0200
+++ b/tests/test-subrepo-relative-path.t	Mon Aug 20 22:36:51 2012 +0200
@@ -70,7 +70,7 @@
    source   ../sub
    revision 863c1745b441bd97a8c4a096e87793073f4fb215
 
-  $ "$TESTDIR/killdaemons.py"
+  $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
 
 subrepo paths with ssh urls
 
--- a/tests/test-treediscovery-legacy.t	Sun Aug 19 18:06:15 2012 +0200
+++ b/tests/test-treediscovery-legacy.t	Mon Aug 20 22:36:51 2012 +0200
@@ -35,7 +35,7 @@
   >   cat hg.pid >> $DAEMON_PIDS
   > }
   $ tstop() {
-  >   "$TESTDIR/killdaemons.py"
+  >   "$TESTDIR/killdaemons.py" $DAEMON_PIDS
   >   cp $HGRCPATH-withcap $HGRCPATH
   > }
 
--- a/tests/test-treediscovery.t	Sun Aug 19 18:06:15 2012 +0200
+++ b/tests/test-treediscovery.t	Mon Aug 20 22:36:51 2012 +0200
@@ -23,7 +23,7 @@
   >   cat hg.pid >> $DAEMON_PIDS
   > }
   $ tstop() {
-  >   "$TESTDIR/killdaemons.py"
+  >   "$TESTDIR/killdaemons.py" $DAEMON_PIDS
   > }
 
 Both are empty: