Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions tests/parallel_testsuite.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import unittest
import tempfile
import time
import signal

from tools.tempfiles import try_delete

Expand All @@ -22,6 +23,7 @@


def g_testing_thread(work_queue, result_queue, temp_dir):
signal.signal(signal.SIGINT, signal.SIG_IGN)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe a comment here? I'm not sure what this does or how it helps.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I don't speak signal

for test in iter(lambda: get_from_queue(work_queue), None):
result = BufferedParallelTestResult()
test.set_temp_dir(temp_dir)
Expand All @@ -48,8 +50,14 @@ def __init__(self, max_cores):

def run(self, result):
test_queue = self.create_test_queue()
self.init_processes(test_queue)
results = self.collect_results()
try:
self.init_processes(test_queue)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this line need to be inside the try?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably if init-ing fails we might need to clean up... forget what it does and if/how it can fail though.

results = self.collect_results()
finally:
for p in self.processes:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe a comment here too, why this is needed?

p.terminate()
p.join()
self.processes.clear()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does .clear() do that is different from self.processes = []? (is it not a normal array somehow?)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume the latter allocates a new array object/id?
Which could potentially cause problems if other objects are holding references to self.processes specifically.

If so: that's comment-worthy, cause it's a nonlocal concern.

return self.combine_results(result, results)

def create_test_queue(self):
Expand Down