changeset 15786:d54cca247d0b

mx: propagate failure from forked Java compilation task back up to parent (GRAAL-350)
author Doug Simon <doug.simon@oracle.com>
date Tue, 20 May 2014 15:35:35 +0200
parents 7a6f6a7ef886
children a5abeb0a3fb0
files mxtool/mx.py
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mxtool/mx.py	Tue May 20 11:56:19 2014 +0200
+++ b/mxtool/mx.py	Tue May 20 15:35:35 2014 +0200
@@ -2248,6 +2248,7 @@
             failed = []
             for t in tasks:
                 t.proc.join()
+                _removeSubprocess(t.sub)
                 if t.proc.exitcode != 0:
                     failed.append(t)
             return failed
@@ -2258,7 +2259,6 @@
                 if t.proc.is_alive():
                     active.append(t)
                 else:
-                    _removeSubprocess(t.sub)
                     if t.proc.exitcode != 0:
                         return ([], joinTasks(tasks))
             return (active, [])
@@ -2289,6 +2289,7 @@
         cpus = multiprocessing.cpu_count()
         worklist = sortWorklist(tasks.values())
         active = []
+        failed = []
         while len(worklist) != 0:
             while True:
                 active, failed = checkTasks(active)
@@ -2301,6 +2302,9 @@
                 else:
                     break
 
+            if len(failed) != 0:
+                break
+
             def executeTask(task):
                 # Clear sub-process list cloned from parent process
                 del _currentSubprocesses[:]
@@ -2323,7 +2327,12 @@
                     break
 
             worklist = sortWorklist(worklist)
-        joinTasks(active)
+
+        failed += joinTasks(active)
+        if len(failed):
+            for t in failed:
+                log('Compiling {} failed'.format(t.proj.name))
+            abort('{} Java compilation tasks failed'.format(len(failed)))
 
     for dist in _dists.values():
         archive(['@' + dist.name])