commit 29086a71cd508614d247f70888df884028d51185 Author: Jeremy saturn5971@gmail.com Date: Thu May 16 23:23:35 2013 -0400
Asserting ownership over the integ tests
Ticket #8634. Integ tests now assert ownership over the tor process, but avoid accidentally terminating tor mid-test. --- run_tests.py | 7 ++++--- test/integ/control/controller.py | 4 ++++ test/runner.py | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/run_tests.py b/run_tests.py index 1e76738..b59b405 100755 --- a/run_tests.py +++ b/run_tests.py @@ -185,9 +185,10 @@ def main():
println("Running tests...\n", STATUS)
- for test_class in test.util.get_integ_tests(args.test_prefix): - run_result = _run_test(test_class, output_filters, logging_buffer) - skipped_tests += len(getattr(run_result, 'skipped', [])) + with integ_runner.get_tor_controller(True): # Controller to own our main tor process + for test_class in test.util.get_integ_tests(args.test_prefix): + run_result = _run_test(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. diff --git a/test/integ/control/controller.py b/test/integ/control/controller.py index 2f4c413..50c0cc7 100644 --- a/test/integ/control/controller.py +++ b/test/integ/control/controller.py @@ -102,6 +102,8 @@ class TestController(unittest.TestCase): self.assertEqual(State.RESET, state_type) self.assertTrue(state_timestamp > before and state_timestamp < after)
+ controller.reset_conf("__OwningControllerProcess") + def test_event_handling(self): """ Add a couple listeners for various events and make sure that they receive @@ -559,6 +561,7 @@ class TestController(unittest.TestCase): finally: # reload original valid config controller.load_conf(oldconf) + controller.reset_conf("__OwningControllerProcess")
def test_saveconf(self): if test.runner.require_control(self): @@ -580,6 +583,7 @@ class TestController(unittest.TestCase): finally: controller.load_conf(oldconf) controller.save_conf() + controller.reset_conf("__OwningControllerProcess")
def test_get_socks_ports(self): """ diff --git a/test/runner.py b/test/runner.py index 3614816..e2d6def 100644 --- a/test/runner.py +++ b/test/runner.py @@ -710,7 +710,7 @@ class Runner(object): print_init_line = lambda line: println(" %s" % line, SUBSTATUS)
torrc_dst = os.path.join(self._test_dir, "torrc") - self._tor_process = stem.process.launch_tor(tor_cmd, None, torrc_dst, complete_percent, print_init_line) + self._tor_process = stem.process.launch_tor(tor_cmd, None, torrc_dst, complete_percent, print_init_line, take_ownership = True)
runtime = time.time() - start_time println(" done (%i seconds)\n" % runtime, STATUS)
tor-commits@lists.torproject.org