changeset 21319:44c96e2bab20

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().
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 19 Apr 2014 20:22:32 -0700
parents 6b3d66e4d3be
children e5eed8ded168
files tests/run-tests.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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()