[tor-commits] [stem/master] Check for lingering threads after terminating controller

atagar at torproject.org atagar at torproject.org
Sun Jun 18 17:50:26 UTC 2017


commit 8a146fd042d01d8363fd1702dfd72b03281f5abc
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun Jun 18 10:52:42 2017 -0700

    Check for lingering threads after terminating controller
    
    Oops, we were checking for lingering threads before closing our controller
    causing us to mistakenly report those.
---
 run_tests.py | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/run_tests.py b/run_tests.py
index bf5a191..61f526d 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -281,19 +281,6 @@ def main():
         for test_class in get_integ_tests(args.specific_test):
           run_result = _run_test(args, test_class, output_filters, logging_buffer)
           skipped_tests += len(getattr(run_result, 'skipped', []))
-
-        # We should have joined on all threads. If not then that indicates a
-        # leak that could both likely be a bug and disrupt further targets.
-
-        active_threads = threading.enumerate()
-
-        if len(active_threads) > 1:
-          println('Threads lingering after test run:', ERROR)
-
-          for lingering_thread in active_threads:
-            println('  %s' % lingering_thread, ERROR)
-
-          break
       except KeyboardInterrupt:
         println('  aborted starting tor: keyboard interrupt\n', ERROR)
         break
@@ -309,6 +296,19 @@ def main():
         integ_runner.stop()
         println()
 
+        # We should have joined on all threads. If not then that indicates a
+        # leak that could both likely be a bug and disrupt further targets.
+
+        active_threads = threading.enumerate()
+
+        if len(active_threads) > 1:
+          println('Threads lingering after test run:', ERROR)
+
+          for lingering_thread in active_threads:
+            println('  %s' % lingering_thread, ERROR)
+
+          break
+
     if skipped_targets:
       println()
 



More information about the tor-commits mailing list