From 5adcaa3487048af3463b0da6e66b43b0314e3abd Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Wed, 8 Oct 2014 14:41:12 +0200 Subject: [PATCH] Exit on check-examples failure Should avoid Travis to pass even though there are errors. Waiting for the check-examples to finish to get all the errors. It may also be necessary in order to free system resources like file descriptors. --- build.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/build.py b/build.py index 601311435d..6b07c125a5 100755 --- a/build.py +++ b/build.py @@ -33,10 +33,12 @@ class ThreadPool: function(*args, **kargs) except: print(sys.exc_info()[0]) + self.tasks.errors = True self.tasks.task_done() def __init__(self, num_threads = multiprocessing.cpu_count() + 1): self.tasks = Queue(num_threads) + self.tasks.errors = False # create num_threads Workers, by default the number of CPUs + 1 for _ in range(num_threads): self.Worker(self.tasks) @@ -46,6 +48,7 @@ class ThreadPool: def wait_completion(self): # wait for the queue to be empty self.tasks.join() + return self.tasks.errors if sys.platform == 'win32': @@ -661,7 +664,9 @@ def check_examples(t): pool = ThreadPool() for example in all_examples: pool.add_task(t.run, '%(PHANTOMJS)s', 'bin/check-example.js', example) - pool.wait_completion() + errors = pool.wait_completion() + if errors: + sys.exit(1) @target('test', phony=True)