[PATCH 8/9] Allow runtest.{rc,sh} to handle subdirectories.
[Thread Prev] | [Thread Next]
- Subject: [PATCH 8/9] Allow runtest.{rc,sh} to handle subdirectories.
- From: "S. Gilles" <sgilles@xxxxxxx>
- Reply-to: myrddin-dev@xxxxxxxxxxxxxx
- Date: Mon, 8 Jun 2020 00:21:15 -0400
- To: "myrddin-dev" <myrddin-dev@xxxxxxxxxxxxxx>
- Cc: "S. Gilles" <sgilles@xxxxxxx>
This allows tests consisting of multiple files, including .glue.c files,
so we can check calling convention compliance.
---
test/runtest.rc | 23 +++++++++++++++++++----
test/runtest.sh | 28 +++++++++++++++++++++-------
test/tests | 9 ++++++---
3 files changed, 46 insertions(+), 14 deletions(-)
diff --git a/test/runtest.rc b/test/runtest.rc
index 0b3e80bc..e6aaf5a6 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 4c649f60..f7dc5208 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 cb496e15..6036e7f1 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,
--
2.26.2
| [PATCH 0/9] Handle small-aggregates via AMD64 abi | "S. Gilles" <sgilles@xxxxxxx> |
- Prev by Date: [PATCH 6/9] Return small-aggregate values by the AMD64 abi.
- Next by Date: [PATCH 9/9] Add tests for abi conformity.
- Previous by thread: [PATCH 6/9] Return small-aggregate values by the AMD64 abi.
- Next by thread: [PATCH 9/9] Add tests for abi conformity.
- Index(es):