Added test script for Java code generation

compile_javac_run script: compiles heptagon program with Java target code,
compile and run the produced Java code.
This commit is contained in:
Gwenal Delaval 2012-09-28 13:01:09 +02:00
parent 36bfa81b17
commit d1b0b196d3
4 changed files with 160 additions and 0 deletions

View file

@ -750,3 +750,75 @@ ADD_TEST(test_option_O_tuple_args "scripts/test_option" "good/tuple_args.ept" "-
ADD_TEST(test_option_O_type_alias "scripts/test_option" "good/type_alias.ept" "-O")
ADD_TEST(test_option_O_updown "scripts/test_option" "good/updown.ept" "-O")
ADD_TEST(test_option_O_when_merge1 "scripts/test_option" "good/when_merge1.ept" "-O")
ADD_TEST(compile_javac_run_alloc "scripts/compile_javac_run" "good/alloc.ept")
ADD_TEST(compile_javac_run_array1 "scripts/compile_javac_run" "good/array1.ept")
ADD_TEST(compile_javac_run_array2 "scripts/compile_javac_run" "good/array2.ept")
ADD_TEST(compile_javac_run_array_fill "scripts/compile_javac_run" "good/array_fill.ept")
ADD_TEST(compile_javac_run_array_iterators2 "scripts/compile_javac_run" "good/array_iterators2.ept")
ADD_TEST(compile_javac_run_array_iterators "scripts/compile_javac_run" "good/array_iterators.ept")
ADD_TEST(compile_javac_run_array_power "scripts/compile_javac_run" "good/array_power.ept")
ADD_TEST(compile_javac_run_auto2 "scripts/compile_javac_run" "good/auto2.ept")
ADD_TEST(compile_javac_run_auto "scripts/compile_javac_run" "good/auto.ept")
ADD_TEST(compile_javac_run_autohiera2 "scripts/compile_javac_run" "good/autohiera2.ept")
ADD_TEST(compile_javac_run_autohiera "scripts/compile_javac_run" "good/autohiera.ept")
ADD_TEST(compile_javac_run_bad_updown "scripts/compile_javac_run" "good/bad_updown.ept")
ADD_TEST(compile_javac_run_ckannot "scripts/compile_javac_run" "good/ckannot.ept")
ADD_TEST(compile_javac_run_clock_causality "scripts/compile_javac_run" "good/clock_causality.ept")
ADD_TEST(compile_javac_run_clocks "scripts/compile_javac_run" "good/clocks.ept")
ADD_TEST(compile_javac_run_counter "scripts/compile_javac_run" "good/counter.ept")
ADD_TEST(compile_javac_run_current "scripts/compile_javac_run" "good/current.ept")
ADD_TEST(compile_javac_run_fbyfby2 "scripts/compile_javac_run" "good/fbyfby2.ept")
ADD_TEST(compile_javac_run_foldi "scripts/compile_javac_run" "good/foldi.ept")
ADD_TEST(compile_javac_run_format "scripts/compile_javac_run" "good/format.ept")
ADD_TEST(compile_javac_run_grosauto_clock "scripts/compile_javac_run" "good/grosauto_clock.ept")
ADD_TEST(compile_javac_run_hierarchie "scripts/compile_javac_run" "good/hierarchie.ept")
ADD_TEST(compile_javac_run_itfusion "scripts/compile_javac_run" "good/itfusion.ept")
ADD_TEST(compile_javac_run_linear_automata "scripts/compile_javac_run" "good/linear_automata.ept")
ADD_TEST(compile_javac_run_linear "scripts/compile_javac_run" "good/linear.ept")
ADD_TEST(compile_javac_run_linear_init "scripts/compile_javac_run" "good/linear_init.ept")
ADD_TEST(compile_javac_run_linear_split "scripts/compile_javac_run" "good/linear_split.ept")
ADD_TEST(compile_javac_run_linear_vars "scripts/compile_javac_run" "good/linear_vars.ept")
ADD_TEST(compile_javac_run_memalloc_clocks "scripts/compile_javac_run" "good/memalloc_clocks.ept")
ADD_TEST(compile_javac_run_memalloc_record "scripts/compile_javac_run" "good/memalloc_record.ept")
ADD_TEST(compile_javac_run_memalloc_simple "scripts/compile_javac_run" "good/memalloc_simple.ept")
ADD_TEST(compile_javac_run_name_clash "scripts/compile_javac_run" "good/name_clash.ept")
ADD_TEST(compile_javac_run_norm "scripts/compile_javac_run" "good/norm.ept")
ADD_TEST(compile_javac_run_or_keep "scripts/compile_javac_run" "good/or_keep.ept")
ADD_TEST(compile_javac_run_parametrize "scripts/compile_javac_run" "good/parametrize.ept")
ADD_TEST(compile_javac_run_pre_tuple "scripts/compile_javac_run" "good/pre_tuple.ept")
ADD_TEST(compile_javac_run_reinit "scripts/compile_javac_run" "good/reinit.ept")
ADD_TEST(compile_javac_run_sampling_stateful_output2 "scripts/compile_javac_run" "good/sampling_stateful_output2.ept")
ADD_TEST(compile_javac_run_sampling_stateful_output "scripts/compile_javac_run" "good/sampling_stateful_output.ept")
ADD_TEST(compile_javac_run_side_effet "scripts/compile_javac_run" "good/side_effet.ept")
ADD_TEST(compile_javac_run_statics1 "scripts/compile_javac_run" "good/statics1.ept")
ADD_TEST(compile_javac_run_statics2 "scripts/compile_javac_run" "good/statics2.ept")
ADD_TEST(compile_javac_run_statics "scripts/compile_javac_run" "good/statics.ept")
ADD_TEST(compile_javac_run_t10 "scripts/compile_javac_run" "good/t10.ept")
ADD_TEST(compile_javac_run_t11 "scripts/compile_javac_run" "good/t11.ept")
ADD_TEST(compile_javac_run_t12 "scripts/compile_javac_run" "good/t12.ept")
ADD_TEST(compile_javac_run_t13 "scripts/compile_javac_run" "good/t13.ept")
ADD_TEST(compile_javac_run_t14 "scripts/compile_javac_run" "good/t14.ept")
ADD_TEST(compile_javac_run_t15 "scripts/compile_javac_run" "good/t15.ept")
ADD_TEST(compile_javac_run_t16 "scripts/compile_javac_run" "good/t16.ept")
ADD_TEST(compile_javac_run_t17 "scripts/compile_javac_run" "good/t17.ept")
ADD_TEST(compile_javac_run_t18 "scripts/compile_javac_run" "good/t18.ept")
ADD_TEST(compile_javac_run_t19 "scripts/compile_javac_run" "good/t19.ept")
ADD_TEST(compile_javac_run_t1 "scripts/compile_javac_run" "good/t1.ept")
ADD_TEST(compile_javac_run_t2 "scripts/compile_javac_run" "good/t2.ept")
ADD_TEST(compile_javac_run_t2open "scripts/compile_javac_run" "good/t2open.ept")
ADD_TEST(compile_javac_run_t3 "scripts/compile_javac_run" "good/t3.ept")
ADD_TEST(compile_javac_run_t4 "scripts/compile_javac_run" "good/t4.ept")
ADD_TEST(compile_javac_run_t5 "scripts/compile_javac_run" "good/t5.ept")
ADD_TEST(compile_javac_run_t6 "scripts/compile_javac_run" "good/t6.ept")
ADD_TEST(compile_javac_run_t7 "scripts/compile_javac_run" "good/t7.ept")
ADD_TEST(compile_javac_run_t8 "scripts/compile_javac_run" "good/t8.ept")
ADD_TEST(compile_javac_run_t9 "scripts/compile_javac_run" "good/t9.ept")
ADD_TEST(compile_javac_run_t "scripts/compile_javac_run" "good/t.ept")
ADD_TEST(compile_javac_run_test "scripts/compile_javac_run" "good/test.ept")
ADD_TEST(compile_javac_run_threestates "scripts/compile_javac_run" "good/threestates.ept")
ADD_TEST(compile_javac_run_tt "scripts/compile_javac_run" "good/tt.ept")
ADD_TEST(compile_javac_run_tttt "scripts/compile_javac_run" "good/tttt.ept")
ADD_TEST(compile_javac_run_tuple_args "scripts/compile_javac_run" "good/tuple_args.ept")
ADD_TEST(compile_javac_run_type_alias "scripts/compile_javac_run" "good/type_alias.ept")
ADD_TEST(compile_javac_run_updown "scripts/compile_javac_run" "good/updown.ept")
ADD_TEST(compile_javac_run_when_merge1 "scripts/compile_javac_run" "good/when_merge1.ept")

View file

@ -31,3 +31,7 @@ compile_diff "itfusion"
compile_diff "memalloc"
compile_diff "unroll"
compile_diff "O"
for i in good/*.ept; do
echo 'ADD_TEST(compile_javac_run_'`basename $i .ept` '"scripts/compile_javac_run"' '"'$i'")'
done

82
test/scripts/compile_javac_run Executable file
View file

@ -0,0 +1,82 @@
#!/bin/bash
source scripts/config
progpath=$1
shift
coption="-target java $*"
# run the program: no by default
run=0
cp $progpath $checkdir
pushd $checkdir > /dev/null
heptprog=`basename $progpath`
heptroot=`basename $heptprog .ept`
assert_node=$(eval grep CHECK $heptprog | awk '{ print $3 }')
if [ -n "$assert_node" ]; then
coption="$coption -assert $assert_node"
run=1
fi
if grep "node main()" $heptprog >/dev/null; then
coption="$coption -hepts -s main"
run=1
fi
# Special case: t2 and t2open needs t1
# if [[ ($heptroot == "t2") || ($heptroot == "t2open") ]]; then
# # Nothing to do
# fi
# Special case: statics2 needs statics1
if [[ ($heptroot == "statics1") ]]; then
coption="$coption -c"
fi
# if [[ ($heptroot == "statics2") ]]; then
# fi
# Capitalized root
CapHeptroot=`echo ${heptroot} | sed 's/^\(.\).*$/\1/' | tr "[:lower:]" "[:upper:]"`\
`echo ${heptroot} | sed 's/^.//'`
echo $HEPTC $coption $heptprog
if $HEPTC $coption $heptprog; then
pushd java > /dev/null
echo $JAVAC ${CapHeptroot}/*.java
if $JAVAC ${CapHeptroot}/*.java; then
if [[ $run == 1 ]]; then
echo $JAVA ${CapHeptroot}.Main_sim $NBSTEP
if $JAVA ${CapHeptroot}.Main_sim $NBSTEP; then
echo "Test successful."
res=0
else
echo "Run failed."
res=1
fi
else
echo "Test successful (Java compilation only; no run)."
res=0
fi
else
echo "Compilation of Java target code failed"
res=1
fi
popd >/dev/null
else
echo "Compilation of $heptprog failed"
res=1
fi
popd > /dev/null
exit $res

View file

@ -22,6 +22,8 @@ fi
HEPTC="../$COMPILER_DIR/$COMPILER -stdlib ../../lib"
CC="gcc -std=c99 -I ../../../lib/c"
LD="gcc"
JAVAC="javac -classpath ../../../lib/java:."
JAVA="java -classpath ../../../lib/java:."
NBSTEP=100
if [ ! -x $checkdir ];