changeset 37846:89793289c891

tests: remove pid file by default Previously, killdaemons.py would kill PIDs listed in a file then leave the file lingering around. If the PIDs are killed, then there's no point leaving the PID file around. In the worst case, a later invocation of killdaemons.py (run-tests.py invokes killdaemons.py after running a test) could kill a separate process whose PID conflicted with a previously-killed process. By removing the PID file, we eliminate this possibility. Some tests were manually removing the PID file after calling killdaemons.py. So we update these tests to not do this. Differential Revision: https://phab.mercurial-scm.org/D3443
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 05 May 2018 19:00:03 -0700
parents b4b7427b5786
children 8256962e798c
files tests/killdaemons.py tests/test-lfs-test-server.t tests/test-obsolete.t tests/test-run-tests.t tests/test-serve.t
diffstat 5 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/tests/killdaemons.py	Mon Apr 30 19:54:55 2018 -0700
+++ b/tests/killdaemons.py	Sat May 05 19:00:03 2018 -0700
@@ -124,4 +124,4 @@
     else:
         path = os.environ["DAEMON_PIDS"]
 
-    killdaemons(path)
+    killdaemons(path, remove=True)
--- a/tests/test-lfs-test-server.t	Mon Apr 30 19:54:55 2018 -0700
+++ b/tests/test-lfs-test-server.t	Sat May 05 19:00:03 2018 -0700
@@ -880,7 +880,6 @@
   $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob)
 #endif
 
-  $ rm $DAEMON_PIDS
   $ mkdir $TESTTMP/lfs-server2
   $ cd $TESTTMP/lfs-server2
 #if no-windows git-server
--- a/tests/test-obsolete.t	Mon Apr 30 19:54:55 2018 -0700
+++ b/tests/test-obsolete.t	Sat May 05 19:00:03 2018 -0700
@@ -931,7 +931,7 @@
   $ echo "evolution.exchange=True" >> $HGRCPATH
   $ echo "evolution.createmarkers=True" >> $HGRCPATH
 
-  $ rm hg.pid access.log errors.log
+  $ rm access.log errors.log
 #endif
 
 Several troubles on the same changeset (create an unstable and bumped changeset)
--- a/tests/test-run-tests.t	Mon Apr 30 19:54:55 2018 -0700
+++ b/tests/test-run-tests.t	Sat May 05 19:00:03 2018 -0700
@@ -574,7 +574,6 @@
   # Ran 1 tests, 0 skipped, 0 failed.
   $ rm test-serve-inuse.t
   $ killdaemons.py $DAEMON_PIDS
-  $ rm $DAEMON_PIDS
 
 Running In Debug Mode
 ======================
--- a/tests/test-serve.t	Mon Apr 30 19:54:55 2018 -0700
+++ b/tests/test-serve.t	Sat May 05 19:00:03 2018 -0700
@@ -6,10 +6,11 @@
   >        | sed -e "s/:$HGPORT1\\([^0-9]\\)/:HGPORT1\1/g" \
   >              -e "s/:$HGPORT2\\([^0-9]\\)/:HGPORT2\1/g" \
   >              -e 's/http:\/\/[^/]*\//http:\/\/localhost\//'
-  >    cat hg.pid >> "$DAEMON_PIDS"
+  >    if [ -f hg.pid ]; then
+  >        killdaemons.py hg.pid
+  >    fi
   >    echo % errors
   >    cat errors.log
-  >    killdaemons.py hg.pid
   > }
 
   $ hg init test