From 21000eb85153b789f1b8869317d1e52470b1af77 Mon Sep 17 00:00:00 2001 From: Edward Lemur Date: Fri, 24 May 2019 23:25:58 +0000 Subject: [PATCH] presubmit_support: Run tests on parallel when asked. Bug: 819774 Change-Id: I19cd59aab23f3afb39da7fa04c470ad4b1c688f4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1627402 Reviewed-by: Robbie Iannucci Commit-Queue: Edward Lesmes --- presubmit_support.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/presubmit_support.py b/presubmit_support.py index dd3bc49373..1fa3c9fce8 100755 --- a/presubmit_support.py +++ b/presubmit_support.py @@ -731,11 +731,8 @@ class InputApi(object): return 'TBR' in self.change.tags or self.change.TBRsFromDescription() def RunTests(self, tests_mix, parallel=True): - # RunTests doesn't actually run tests. It adds them to a ThreadPool that - # will run all tests once all PRESUBMIT files are processed. tests = [] msgs = [] - parallel = parallel and self.parallel for t in tests_mix: if isinstance(t, OutputApi.PresubmitResult) and t: msgs.append(t) @@ -747,7 +744,11 @@ class InputApi(object): if not t.kwargs.get('cwd'): t.kwargs['cwd'] = self.PresubmitLocalPath() self.thread_pool.AddTests(tests, parallel) - if not parallel: + # When self.parallel is True (i.e. --parallel is passed as an option) + # RunTests doesn't actually run tests. It adds them to a ThreadPool that + # will run all tests once all PRESUBMIT files are processed. + # Otherwise, it will run them and return the results. + if not self.parallel: msgs.extend(self.thread_pool.RunAsync()) return msgs