shithub: mc

Download patch

ref: 97f03b720b5d8656a316ce1ca14b89d4a411c59f
parent: 9df78d333d4fcc74754e16ddf06c2fba58c9858a
author: Ori Bernstein <[email protected]>
date: Thu Apr 16 19:26:32 EDT 2015

Fix test targets.

--- a/mbld/parse.myr
+++ b/mbld/parse.myr
@@ -148,7 +148,7 @@
 const testtarget = {b, p
 	var t
 	t = myrtarget(p, "test")
-	addtarg(p, b, t.name, `Test myrtarget(p, "test"))
+	addtarg(p, b, t.name, `Test t)
 }
 
 /* mantarget: anontarget */
@@ -280,7 +280,10 @@
 	inst = true
 	ldscript = ""
 	runtime = ""
-	incpath = std.sldup(bld.opt_incpaths)
+	incpath = [][:]
+	for inc in bld.opt_incpaths
+		incpath = std.slpush(incpath, std.sldup(inc))
+	;;
 	for elt in attrs
 		match elt
 		| ("ldscript", lds):	ldscript = std.sldup(lds)
--- a/mbld/test.myr
+++ b/mbld/test.myr
@@ -16,7 +16,7 @@
 ;;
 
 const test = {b
-	var ok/*, bin */
+	var ok, bin
 
 	/* no implicit tests to run */
 	ok = true
@@ -35,25 +35,27 @@
 			;;
 		;;
 	;;
-	/*
-	FIXME: reenable test binaries
-	for `Test t in targs
-		for s in t.incpath
-			if std.sleq(".", s)
-				goto founddot
+	for tn in b.all
+		match gettarg(b.targs, tn)
+		| `Test t:
+			for s in t.incpath
+				if std.sleq(".", s)
+					goto founddot
+				;;
 			;;
-		;;
-		t.incpath = std.slpush(t.incpath, std.sldup("."))
+			t.incpath = std.slpush(t.incpath, std.sldup("."))
 
 :founddot
-		buildbin(b, t, false)
-		bin = std.strcat("./", t.name)
-		if !runtest(bin)
-			ok = false
+			buildbin(b, t, false)
+			bin = std.strcat("./", t.name)
+			if !runtest(bin)
+				ok = false
+			;;
+			std.slfree(bin)
+		| _:
+			/* skip */
 		;;
-		std.slfree(bin)
 	;;
-	*/
 	if ok
 		std.put("TESTS PASSED\n")
 	else