Revamped testing framework
This commit is contained in:
parent
1113fd7ec1
commit
6b4881ccd0
|
@ -573,7 +573,7 @@ and typing_app statefull h op e_list =
|
||||||
params in
|
params in
|
||||||
let expected_ty_list = List.map (subst_type_vars m) expected_ty_list in
|
let expected_ty_list = List.map (subst_type_vars m) expected_ty_list in
|
||||||
let typed_e_list = typing_args statefull h expected_ty_list e_list in
|
let typed_e_list = typing_args statefull h expected_ty_list e_list in
|
||||||
let size_constrs =
|
let size_constr =
|
||||||
instanciate_constr m ty_desc.node_params_constraints in
|
instanciate_constr m ty_desc.node_params_constraints in
|
||||||
let result_ty_list = List.map (subst_type_vars m) result_ty_list in
|
let result_ty_list = List.map (subst_type_vars m) result_ty_list in
|
||||||
List.iter add_size_constraint size_constrs;
|
List.iter add_size_constraint size_constrs;
|
||||||
|
|
336
test/check
336
test/check
|
@ -1,12 +1,14 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# TODO: rewrite in OCaml or something better than sh
|
||||||
|
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
|
||||||
# script de test
|
# script de test
|
||||||
|
|
||||||
compilo=../compiler/heptc.byte
|
compilo=../compiler/heptc.native
|
||||||
coption=
|
coption=
|
||||||
|
|
||||||
# compilateurs utilises pour les tests de gen. de code
|
# compilateurs utilises pour les tests de gen. de code
|
||||||
|
@ -15,66 +17,72 @@ CAMLC=ocamlc
|
||||||
JAVAC=javac
|
JAVAC=javac
|
||||||
LUSTREC=lustre
|
LUSTREC=lustre
|
||||||
CC=gcc
|
CC=gcc
|
||||||
MLC=mlc
|
|
||||||
VHDLC=ghdl
|
|
||||||
|
|
||||||
# par defaut : pas de test de generation de code
|
# par defaut : pas de test de generation de code
|
||||||
|
|
||||||
caml=0
|
|
||||||
java=0
|
java=0
|
||||||
lustre=0
|
|
||||||
c=0
|
c=0
|
||||||
cold=0
|
|
||||||
minils=0
|
|
||||||
vhdl=0
|
|
||||||
|
|
||||||
score=0
|
score=0
|
||||||
max=0
|
max=0
|
||||||
verbose=0
|
verbose=0
|
||||||
|
|
||||||
for d in good bad; do
|
for d in good bad; do
|
||||||
rm -f -r $d/*.obc $d/*_java $d/*_c $d/*_c-old\
|
rm -f -r $d/*.obc $d/*_java $d/*_c $d/*.mci $d/*.mls $d/*.epci
|
||||||
$d/*.mci $d/*.mls $d/*.epci\
|
|
||||||
$d/*.lus $d/*.ml $d/*.cmi $d/*.cmo;
|
|
||||||
done
|
done
|
||||||
|
|
||||||
#rm -f inline/good/*.ml inline/good/*.cmi inline/good/*.cmo \
|
|
||||||
# inline/good/*.dcc inline/good/*.lci inline/good/a.out
|
|
||||||
#../util/split sujet1/bad/bad.split
|
|
||||||
#../util/split sujet1/good/good.split
|
|
||||||
|
|
||||||
compile () {
|
compile () {
|
||||||
if [[ $verbose != 0 ]]; then
|
arg_comp=""
|
||||||
echo Compile -i $coption $1 $2
|
|
||||||
$compilo $coption -I good $1 $2;
|
assert_node=$(eval grep CHECK $1 | awk '{ print $3 }')
|
||||||
else
|
|
||||||
$compilo $coption -I good $1 $2 > /dev/null 2>&1;
|
if [ -n "$assert_node" ]; then
|
||||||
fi;
|
args_comp="-assert $assert_node"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $verbose != 0 ]; then
|
||||||
|
args_comp="$args_comp -v"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep "node main()" $1 >/dev/null; then
|
||||||
|
args_comp="$args_comp -s main"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $verbose != 0 ]; then
|
||||||
|
echo Compile -i $coption $1 $2 $args_comp
|
||||||
|
$compilo $coption -I good $1 $2 $args_comp
|
||||||
|
else
|
||||||
|
$compilo $coption -I good $args_comp $1 $2 >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
failed=$?
|
||||||
|
|
||||||
|
return $failed
|
||||||
}
|
}
|
||||||
|
|
||||||
launch_check () {
|
launch_check () {
|
||||||
|
|
||||||
score=0
|
score=0
|
||||||
max=0
|
max=0
|
||||||
|
|
||||||
echo "Test"
|
echo "Test"
|
||||||
|
|
||||||
# les mauvais
|
# les mauvais
|
||||||
echo -n "mauvais "
|
echo -n "bad "
|
||||||
for f in bad/*.ept ; do
|
for f in bad/*.ept ; do
|
||||||
echo -n ".";
|
echo -n ".";
|
||||||
max=`expr $max + 1`;
|
max=`expr $max + 1`;
|
||||||
if compile $f; then
|
if compile $f; then
|
||||||
echo
|
echo
|
||||||
echo "ECHEC sur "$f" (devrait echouer)";
|
echo "ERROR on "$f" (should fail to compile)";
|
||||||
else
|
else
|
||||||
score=`expr $score + 1`;
|
score=`expr $score + 1`;
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo
|
|
||||||
|
|
||||||
echo -n "bons"
|
echo
|
||||||
for f in good/*.ept; do
|
|
||||||
|
echo -n "bons"
|
||||||
|
for f in good/*.ept; do
|
||||||
echec=0
|
echec=0
|
||||||
echo -n ".";
|
echo -n ".";
|
||||||
max=`expr $max + 1`;
|
max=`expr $max + 1`;
|
||||||
|
@ -92,19 +100,12 @@ for f in good/*.ept; do
|
||||||
echec=2
|
echec=2
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# Compil. caml ?
|
|
||||||
if [[ ($echec == 0) && ($caml == 1) ]]; then
|
|
||||||
if $CAMLC -i good/${base_f}.ml > /dev/null; then
|
|
||||||
echec=0
|
|
||||||
else
|
|
||||||
echec=2
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
# Compil. java ?
|
# Compil. java ?
|
||||||
if [[ ($echec == 0) && ($java == 1) ]]; then
|
if [[ ($echec == 0) && ($java == 1) ]]; then
|
||||||
pushd "good/${base_f}" > /dev/null
|
pushd "good/${base_f}" > /dev/null
|
||||||
for java_file in *.java ; do
|
for java_file in *.java ; do
|
||||||
if $JAVAC -warn:-unused -sourcepath .:..:../t1 ${java_file} > /dev/null; then
|
if $JAVAC -warn:-unused -sourcepath .:..:../t1 ${java_file} > /dev/null
|
||||||
|
then
|
||||||
echec=${echec}
|
echec=${echec}
|
||||||
else
|
else
|
||||||
echec=3
|
echec=3
|
||||||
|
@ -112,236 +113,119 @@ for f in good/*.ept; do
|
||||||
done
|
done
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
fi
|
fi
|
||||||
# Compil. lustre ?
|
|
||||||
if [[ ($echec == 0) && ($lustre == 1) ]]; then
|
|
||||||
if $LUSTREC good/${base_f}.lus > /dev/null; then
|
|
||||||
echec=0
|
|
||||||
else
|
|
||||||
echec=4
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
# Compil. c ?
|
# Compil. c ?
|
||||||
if [[ ($echec == 0) && ($c == 1) ]]; then
|
if [[ ($echec == 0) && ($c == 1) ]]; then
|
||||||
pushd "good/${base_f}_c" > /dev/null
|
pushd good/${base_f}_c >/dev/null
|
||||||
for c_file in *.c ; do
|
for cf in *.c; do
|
||||||
if $CC -I ../t1_c -c ${c_file} > /dev/null 2>&1; then
|
if $CC -c $cf >/dev/null 2>&1; then
|
||||||
echec=${echec}
|
echec=$echec
|
||||||
else
|
else
|
||||||
echec=5
|
echec=5
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ $echec != 5 ]; then
|
||||||
|
if egrep "(node main\(\))|(CHECK)" ../${base_f}.ept >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
if $CC *.o -o ${base_f} 2>&1; then
|
||||||
|
echec=$echec
|
||||||
|
else
|
||||||
|
echec=6
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $echec != 6 ]; then
|
||||||
|
step_count=`grep CHECK ../$base_f.ept | awk '{ print $4 }'`
|
||||||
|
if [ -n "$step_count" ]; then
|
||||||
|
if ./${base_f} $step_count >/dev/null 2>&1; then
|
||||||
|
echec=${echec}
|
||||||
|
else
|
||||||
|
echec=7
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
popd >/dev/null
|
||||||
popd > /dev/null
|
|
||||||
fi
|
|
||||||
# Compil. c-old ?
|
|
||||||
if [[ ($echec == 0) && ($cold == 1) ]]; then
|
|
||||||
pushd "good/${base_f}_c-old" > /dev/null
|
|
||||||
for c_file in *.c ; do
|
|
||||||
if $CC -I ../t1_c-ng -c ${c_file} > /dev/null 2>&1; then
|
|
||||||
echec=${echec}
|
|
||||||
else
|
|
||||||
echec=6
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
popd > /dev/null
|
|
||||||
fi
|
|
||||||
if [[ ($echec == 0) && ($vhdl == 1) ]]; then
|
|
||||||
pushd "good/${base_f}_vhdl" > /dev/null
|
|
||||||
for vhdl_file in *.vhd; do
|
|
||||||
if $VHDLC -a ${vhdl_file} && $VHDLC -e ${vhdl_file} > /dev/null 2>&1
|
|
||||||
then
|
|
||||||
echec=${echec}
|
|
||||||
else
|
|
||||||
echec=7
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $echec == 0 ]]; then
|
if [[ $echec == 0 ]]; then
|
||||||
score=`expr $score + 1`;
|
score=`expr $score + 1`;
|
||||||
else
|
else
|
||||||
echo
|
echo
|
||||||
echo "ECHEC sur "$f" (devrait reussir)";
|
echo "ERROR on \"$f\" (should compile)";
|
||||||
case $echec in
|
case $echec in
|
||||||
1 )
|
1 )
|
||||||
echo "Echec de la compil. vers code objet";;
|
echo "Compilation to Obc failed.";;
|
||||||
2 )
|
3 )
|
||||||
echo "Echec de la compil. caml";;
|
echo "Compilation to Java failed.";;
|
||||||
3 )
|
5 )
|
||||||
echo "Echec de la compil. java";;
|
echo "Compilation to C failed.";;
|
||||||
4 )
|
6 )
|
||||||
echo "Echec de la compil. lustre";;
|
echo "Link failure.";;
|
||||||
5 )
|
7 )
|
||||||
echo "Echec de la compil. c";;
|
echo "Run-time assertion failure.";;
|
||||||
6 )
|
esac
|
||||||
echo "Echec de la compil. c-ng";;
|
|
||||||
7 )
|
|
||||||
echo "Echec de la compil. VHDL";;
|
|
||||||
esac
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo
|
echo
|
||||||
|
|
||||||
percent=`expr 100 \* $score / $max`;
|
percent=`expr 100 \* $score / $max`;
|
||||||
|
|
||||||
echo -n "Test: $score/$max : $percent%";
|
|
||||||
|
|
||||||
|
echo -n "Test: $score/$max : $percent%";
|
||||||
}
|
}
|
||||||
|
|
||||||
activate_minils () {
|
activate_minils () {
|
||||||
minils=1
|
minils=1
|
||||||
}
|
|
||||||
|
|
||||||
activate_caml () {
|
|
||||||
caml=1
|
|
||||||
coption="$coption -target caml"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
activate_java () {
|
activate_java () {
|
||||||
java=1
|
java=1
|
||||||
coption="$coption -target java"
|
coption="$coption -target java"
|
||||||
}
|
|
||||||
|
|
||||||
activate_lustre () {
|
|
||||||
lustre=1
|
|
||||||
coption="$coption -target lustre"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
activate_c () {
|
activate_c () {
|
||||||
c=1
|
c=1
|
||||||
coption="$coption -target c"
|
coption="$coption -target c"
|
||||||
}
|
|
||||||
|
|
||||||
activate_cold () {
|
|
||||||
cng=1
|
|
||||||
coption="$coption -target c-old"
|
|
||||||
}
|
|
||||||
|
|
||||||
activate_vhdl () {
|
|
||||||
vhdl=1
|
|
||||||
coption="$coption -target vhdl"
|
|
||||||
}
|
|
||||||
|
|
||||||
activate_tomato () {
|
|
||||||
coption="$coption -tomato"
|
|
||||||
}
|
|
||||||
|
|
||||||
activate_cse () {
|
|
||||||
coption="$coption -cse"
|
|
||||||
}
|
|
||||||
|
|
||||||
activate_inter () {
|
|
||||||
coption="$coption -inter"
|
|
||||||
}
|
|
||||||
|
|
||||||
activate_boolean () {
|
|
||||||
coption="$coption -bool"
|
|
||||||
}
|
|
||||||
|
|
||||||
activate_deadcode () {
|
|
||||||
coption="$coption -deadcode"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
activate_all () {
|
activate_all () {
|
||||||
activate_caml
|
activate_java
|
||||||
activate_java
|
activate_c
|
||||||
activate_lustre
|
|
||||||
activate_c
|
|
||||||
activate_cold
|
|
||||||
activate_vhdl
|
|
||||||
activate_boolean
|
|
||||||
activate_deadcode
|
|
||||||
activate_cse
|
|
||||||
activate_inter
|
|
||||||
activate_tomato
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# -1, -2, -3, -v1, -v2, -v3 kept for backward compatibility
|
# -1, -2, -3, -v1, -v2, -v3 kept for backward compatibility
|
||||||
# (to be suppressed)
|
# (to be suppressed)
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
"-1" )
|
"-v" )
|
||||||
shift;;
|
|
||||||
"-2" )
|
|
||||||
activate_minils
|
|
||||||
shift;;
|
|
||||||
"-3" )
|
|
||||||
activate_minils
|
|
||||||
shift;;
|
|
||||||
"-v" )
|
|
||||||
verbose=1;
|
verbose=1;
|
||||||
shift;;
|
shift;;
|
||||||
"-all" )
|
"-all" )
|
||||||
activate_all
|
activate_all
|
||||||
shift;;
|
shift;;
|
||||||
"-caml" )
|
"-java" )
|
||||||
activate_caml
|
|
||||||
shift;;
|
|
||||||
"-java" )
|
|
||||||
activate_java
|
activate_java
|
||||||
shift;;
|
shift;;
|
||||||
"-lustre" )
|
"-c" )
|
||||||
activate_lustre
|
|
||||||
shift;;
|
|
||||||
"-tomato" )
|
|
||||||
activate_tomato
|
|
||||||
shift;;
|
|
||||||
"-cse" )
|
|
||||||
activate_cse
|
|
||||||
shift;;
|
|
||||||
"-inter" )
|
|
||||||
activate_inter
|
|
||||||
shift;;
|
|
||||||
"-c" )
|
|
||||||
activate_c
|
activate_c
|
||||||
shift;;
|
shift;;
|
||||||
"-c-old" )
|
"-mls" )
|
||||||
activate_cold
|
|
||||||
shift;;
|
|
||||||
"-vhdl" )
|
|
||||||
activate_vhdl
|
|
||||||
shift;;
|
|
||||||
"-mls" )
|
|
||||||
activate_minils
|
activate_minils
|
||||||
shift;;
|
shift;;
|
||||||
"-bool" )
|
"-h" )
|
||||||
activate_boolean
|
|
||||||
shift;;
|
|
||||||
"-deadcode" )
|
|
||||||
activate_deadcode
|
|
||||||
shift;;
|
|
||||||
"-v1" )
|
|
||||||
verbose=1;
|
|
||||||
shift;;
|
|
||||||
"-v2" )
|
|
||||||
verbose=1;
|
|
||||||
activate_minils
|
|
||||||
shift;;
|
|
||||||
"-v3" )
|
|
||||||
verbose=1;
|
|
||||||
shift;;
|
|
||||||
"-h" )
|
|
||||||
echo "usage : $0 <options> <compilo>"
|
echo "usage : $0 <options> <compilo>"
|
||||||
echo "options : "
|
echo "options : "
|
||||||
echo "-caml : test of code generation (caml code)"
|
|
||||||
echo "-java : test of code generation (java code)"
|
echo "-java : test of code generation (java code)"
|
||||||
echo "-lustre : test of code generation (lustre code)"
|
|
||||||
echo "-c : test of code generation (c code)"
|
echo "-c : test of code generation (c code)"
|
||||||
echo "-c-old : test of code generation (c code, old backend)"
|
|
||||||
echo "-vhdl : test of code generation (vhdl)"
|
|
||||||
echo "-bool : test of boolean translation"
|
|
||||||
echo "-deadcode : test of deadcode removal"
|
|
||||||
echo "-inter : test of intermediate equations removal"
|
|
||||||
echo "-tomato : test of automata minimization"
|
|
||||||
echo "-cse : test of common sub-expression elimination"
|
|
||||||
echo "-all : test all"
|
echo "-all : test all"
|
||||||
echo "-v : verbose"
|
echo "-v : verbose"
|
||||||
exit 0;;
|
exit 0;;
|
||||||
* )
|
* )
|
||||||
compilo=$1
|
compilo=$1
|
||||||
shift
|
shift
|
||||||
coption="$coption $*"
|
coption="$coption $*"
|
||||||
break
|
break
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
launch_check
|
launch_check
|
||||||
echo
|
echo
|
||||||
|
|
Loading…
Reference in a new issue