summaryrefslogtreecommitdiff
path: root/mbld
diff options
context:
space:
mode:
authorS. Gilles <sgilles@math.umd.edu>2018-04-18 08:30:41 -0400
committerS. Gilles <sgilles@math.umd.edu>2018-04-18 08:30:41 -0400
commit9aabbe574e648e0a462b211c62da5eb5875343b7 (patch)
tree9ac90949a12806359fd4b996029757c84ef6e2a6 /mbld
parent4acd9ee51a541f94e81457b1a7fb3accbd790696 (diff)
parent3d71446ecb6569add0d9eaf2e7e4a05d99bd2625 (diff)
downloadmc-9aabbe574e648e0a462b211c62da5eb5875343b7.tar.gz
Merge remote-tracking branch 'ori/master' into HEAD
Diffstat (limited to 'mbld')
-rw-r--r--mbld/bld.sub3
-rw-r--r--mbld/cpufeatures+plan9-x64.s8
-rw-r--r--mbld/cpufeatures+posixy-x64.s (renamed from mbld/cpufeatures+x64.s)4
-rw-r--r--mbld/deps.myr2
-rw-r--r--mbld/test.myr40
5 files changed, 39 insertions, 18 deletions
diff --git a/mbld/bld.sub b/mbld/bld.sub
index 7374bb3..7e9bda3 100644
--- a/mbld/bld.sub
+++ b/mbld/bld.sub
@@ -1,6 +1,7 @@
bin mbld =
build.myr
- cpufeatures+x64.s
+ cpufeatures+posixy-x64.s
+ cpufeatures+plan9-x64.s
deps.myr
libs.myr
install.myr
diff --git a/mbld/cpufeatures+plan9-x64.s b/mbld/cpufeatures+plan9-x64.s
new file mode 100644
index 0000000..645d01a
--- /dev/null
+++ b/mbld/cpufeatures+plan9-x64.s
@@ -0,0 +1,8 @@
+TEXT bld$cpufeatures+0(SB),$0
+ MOVL $0x1,AX
+ CPUID
+ MOVL CX, AX
+ MOVL DX, DX
+ ROLQ $32, DX
+ ORQ DX, AX
+ RET
diff --git a/mbld/cpufeatures+x64.s b/mbld/cpufeatures+posixy-x64.s
index 8202ca1..889c6f1 100644
--- a/mbld/cpufeatures+x64.s
+++ b/mbld/cpufeatures+posixy-x64.s
@@ -1,7 +1,7 @@
.globl bld$cpufeatures
-.globl bld$_cpufeatures
+.globl _bld$cpufeatures
bld$cpufeatures:
-bld$_cpufeatures:
+_bld$cpufeatures:
mov $0x1, %eax
cpuid
mov %ecx, %eax
diff --git a/mbld/deps.myr b/mbld/deps.myr
index 51bddb0..53b5a8f 100644
--- a/mbld/deps.myr
+++ b/mbld/deps.myr
@@ -333,7 +333,6 @@ const addalt = {b, mt, kind, f
std.slpush(&libs, d)
;;
myrcmd(b, n, mt, sp, true)
- std.slfree(mt.incpath)
n = node(g, tp)
generates(g, n, tp)
@@ -484,6 +483,7 @@ const myrcmd = {b, n, mt, src, istest
pushopt(&n.cmd, "-I", inc)
;;
if istest
+ std.slpush(&n.cmd, "-T")
for (dir, _, _) : mt.tstdeps
pushopt(&n.cmd, "-I", std.pathcat(opt_objdir, dir))
;;
diff --git a/mbld/test.myr b/mbld/test.myr
index 4d4b2ed..bf666fd 100644
--- a/mbld/test.myr
+++ b/mbld/test.myr
@@ -28,21 +28,11 @@ const go = {b, targs, kind, isbench
if !buildtarg(b, kind)
std.exit(1)
;;
- if targs.len == 0
- tests = std.htgetv(b.deps.targs, kind, [][:])
- 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)
- ;;
- ;;
- ;;
+ tests = std.htgetv(b.deps.targs, kind, [][:])
ok = true
failed = [][:]
for t : tests
- if !runtest(b, t, isbench, &failed)
+ if !runtest(b, t, targs, isbench, &failed)
ok = false
;;
;;
@@ -71,14 +61,30 @@ const printfailed = {failed
;;
}
-const runtest = {b, n, isbench, failed
+const runtest = {b, n, targs, isbench, failed
var dir, res, log, logfd
- var sub
+ var sub, found
+ if targs.len > 0
+ found = false
+ for t : targs
+ found = found || matchtest(n.lbl, t)
+ ;;
+ if !found
+ -> true
+ ;;
+ ;;
mbldput("run {}: ", n.lbl)
dir = std.pathcat(b.basedir, n.wdir)
std.chdir(dir)
std.slfree(dir)
+
+ if targs.len > 0
+ match std.strfind(targs[0], ":")
+ | `std.Some i: std.setenv("MTEST_SUBSET", targs[0][i+1:])
+ | `std.None: /* ok */
+ ;;
+ ;;
match std.spork(n.cmd)
| `std.Err m:
std.fatal("\nunable to run test: {}\n", m)
@@ -116,3 +122,9 @@ const runtest = {b, n, isbench, failed
-> res
}
+const matchtest = {name, pat
+ match std.strfind(pat, ":")
+ | `std.Some i: -> std.strhas(name, pat[:i])
+ | `std.None: -> std.strhas(name, pat)
+ ;;
+}