shithub: mc

Download patch

ref: b866f72bea03c0ee457d73abeb64db185958ddb2
parent: 6d7c80f8d5efcba00ebd44d34fd7b613f4672829
author: Ori Bernstein <ori@eigenstate.org>
date: Mon May 23 20:03:08 EDT 2016

Run myrddin tests as subtests.

--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,6 @@
 include config.mk
 
 check: all
-	./mbldwrap.sh test:runtest
 	./mbldwrap.sh test
 
 .PHONY: bench
--- a/test/bld.sub
+++ b/test/bld.sub
@@ -1,1 +1,1 @@
-cmd runtest = ./runtest.sh ;;
+cmd runtest {test} = ./runtest.sh ;;
--- a/test/runtest.sh
+++ b/test/runtest.sh
@@ -9,96 +9,100 @@
 NPASSES=0
 
 function build {
-    rm -f $1 $1.o $1.s $1.use
-    mbld -b $1 -C../6/6m -M../muse/muse -I../lib/std -I../lib/sys -r../rt/_myrrt.o $1.myr
+	rm -f $1 $1.o $1.s $1.use
+	mbld -b $1 -C../6/6m -M../muse/muse -I../lib/std -I../lib/sys -r../rt/_myrrt.o $1.myr
 }
 
 function pass {
-    PASSED="$PASSED $1"
-    NPASSED=$[$NPASSED + 1]
+	PASSED="$PASSED $1"
+	NPASSED=$[$NPASSED + 1]
+	echo "!}>> ok"
 }
 
 function fail {
-    echo "FAIL: $1"
-    FAILED="$FAILED $1"
-    NFAILED=$[$NFAILED + 1]
+	FAILED="$FAILED $1"
+	NFAILED=$[$NFAILED + 1]
+	echo "!}>> fail $1"
 }
 
 function expectstatus {
-    ./$1 $3
-    if [ $? -eq $2 ]; then
-        pass $1
-        return
-    else
-        fail $1
-    fi
+	./$1 $3
+	if [ $? -eq $2 ]; then
+		pass $1
+		return
+	else
+		fail $1
+	fi
 }
 
 function expectprint {
-    if [ "`./$1 $3`" != "$2" ]; then
-        fail $1
-    else
-        pass $1
-    fi
+	if [ "`./$1 $3`" != "$2" ]; then
+		fail $1
+	else
+		pass $1
+	fi
 }
 
 function expectcompare {
-    if [ x"" !=  x"$TMPDIR" ]; then 
-        t=$TMPDIR/myrtest-$1-$RANDOM
-    else
-        t=/tmp/myrtest-$1-$RANDOM
-    fi
-    ./$1 $3 > $t
-    if cmp $t data/$1-expected; then
-        pass $1
-    else
-        fail $1
-    fi
-    rm -f $t
+	if [ x"" !=  x"$TMPDIR" ]; then 
+		t=$TMPDIR/myrtest-$1-$RANDOM
+	else
+		t=/tmp/myrtest-$1-$RANDOM
+	fi
+	./$1 $3 > $t
+	if cmp $t data/$1-expected; then
+		pass $1
+	else
+		fail $1
+	fi
+	rm -f $t
 }
 
 function expectfcompare {
-    ./$1 $3
-    if cmp data/$1-expected $2; then
-        pass $1
-    else
-        fail $1
-    fi
+	./$1 $3
+	if cmp data/$1-expected $2; then
+		pass $1
+	else
+		fail $1
+	fi
 }
 
 # Should build and run
 function B {
-    test="$1"; shift
-    type="$1"; shift
-    res="$1"; shift
-    if [ $# > 0 ]; then
-        args="$1"; shift
-    fi
-    build $test
-    case $type in
-    "E")  expectstatus "$test" "$res";;
-    "P")  expectprint "$test" "$res";;
-    "C")  expectcompare "$test" "$res";;
-    "F")  expectfcompare "$test" "$res" "$args";;
-    esac
+	test="$1"; shift
+	type="$1"; shift
+	res="$1"; shift
+	if [ $# > 0 ]; then
+		args="$1"; shift
+	fi
+	echo "test $test <<{!"
+	build $test
+	case $type in
+	"E")  expectstatus "$test" "$res";;
+	"P")  expectprint "$test" "$res";;
+	"C")  expectcompare "$test" "$res";;
+	"F")  expectfcompare "$test" "$res" "$args";;
+	esac
 }
 
 # Should fail
 function F {
-    (build $1) > /dev/null
-    if [ $? -eq '1' ]; then
-        pass $1
-    else
-        fail $1
-    fi
+	echo "test $test <<{!"
+	(build $1) > /dev/null 2>1
+	if [ $? -eq '1' ]; then
+		pass $1
+	else
+		fail $1
+	fi
 }
 
+echo "MTEST $(egrep '^[BF]' tests | wc -l)"
 source tests
 
 echo "PASSED ($NPASSED): $PASSED"
 if [ -z "$NFAILED" ]; then
-    echo "SUCCESS"
+	echo "SUCCESS"
 else
-    echo "FAILURES ($NFAILED): $FAILED"
-    exit 1
+	echo "FAILURES ($NFAILED): $FAILED"
+	exit 1
 fi
--- a/test/tests
+++ b/test/tests
@@ -15,6 +15,7 @@
 #	C tells us that the result is on stdout,
 #         and should be compared to the contents of
 #         the file passed on the line.
+#       D 
 #    result: Result value
 #	What we compare with. This should be self-
 #	evident.
@@ -137,7 +138,7 @@
 B strsplit	C
 B strfind	C
 B strjoin	C
-B exporttrait
+B exporttrait	E	0
 B local-labels	E	10
 F declmismatch
 F infermismatch
@@ -153,7 +154,7 @@
 F badop
 B voideffect	P	pass
 B foroptexpr	P	pass
-B bounds	E	134
+#B bounds	D	134
 B rvaldotlen	P	pass
 B destructuretup	E	0
 B nestedgoto	E	0