ocaml/test/testinterp/runtest.mpw

106 lines
2.4 KiB
Plaintext

#########################################################################
# #
# Objective Caml #
# #
# Damien Doligez, projet Para, INRIA Rocquencourt #
# #
# Copyright 1999 Institut National de Recherche en Informatique et #
# en Automatique. All rights reserved. This file is distributed #
# under the terms of the Q Public License version 1.0. #
# #
#########################################################################
# $Id$
# usage: runtest.mpw [-bc] [-run <runtime>] [-start <n>] <file>É
set echo 0
exit if {#} < 1
set dobytecode 0
set dorun 0
set start 0
loop
if "{1}" == "-bc"
set dobytecode 1
else if "{1}" == "-run"
set dorun 1
set runtime "{2}"
shift
else if "{1}" == "-start"
if "{2}" =~ /0*([0-9]+)¨0/
shift
set start {¨0}
else
echo "### runtest.mpw: option "-start" expects a number as argument" > dev:stderr
exit 2
end
else
break
end
shift
end
set _camlrunparam "{camlrunparam}"
loop
break if {#} == 0
if "{1}" !~ /(t0*([0-9]+)¨1Å)¨0.ml/
shift
continue
end
set base "{¨0}"
if {¨1} < {start}
shift
continue
end
if {¨1} >= 300
set libs "lib.ml stdlib.cma"
else if {¨1} >= 51
set libs "lib.ml"
else
set libs ""
end
set -e camlrunparam v=0
ocamlc -unsafe -nopervasives {libs} "{1}" || (shift; continue)
if {dobytecode}
Set f "`Files -f -q "{1}"`" # get full pathnames
Set _openWindows " ``Windows -q`` "
If "{_openWindows}" !~ /Å [¶']*"{f}"[¶']* Å/
Open "{f}"
Set _closeit 1
else
set _closeit 0
End
find ° "{f}"
find Æ\'**)'\:\'(**'\Æ "{f}"
echo >"{f}".¤
ocamldumpobj a.out >>"{f}".¤
find ¥ "{f}"
if {_closeit}
close -y "{f}"
end
end
if {dorun}
set -e camlrunparam "{_camlrunparam}"
echo "{runtime} :a.out ### testing {1}"
"{runtime}" :a.out || if "{1}" != "t060-raise.ml"; exit 3; end
echo "### done"
end
delete -i "{base}".cmi "{base}".cmo
shift
end
set -e camlrunparam "{_camlrunparam}"