summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormihaylov <mihaylov@epfl.ch>2003-12-03 18:21:52 +0000
committermihaylov <mihaylov@epfl.ch>2003-12-03 18:21:52 +0000
commit56945b9d09cb3cf7b0ce3f91b86b640c32d99a89 (patch)
treeb23294e1d74792f77ca275ae1d9c0057b5734845
parentdcbe9fae574effb9e98f913c66aa5dfbca6d7a61 (diff)
downloadscala-56945b9d09cb3cf7b0ce3f91b86b640c32d99a89.tar.gz
scala-56945b9d09cb3cf7b0ce3f91b86b640c32d99a89.tar.bz2
scala-56945b9d09cb3cf7b0ce3f91b86b640c32d99a89.zip
- added support for testing the .NET backend; t...
- added support for testing the .NET backend; the test is not performed by default and has to be enabled with the --msil command line switch
-rwxr-xr-xtest/bin/scala-test47
1 files changed, 45 insertions, 2 deletions
diff --git a/test/bin/scala-test b/test/bin/scala-test
index fb0e92d48c..263cfdb1b5 100755
--- a/test/bin/scala-test
+++ b/test/bin/scala-test
@@ -182,6 +182,37 @@ test_compilation_failure() {
)
}
+test_msil() {
+ IL_FILE="prog.il"
+ PE_FILE="prog.EXE"
+
+ ILASM=ilasm
+ ILASM_ARGS="/qui /nol /out=${PE_FILE}"
+
+ PEVERIFY=peverify
+ PEVERIFY_ARGS="/il"
+
+ rm -f $IL_FILE
+ rm -f $PE_FILE
+
+ $SOCOS -target:msil $FLAGS "$source" &&
+
+ ${ILASM} ${ILASM_ARGS} ${IL_FILE} > /dev/null &&
+ if [ ! $? ] ; then
+ echo "'$ILASM' failed!"
+ return 1
+ fi
+
+# $PEVERIFY $PEVERIFY_ARGS $PE_FILE > /dev/null
+# if [ ! $? ] ; then
+# echo "'$PEVERIFY' failed!"
+# rm -rf $PE_FILE
+# return 1
+# fi
+
+ eval ./$PE_FILE
+}
+
test_output() {
if [ -f "$expect" ]; then
$DIFF "$actual" "$expect";
@@ -193,7 +224,10 @@ test_output() {
test_file() {
source="$FILE";
flags="`expr "$source" : "\(.*\)\\.scala"`.flags";
- expect="`expr "$source" : "\(.*\)\\.scala"`.check";
+ expect="`expr "$source" : "\(.*\)\\.scala"`-$KIND.check";
+ if [ ! -f $expect ]; then
+ expect="`expr "$source" : "\(.*\)\\.scala"`.check";
+ fi;
actual="`expr "$source" : "\(.*\)\\.scala"`-$KIND.log";
if [ -f "$flags" ]; then
TEST_FLAGS=`cat $flags`;
@@ -270,6 +304,8 @@ test_all() {
test_compilation_success "pos" $FILES_POS;
test_one "Testing compiler (on files whose compilation should fail)" \
test_compilation_failure "neg" $FILES_NEG;
+ test_one "Testing msil backend" \
+ test_msil "msil" $FILES_MSIL;
}
##############################################################################
@@ -289,6 +325,7 @@ print_help() {
echo "--xml next files test the dtd2scala tool";
echo "--pos next files test a compilation success";
echo "--neg next files test a compilation failure";
+ echo "--msil next files test the .NET backend (requires Cygwin)"
echo "--boot use bootstrap compiler";
echo "--no-run run no test, use results of last run";
echo "--show-log show output of failed tests";
@@ -390,6 +427,7 @@ add_file() {
xml ) FILES_XML="$FILES_XML $1"; return;;
pos ) FILES_POS="$FILES_POS $1"; return;;
neg ) FILES_NEG="$FILES_NEG $1"; return;;
+ msil ) FILES_MSIL="$FILES_MSIL $1"; return;;
* ) abort "unknown test type \`$TEST_TYPE'";;
esac;
case "$1" in
@@ -420,13 +458,14 @@ main() {
FILES_XML="";
FILES_POS="";
FILES_NEG="";
+ FILES_MSIL="";
CYGWIN="false";
DIFF="diff"
case `uname` in
CYGWIN* )
CYGWIN="true";
- DIFF="diff --strip-trailing-cr";
+ DIFF="diff --text --strip-trailing-cr";
;;
esac
@@ -439,6 +478,7 @@ main() {
--xml ) TEST_TYPE="xml"; shift 1;;
--pos ) TEST_TYPE="pos"; shift 1;;
--neg ) TEST_TYPE="neg"; shift 1;;
+ --msil ) TEST_TYPE="msil"; shift 1;;
--boot ) BOOT="true"; shift 1;;
--no-run ) NORUN="true"; shift 1;;
--show-log ) SHOWLOG="true"; shift 1;;
@@ -502,6 +542,9 @@ main() {
case "$TEST_TYPE" in
auto | neg ) FILES_NEG="$FILES_NEG $PREFIX/neg";;
esac;
+ case "$TEST_TYPE" in
+ msil ) FILES_MSIL="$FILES_MSIL $SRCDIR/run";;
+ esac;
fi;
if [ -d "$OBJDIR" ]; then