summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2016-05-24 00:03:08 -0700
committerOri Bernstein <ori@eigenstate.org>2016-05-24 00:04:08 -0700
commitb866f72bea03c0ee457d73abeb64db185958ddb2 (patch)
tree0ac514f96d99e54fe874edd7fb7145e22f259514 /test
parent6d7c80f8d5efcba00ebd44d34fd7b613f4672829 (diff)
downloadmc-b866f72bea03c0ee457d73abeb64db185958ddb2.tar.gz
Run myrddin tests as subtests.
Diffstat (limited to 'test')
-rw-r--r--test/bld.sub2
-rwxr-xr-xtest/runtest.sh122
-rw-r--r--test/tests5
3 files changed, 67 insertions, 62 deletions
diff --git a/test/bld.sub b/test/bld.sub
index 3a4993c..b206e06 100644
--- a/test/bld.sub
+++ b/test/bld.sub
@@ -1 +1 @@
-cmd runtest = ./runtest.sh ;;
+cmd runtest {test} = ./runtest.sh ;;
diff --git a/test/runtest.sh b/test/runtest.sh
index 538027b..a60f835 100755
--- a/test/runtest.sh
+++ b/test/runtest.sh
@@ -9,96 +9,100 @@ NFAILURES=0
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
diff --git a/test/tests b/test/tests
index 60f6619..9e58d00 100644
--- 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 strstrip C
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 arityhigh
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