runtest.py: cleanup orphan test processes.
authorJoel Martin <github@martintribe.org>
Sat, 28 Feb 2015 22:25:00 +0000 (16:25 -0600)
committerJoel Martin <github@martintribe.org>
Sat, 28 Feb 2015 22:25:00 +0000 (16:25 -0600)
docs/TODO
runtest.py

index 8abbf6c..e586f52 100644 (file)
--- a/docs/TODO
+++ b/docs/TODO
@@ -9,8 +9,8 @@ All:
       of iterations per second
     - redefine (defmacro!) as (def! (macro*))
     - runtest expect fixes:
-        - fix C#, VB and Lua
         * stop using expect, so we can drop --raw option
+        - fix C#, VB
         - fix long line splitting in runtest
     - regular expression matching in runtest
     - add re (use in rep) everywhere and use that (to avoid printing)
index 858c634..e90fc68 100755 (executable)
@@ -72,6 +72,12 @@ class Runner():
     def write(self, str):
         self.stdout.write(str)
 
+    def cleanup(self):
+        if self.p:
+            self.p.terminate()
+            self.p = None
+
+
 args = parser.parse_args(sys.argv[1:])
 test_data = args.test_file.read().split('\n')
 
@@ -127,6 +133,7 @@ def assert_prompt(timeout):
     else:
         print "Did not get 'user> ' or 'mal-user> ' prompt"
         print "    Got      : %s" % repr(r.buf)
+        r.cleanup()
         sys.exit(1)
 
 
@@ -164,7 +171,9 @@ while test_data:
             fail_cnt += 1
     except:
         print "Got Exception"
+        r.cleanup()
         sys.exit(1)
+r.cleanup()
 
 if fail_cnt > 0:
     print "FAILURES: %d" % fail_cnt