run-tests: kill daemons during Test.cleanup()
authorGregory Szorc <gregory.szorc@gmail.com>
Sat, 19 Apr 2014 20:22:32 -0700
changeset 21319 44c96e2bab20
parent 21318 6b3d66e4d3be
child 21320 e5eed8ded168
run-tests: kill daemons during Test.cleanup() As a safety precaution, we kill daemons in Test.cleanup(). This is necessary for a subsequent patch that will reraise KeyboardInterrupt before killdaemons() runs as part of run().
tests/run-tests.py
--- a/tests/run-tests.py	Sat Apr 19 18:50:40 2014 -0700
+++ b/tests/run-tests.py	Sat Apr 19 20:22:32 2014 -0700
@@ -555,6 +555,7 @@
         self._path = path
         self._options = options
         self._count = count
+        self._daemonpids = []
 
         # If we're not in --debug mode and reference output file exists,
         # check test output against it.
@@ -571,6 +572,9 @@
         os.mkdir(self._threadtmp)
 
     def cleanup(self):
+        for entry in self._daemonpids:
+            killdaemons(entry)
+
         if self._threadtmp and not self._options.keep_tmpdir:
             shutil.rmtree(self._threadtmp, True)
 
@@ -579,6 +583,7 @@
         os.mkdir(testtmp)
         replacements, port = self._getreplacements(testtmp)
         env = self._getenv(testtmp, port)
+        self._daemonpids.append(env['DAEMON_PIDS'])
         createhgrc(env['HGRCPATH'], self._options)
 
         starttime = time.time()