summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2017-08-08 14:30:41 -0700
committerOri Bernstein <ori@markovcorp.com>2017-08-08 16:18:07 -0700
commitb53309d883b5facd81d37606c49b432833f32b72 (patch)
treee427e516906e8f104e272e2763b50019385c9ed3
parentb7730c04c8c83ad6a536a64e549d4d88cc636feb (diff)
downloadmc-b53309d883b5facd81d37606c49b432833f32b72.tar.gz
Allow listing targets and selecting tests.
This is the first half of running specific tests. The second half involves actually adding implicit test targets.
-rw-r--r--mbld/bld.sub1
-rw-r--r--mbld/build.myr11
-rw-r--r--mbld/clean.myr8
-rw-r--r--mbld/main.myr23
-rw-r--r--mbld/test.myr16
5 files changed, 35 insertions, 24 deletions
diff --git a/mbld/bld.sub b/mbld/bld.sub
index c9d9a6e..15ad4cf 100644
--- a/mbld/bld.sub
+++ b/mbld/bld.sub
@@ -1,6 +1,5 @@
bin mbld =
build.myr
- clean.myr
deps.myr
libs.myr
install.myr
diff --git a/mbld/build.myr b/mbld/build.myr
index 77d5e97..cc7d697 100644
--- a/mbld/build.myr
+++ b/mbld/build.myr
@@ -11,12 +11,15 @@ pkg bld =
;;
const buildtarg = {b, targ
- var g
+ var g, targs
g = b.deps
- var outs = std.htgetv(g.targs, targ, [][:])
- for o : outs
- mark(b, o)
+ match std.htget(g.targs, targ)
+ | `std.Some t: targs = t
+ | `std.None: fatal("unknown target: {}\n", targ)
+ ;;
+ for t : targs
+ mark(b, t)
;;
build(b, g)
-> !b.fail
diff --git a/mbld/clean.myr b/mbld/clean.myr
deleted file mode 100644
index 73ca1e5..0000000
--- a/mbld/clean.myr
+++ /dev/null
@@ -1,8 +0,0 @@
-use std
-
-use "opts"
-use "types"
-use "util"
-
-pkg bld =
-;;
diff --git a/mbld/main.myr b/mbld/main.myr
index e9e34dd..50aa373 100644
--- a/mbld/main.myr
+++ b/mbld/main.myr
@@ -91,15 +91,17 @@ const main = {args : byte[:][:]
if cmd.args.len == 0
ok = bld.buildtarg(b, "all")
else
- for c : cmd.args
- match c
- | "clean": r = bld.clean(b)
- | "install": r = bld.install(b)
- | "uninstall": r = bld.uninstall(b)
- | "test": r = bld.test(b)
- | target: r = bld.buildtarg(b, target)
+ match cmd.args[0]
+ | "clean": r = bld.clean(b)
+ | "install": r = bld.install(b)
+ | "uninstall": r = bld.uninstall(b)
+ | "test": r = bld.test(b, cmd.args[1:])
+ | "list": r = show(b, cmd.args[1:])
+ | _:
+ ok = true
+ for target : cmd.args
+ r = ok && bld.buildtarg(b, target)
;;
- ok = ok && r
;;
;;
;;
@@ -166,3 +168,8 @@ const findproj = {b
;;
}
+const show = {b, targs
+ var k = std.htkeys(b.targs)
+ std.put("{j=\n}\n", k)
+ -> true
+}
diff --git a/mbld/test.myr b/mbld/test.myr
index 723bd85..f8007b9 100644
--- a/mbld/test.myr
+++ b/mbld/test.myr
@@ -9,17 +9,27 @@ use "subtest"
use "config"
pkg bld =
- const test : (b : build# -> bool)
+ const test : (b : build#, targs : byte[:][:] -> bool)
;;
-const test = {b
+const test = {b, targs
var failed, ok
var tests
if !buildtarg(b, "test")
std.exit(1)
;;
- tests = std.htgetv(b.deps.targs, "test", [][:])
+ if targs.len == 0
+ tests = std.htgetv(b.deps.targs, "test", [][:])
+ else
+ tests = [][:]
+ for t : targs
+ match std.htget(b.deps.targs, t)
+ | `std.Some tl: std.sljoin(&tests, tl)
+ | `std.None: std.fatal("unknown test {}\n", t)
+ ;;
+ ;;
+ ;;
ok = true
failed = [][:]
for t in tests