ocaml/test/testinterp/runtest.mpw

106 lines
2.4 KiB
Plaintext
Raw Normal View History

#########################################################################
# #
# 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><3E>
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]+)<29>0/
shift
set start {<7B>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]+)<29>1<EFBFBD>)<29>0.ml/
shift
continue
end
set base "{<7B>0}"
if {<7B>1} < {start}
shift
continue
end
if {<7B>1} >= 300
set libs "lib.ml stdlib.cma"
else if {<7B>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}" !~ /<2F> [<5B>']*"{f}"[<5B>']* <20>/
Open "{f}"
Set _closeit 1
else
set _closeit 0
End
find <20> "{f}"
find <20>\'**)'\:\'(**'\<5C> "{f}"
echo >"{f}".<2E>
ocamldumpobj a.out >>"{f}".<2E>
find <20> "{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}"