shithub: mc

Download patch

ref: bc9ee15fdd4a4c961bac0de2f4f9c4fceccd4a86
parent: 65c02369b7b2c94e3832bb2a333b98bca852ada6
author: Ori Bernstein <[email protected]>
date: Wed Jan 31 06:41:59 EST 2018

Teach mbld how to parse skipped tests.

	Not the cleanest, but it's a start.

--- a/mbld/subtest.myr
+++ b/mbld/subtest.myr
@@ -18,7 +18,7 @@
 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 @@
 		| `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 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 @@
 	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 @@
 	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])
--- a/mbld/types.myr
+++ b/mbld/types.myr
@@ -36,8 +36,9 @@
 		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 @@
 	;;
 
 	type testresult = union
+		`Skip
 		`Pass
 		`Fail byte[:]
 		`Timing (int, flt64, flt64)