ref: 5a4946bb577b755df6ddb543bccd0573de7cf2bd
parent: 254640059611d64a97b82cc8b20bf759eccc6806
author: Ori Bernstein <ori@eigenstate.org>
date: Mon Jul 24 17:32:26 EDT 2017
Improve message signalling. Wait for all launched processes to exit before quitting.
--- a/mbld/build.myr
+++ b/mbld/build.myr
@@ -19,7 +19,7 @@
mark(b, o)
;;
build(b, g)
- -> true
+ -> !b.fail
}
const clean = {b
@@ -81,9 +81,9 @@
-> void
;;
match std.waitany()
- | (p, `std.Wfailure): std.fatal("FAIL: {j= }\n", proclbl(b, p))
- | (p, `std.Wsignalled): std.fatal("CRASH: {j= }\n", proclbl(b, p))
- | (p, `std.Waiterror): std.fatal("WAT: {j= }\n", proclbl(b, p))
+ | (p, `std.Wfailure): fail(b, p, "FAIL")
+ | (p, `std.Wsignalled): fail(b, p, "CRASH")
+ | (p, `std.Waiterror): std.fatal("error waiting: nproc={}\n", std.htcount(b.proc))
| (p, `std.Wsuccess):
pp = p
match std.htget(b.proc, p)
@@ -105,6 +105,9 @@
}
const unblock = {b, n
+ if b.fail
+ -> void
+ ;;
for g : n.ngen
std.assert(g.nblock != 0, "bogus unblock {} from {}\n", g.lbl, n.lbl)
g.nblock--
@@ -131,4 +134,12 @@
;;
;;
-> staletime > n.mtime
+}
+
+const fail = {b, pid, failtype
+ std.fput(std.Err, "{}: {j= }\n", failtype, proclbl(b, pid))
+ std.htdel(b.proc, pid)
+ std.slfree(b.queue)
+ b.queue = [][:]
+ b.fail = true
}
--- a/mbld/install.myr
+++ b/mbld/install.myr
@@ -12,8 +12,7 @@
;;
const install = {b
- buildtarg(b, "all")
- -> movetargs(b, false)
+ -> buildtarg(b, "all") && movetargs(b, false)
}
const uninstall = {b
--- a/mbld/libs.myr
+++ b/mbld/libs.myr
@@ -28,7 +28,7 @@
u = std.fmt("lib{}.use", mt.name)
ldep = std.mk([
.name=mt.name,
- .dir=mt.dir,
+ .dir=std.pathcat(b.objdir, mt.dir),
.dep=dep,
.dyndep=dyndep,
.genuse=std.pathjoin([b.objdir, mt.dir, u][:]),
--- a/mbld/main.myr
+++ b/mbld/main.myr
@@ -105,7 +105,7 @@
/*bld.configure()*/
/* default: buildall */
if cmd.args.len == 0
- bld.buildtarg(b, "all")
+ ok = bld.buildtarg(b, "all")
else
for c in cmd.args
match c
--- a/mbld/test.myr
+++ b/mbld/test.myr
@@ -16,9 +16,10 @@
var failed, ok
var tests
- buildtarg(b, "test")
+ if !buildtarg(b, "test")
+ std.exit(1)
+ ;;
tests = std.htgetv(b.deps.targs, "test", [][:])
-
ok = true
failed = [][:]
for t in tests
--- a/mbld/types.myr
+++ b/mbld/types.myr
@@ -12,6 +12,7 @@
/* in flight builds */
queue : node#[:]
proc : std.htab(std.pid, node#)#
+ fail : bool
/* build params */
all : byte[:][:]