summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorS. Gilles <sgilles@umd.edu>2020-06-20 21:55:43 -0400
committerS. Gilles <sgilles@umd.edu>2020-06-24 12:12:00 -0400
commit2b398fd1053b03888f400011dda46d4e36986876 (patch)
tree809c1361d82831e69843d8bd845f15a9c0b639db
parentbdf0ed62196f1e67d65b3346ae45d1a0e322bd00 (diff)
downloadmc-2b398fd1053b03888f400011dda46d4e36986876.tar.gz
Allow runtest.{rc,sh} to handle subdirectories.
This allows tests consisting of multiple files, including .glue.c files, so we can check calling convention compliance.
-rwxr-xr-xtest/runtest.rc23
-rwxr-xr-xtest/runtest.sh28
-rw-r--r--test/tests9
3 files changed, 46 insertions, 14 deletions
diff --git a/test/runtest.rc b/test/runtest.rc
index 0b3e80b..e6aaf5a 100755
--- a/test/runtest.rc
+++ b/test/runtest.rc
@@ -1,11 +1,22 @@
#!/bin/rc
rfork e
-MYR_MC=../6/6.out
-MYR_MUSE=../muse/6.out
+MYR_MC=`{cd .. ; pwd}^/6/6.out
+MYR_MUSE=`{cd .. ; pwd}^/muse/6.out
fn build {
- rm -f $1 $1^.6 $1^.use
- ../obj/mbld/mbld -Bnone -o 'out' -b $1 -I../obj/lib/std -I../obj/lib/sys -I../obj/lib/regex -r../rt/_myrrt.6 $1^.myr
+ dir=`{echo $1 | grep '.*/'}
+ if(~ $dir '') {
+ rm -f $1 $1^.6 $1^.use
+ ../obj/mbld/mbld -Bnone -o 'out' -b $1 -I../obj/lib/std -I../obj/lib/sys -I../obj/lib/regex -r../rt/_myrrt.6 $1^.myr
+ }
+ if not {
+ target=`{echo $1 | grep -o '[^/]*$'}
+ top=`{pwd}
+ mkdir -p out/$dir
+ cd $dir
+ $top/../obj/mbld/mbld -Bnone -o $top/out/$dir -I$top/../obj/lib/std -I$top/../obj/lib/sys -I$top/../obj/lib/regex -r$top/../rt/_myrrt.o clean
+ $top/../obj/mbld/mbld -Bnone -o $top/out/$dir -I$top/../obj/lib/std -I$top/../obj/lib/sys -I$top/../obj/lib/regex -r$top/../rt/_myrrt.o :$target
+ }
}
fn pass {
@@ -62,7 +73,9 @@ fn B {
res=$1; shift
echo 'test' $test '<<{!'
+ here=`{pwd}
build $test
+ cd $here
switch($type) {
case E
expectstatus $test $res
@@ -77,11 +90,13 @@ fn B {
fn F {
echo 'test ' ^ $1 '<<{!'
+ here=`{pwd}
@{ build $1 } >[2=1]
if (~ $status '')
fail $1
if not
pass $1
+ cd $here
}
echo 'MTEST ' `{grep '^[BF]' tests | wc -l}
diff --git a/test/runtest.sh b/test/runtest.sh
index 4c649f6..f7dc520 100755
--- a/test/runtest.sh
+++ b/test/runtest.sh
@@ -1,15 +1,25 @@
#!/bin/sh
-export PATH=.:$PATH
-export MYR_MC=../6/6m
-export MYR_MUSE=../muse/muse
+export PATH=$(pwd):$PATH
+export MYR_MC=$(cd ..; pwd)/6/6m
+export MYR_MUSE=$(cd ..; pwd)/muse/muse
ARGS=$*
NFAILURES=0
NPASSES=0
build() {
- rm -f out/$1 out/$1.o out/$1.s out/$1.use
- mkdir -p out
- ../obj/mbld/mbld -Bnone -o 'out' -b $1 -I../obj/lib/std -I../obj/lib/sys -I../obj/lib/regex -r../rt/_myrrt.o $1.myr
+ dir=$(echo $1 | egrep -o '.*/')
+ if [ -z $dir ]; then
+ rm -f out/$1 out/$1.o out/$1.s out/$1.use
+ mkdir -p out
+ ../obj/mbld/mbld -Bnone -o 'out' -b $1 -I../obj/lib/std -I../obj/lib/sys -I../obj/lib/regex -r../rt/_myrrt.o $1.myr
+ else
+ target=$(echo $1 | egrep -o '[^/]*$')
+ top=$(pwd)
+ mkdir -p out/$dir
+ cd $dir
+ $top/../obj/mbld/mbld -Bnone -o $top/out/$dir -I$top/../obj/lib/std -I$top/../obj/lib/sys -I$top/../obj/lib/regex -r$top/../rt/_myrrt.o clean
+ $top/../obj/mbld/mbld -Bnone -o $top/out/$dir -I$top/../obj/lib/std -I$top/../obj/lib/sys -I$top/../obj/lib/regex -r$top/../rt/_myrrt.o :$target
+ fi
}
pass() {
@@ -95,7 +105,9 @@ B() {
args="$1"; shift
fi
echo "test $test <<{!"
+ here=$(pwd)
build $test
+ cd $here
case $type in
"E") expectstatus "$test" "$res";;
"P") expectprint "$test" "$res";;
@@ -111,12 +123,14 @@ F() {
fi
echo "test $1 <<{!"
- (build $1) > /dev/null 2>1
+ here=$(pwd)
+ (build $1) > /dev/null 2>&1
if [ $? -eq '1' ]; then
pass $1
else
fail $1
fi
+ cd $here
}
echo "MTEST $(egrep '^[BF]' tests | wc -l)"
diff --git a/test/tests b/test/tests
index cb496e1..6036e7f 100644
--- a/test/tests
+++ b/test/tests
@@ -4,9 +4,12 @@
# B: Expect that this test will build.
# F: Expect that this test will not build.
# testname: Test case
-# The test that will run. We will try to
-# compile 'testname.myr' to 'testname',
-# and then execute it, verifying the result
+# The test that will run. If testname contains
+# no '/', we will try to compile 'testname.myr'
+# to 'testname', and then execute it, verifying the
+# result. If the testname is of form a/b/c/.../y/z,
+# we will try to mbld target z located in subdir
+# a/b/c/.../y and execute, again verifying.
# [E|P|C]: Result type
# E tells us that the result is an exit status
# P tells us that the result is on stdout,