diff options
author | Ori Bernstein <ori@markovcorp.com> | 2018-01-31 11:41:59 -0800 |
---|---|---|
committer | Ori Bernstein <ori@markovcorp.com> | 2018-01-31 11:41:59 -0800 |
commit | bc9ee15fdd4a4c961bac0de2f4f9c4fceccd4a86 (patch) | |
tree | 754355ed80d5e6bc6c31e3225b0ca5810662c4f0 /mbld | |
parent | 65c02369b7b2c94e3832bb2a333b98bca852ada6 (diff) | |
download | mc-bc9ee15fdd4a4c961bac0de2f4f9c4fceccd4a86.tar.gz |
Teach mbld how to parse skipped tests.
Not the cleanest, but it's a start.
Diffstat (limited to 'mbld')
-rw-r--r-- | mbld/subtest.myr | 28 | ||||
-rw-r--r-- | mbld/types.myr | 6 |
2 files changed, 27 insertions, 7 deletions
diff --git a/mbld/subtest.myr b/mbld/subtest.myr index f631895..7dfeb62 100644 --- a/mbld/subtest.myr +++ b/mbld/subtest.myr @@ -18,7 +18,7 @@ var footpat const __init__ = { planpat = std.try(regex.compile("MTEST\\s+(-?\\d+)\\s*")) headpat = std.try(regex.compile("test\\s+(.*)<<{!\\s*")) - footpat = std.try(regex.compile("!}>>\\s*(ok|fail|timing)\\s*(.*)\\s*")) + footpat = std.try(regex.compile("!}>>\\s*(ok|fail|timing|skip)\\s*(.*)\\s*")) } const showsub = {b, cmd, fd, logfd, failed @@ -92,6 +92,9 @@ const showtests = {b, cmd, failed, f, log, ntests | `std.Some `Timing (niter, avg, stddev): showbench(b, &curtest, &nresults, niter, avg, stddev) continue + | `std.Some `Skip: + skiptest(b, &curtest, &nresults) + continue | `std.Some `Pass: passtest(b, &curtest, &nresults) continue @@ -123,11 +126,20 @@ const showtests = {b, cmd, failed, f, log, ntests } const checktests = {ntests, nresults - if ntests > 0 && ntests != nresults - mbldput("mismatched test count: expected {}, got {}\n", ntests, nresults) - -> false + /* + FIXME: ugly hack. + we don't currently print subtests all the time, so we don't check + plan count here. + */ + match std.getenv("MTEST_SUBSET") + | `std.Some _: -> true + | `std.None: + if ntests > 0 && ntests != nresults + mbldput("mismatched test count: expected {}, got {}\n", ntests, nresults) + -> false + ;; + -> true ;; - -> true } const starttest = {curtest, t @@ -138,6 +150,11 @@ const starttest = {curtest, t curtest# = t } +const skiptest = {b, curtest, nresults + donetest(b, curtest, nresults) + mbldput("SKIP\n") +} + const passtest = {b, curtest, nresults donetest(b, curtest, nresults) mbldput("PASS\n") @@ -217,6 +234,7 @@ const testfoot = {ln match regex.exec(footpat, ln) | `std.Some m: match m[1] + | "skip": -> `std.Some `Skip | "timing": -> parsetiming(m[2]) | "ok": -> `std.Some `Pass | "fail": -> `std.Some `Fail std.sldup(m[2]) diff --git a/mbld/types.myr b/mbld/types.myr index e170b00..03bb151 100644 --- a/mbld/types.myr +++ b/mbld/types.myr @@ -36,8 +36,9 @@ pkg bld = dir : byte[:] inputs : byte[:][:] - libdeps : (byte[:], byte[:], byte[:])[:] /* dir, lib, targname */ - tstdeps : (byte[:], byte[:], byte[:])[:] /* dir, lib, targname */ + /* dir, lib, targname */ + libdeps : (byte[:], byte[:], byte[:])[:] + tstdeps : (byte[:], byte[:], byte[:])[:] runtime : byte[:] incpath : byte[:][:] tags : byte[:][:] @@ -87,6 +88,7 @@ pkg bld = ;; type testresult = union + `Skip `Pass `Fail byte[:] `Timing (int, flt64, flt64) |