Skip to content

Commit

Permalink
validate: launcher: Use test index instead of counting test numbers
Browse files Browse the repository at this point in the history
Patch 1/4 to implement parallel test execution.

https://bugzilla.gnome.org/show_bug.cgi?id=743063
  • Loading branch information
Ramiro Polla authored and tsaunier committed Feb 5, 2015
1 parent 9c46f5f commit d9097f8
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions validate/launcher/baseclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,8 @@ def __init__(self):
self.blacklisted_tests_patterns = []
self._generators = []
self.queue = Queue.Queue()
self.total_num_tests = 0
self.starting_test_num = 0

def init(self):
return False
Expand Down Expand Up @@ -792,21 +794,26 @@ def test_wait(self, test):
test.kill_subprocess()
raise

def run_tests(self, cur_test_num, total_num_tests):
i = cur_test_num
def run_tests(self, starting_test_num, total_num_tests):
self.total_num_tests = total_num_tests
self.starting_test_num = starting_test_num

for test in self.tests:
sys.stdout.write("[%d / %d] " % (i + 1, total_num_tests))
self.print_test_num(test)
test.test_start(self.queue)
self.test_wait(test)
res = test.test_end()
i += 1
self.reporter.after_test(test)
if res != Result.PASSED and (self.options.forever or
self.options.fatal_error):
return test.result

return Result.PASSED

def print_test_num(self, test):
cur_test_num = self.starting_test_num + self.tests.index(test) + 1
sys.stdout.write("[%d / %d] " % (cur_test_num, self.total_num_tests))

def clean_tests(self):
for test in self.tests:
test.clean()
Expand Down

1 comment on commit d9097f8

@thiblahute
Copy link
Member

Choose a reason for hiding this comment

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

OK

Please sign in to comment.