summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2017-07-24 21:32:26 -0700
committerOri Bernstein <ori@eigenstate.org>2017-07-25 22:23:05 -0700
commit5a4946bb577b755df6ddb543bccd0573de7cf2bd (patch)
tree23391c63799eebf83a478e96a794e5c6001af899
parent254640059611d64a97b82cc8b20bf759eccc6806 (diff)
downloadmc-5a4946bb577b755df6ddb543bccd0573de7cf2bd.tar.gz
Improve message signalling.
Wait for all launched processes to exit before quitting.
-rw-r--r--mbld/build.myr19
-rw-r--r--mbld/install.myr3
-rw-r--r--mbld/libs.myr2
-rw-r--r--mbld/main.myr2
-rw-r--r--mbld/test.myr5
-rw-r--r--mbld/types.myr1
6 files changed, 22 insertions, 10 deletions
diff --git a/mbld/build.myr b/mbld/build.myr
index 2ddd538..cdc8b79 100644
--- a/mbld/build.myr
+++ b/mbld/build.myr
@@ -19,7 +19,7 @@ const buildtarg = {b, targ
mark(b, o)
;;
build(b, g)
- -> true
+ -> !b.fail
}
const clean = {b
@@ -81,9 +81,9 @@ const wait = {b
-> 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 proclbl = {b, pid
}
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--
@@ -132,3 +135,11 @@ const stale = {b, n
;;
-> 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
+}
diff --git a/mbld/install.myr b/mbld/install.myr
index 08bf30a..e2119ed 100644
--- a/mbld/install.myr
+++ b/mbld/install.myr
@@ -12,8 +12,7 @@ pkg bld =
;;
const install = {b
- buildtarg(b, "all")
- -> movetargs(b, false)
+ -> buildtarg(b, "all") && movetargs(b, false)
}
const uninstall = {b
diff --git a/mbld/libs.myr b/mbld/libs.myr
index 44ac113..b63499a 100644
--- a/mbld/libs.myr
+++ b/mbld/libs.myr
@@ -28,7 +28,7 @@ const builtlib = {b, mt, dep, dyndep
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][:]),
diff --git a/mbld/main.myr b/mbld/main.myr
index fde3808..eb55d38 100644
--- a/mbld/main.myr
+++ b/mbld/main.myr
@@ -105,7 +105,7 @@ const main = {args : byte[:][:]
/*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
diff --git a/mbld/test.myr b/mbld/test.myr
index f0bbba5..50eb6bb 100644
--- a/mbld/test.myr
+++ b/mbld/test.myr
@@ -16,9 +16,10 @@ const test = {b
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
diff --git a/mbld/types.myr b/mbld/types.myr
index c898aaf..141c8ae 100644
--- a/mbld/types.myr
+++ b/mbld/types.myr
@@ -12,6 +12,7 @@ pkg bld =
/* in flight builds */
queue : node#[:]
proc : std.htab(std.pid, node#)#
+ fail : bool
/* build params */
all : byte[:][:]