shithub: mc

Download patch

ref: fb88daaedf549fd7e232c7c44d7b37e5f11ec4fc
parent: f66159ce8e05236160a26aacf3facdb94d50077e
author: Ori Bernstein <ori@eigenstate.org>
date: Thu Dec 25 17:11:53 EST 2014

Get testing closer to working on plan9.

--- a/libstd/syswrap+plan9-x64.myr
+++ b/libstd/syswrap+plan9-x64.myr
@@ -92,13 +92,11 @@
 	var n, i, idx
 	
 	if status == 0
-		sys.pwrite(1, "exit(0)ing\n", -1)
 		sys.exits("")
 	else
 		status &= 255
 		i = 100
 		n = 0
-		sys.pwrite(1, "...formatting\n", -1)
 		while i > 0
 			if i > status
 				continue
@@ -108,8 +106,6 @@
 			buf[n++] = digitchars[idx];
 			i /= 10
 		;;
-		sys.pwrite(1, "done...", -1)
-		sys.pwrite(1, buf[:n], -1)
 		sys.exits(buf[:n])
 	;;
 }
--- a/mkfile
+++ b/mkfile
@@ -44,7 +44,7 @@
 	echo '#define Instroot "'/'"' > config.h
 	echo '#define Asmcmd {"6a", "-o", NULL}' >> config.h
 	echo '#define Arcmd {"ar", "ru", NULL}' >> config.h
-	echo '#define Ldcmd {"6l", "-l", NULL}' >> config.h
+	echo '#define Ldcmd {"6l", "-l", "-o", NULL}' >> config.h
 	echo '#define Symprefix ""' >> config.h
 	echo '#define Defaultasm Plan9' >> config.h
 
--- /dev/null
+++ b/test/runtest.rc
@@ -1,0 +1,94 @@
+#!/bin/rc
+passed=""
+failed=""
+npassed=0
+nfailed=0
+
+fn build {
+	rm -f $1 $1^.o $1^.s $1^.use
+	../myrbuild/6.out -b $1 -C../6/6.out -M../muse/6.out -I../libstd -r../rt/_myrrt.6 $1^.myr
+}
+
+fn pass {
+	passed=$passed ^ " " ^ $1
+}
+
+fn fail {
+	echo FAIL: $1
+	failed=$failed ^ " " ^ $1
+}
+
+fn expectstatus {
+	./$1 $3
+	if(~ $status $2){
+		pass $1
+		return
+	}
+	if not {
+		fail $1
+	}
+}
+
+fn expectprint {
+	if(~ "`{./$1 $3}" "$2")
+		pass $1
+	if not
+		fail $1
+}
+
+fn expectcmp {
+	t="/tmp/myrtest-$1"
+	rm -f $t
+	./$1 $3 > $t
+	if (cmp $t data/$1-expected)
+		pass $1
+	if not
+		fail $1
+}
+
+fn expectfcmp {
+	t="/tmp/myrtest-$1"
+	rm -f $t
+	./$1 $3
+	if (cmp $2 data/$1-expected)
+		pass $1
+	if not
+		fail $1
+}
+
+fn B {
+	test=$1; shift
+	type=$1; shift
+	args=$1; shift
+
+	build $test
+	switch($type) {
+	case "E"
+		expectstatus $test $res
+	case "P"
+		expectprint $test $res
+	case "C"
+		expectcmp $test $res
+	case "F"
+		expectfcmp $test $res
+	}
+}
+
+fn F {
+	@{ build $1 } > /dev/null
+	if (~ $status "")
+		fail $1
+	if not
+		pass $1
+}
+
+
+. tests
+
+echo "PASSED $passed"
+if(~ $failed "")
+	echo SUCCESS
+if not
+	echo "FAILURES $failed"
+
+
--- a/test/runtest.sh
+++ b/test/runtest.sh
@@ -77,9 +77,9 @@
     fi
     build $test
     case $type in
-    "E")  expectstatus "$test" "$res" "$input";;
-    "P")  expectprint "$test" "$res" "$input";;
-    "C")  expectcompare "$test" "$res" "$input";;
+    "E")  expectstatus "$test" "$res";;
+    "P")  expectprint "$test" "$res";;
+    "C")  expectcompare "$test" "$res";;
     "F")  expectfcompare "$test" "$res" "$args";;
     esac
 }
--- a/test/tests
+++ b/test/tests
@@ -88,8 +88,8 @@
 B genericret	E	42
 B genericmatch	E	15
 B genericrec	E	0
-# B genericchain	P	"val = 123" ## BUGGERED
-B genericmake	P	"val = 123"
+# B genericchain	P	'val = 123' ## BUGGERED
+B genericmake	P	'val = 123'
 B genericuret	E	42
 B stdopt-some	E	42
 B stdopt-none	E	42