blob: dfc50aef395111477d4ab6c70a61f99402edacc5 [file] [log] [blame]
<?xml version="1.0"?>
<!--
Ant makefile for building and running of tests.
This includes invocation of the Java code generator and conversion of the etunit
results into xunit xml.
To work locally you should define in your environment
ETRICE_TARGET_PLATFORM=path to the eclipse folder of your Juno installation
@author Henrik Rentz-Reichert
-->
<project name="project" default="all">
<property name="java.tests.model.path" value="./models"/>
<property name="modellib.path" value="../../runtime/org.eclipse.etrice.modellib.java"/>
<property name="runtime.path" value="../../runtime/org.eclipse.etrice.runtime.java"/>
<property name="bin.path" value="./bin"/>
<property name="xml.output" value="./tmp"/>
<property name="output" value="./output"/>
<property environment="env"/>
<!--
all: copies the models, generates, compiles, runs, converts and copies the results
-->
<target name="all" depends="convert,copy_results">
<echo>done with org.eclipse.etrice.generator.java.tests</echo>
</target>
<!--
set_tp: get the target.platform property from the environment var ETRICE_TARGET_PLATFORM if not set already
-->
<target name="set_tp" unless="target.platform">
<echo>using local target platform</echo>
<property name="target.platform" value="${env.ETRICE_TARGET_PLATFORM}"/>
</target>
<!--
set_tr: sets the test.result property if not set already
-->
<target name="set_tr" unless="test.results">
<echo>using local test result folder</echo>
<property name="test.results" value="./results"/>
</target>
<!--
clean: deletes all folders created by this script
-->
<target name="clean" depends="set_tr">
<delete dir="${bin.path}"/>
<delete dir="models"/>
<delete dir="${output}"/>
<delete dir="${test.results}"/>
<delete dir="src-gen"/>
<delete dir="tmp"/>
</target>
<!--
copy_models: copies the models from their original folders to the build location
-->
<target name="copy_models" depends="clean">
<copy todir="models" >
<fileset dir="../org.eclipse.etrice.generator.common.tests/models">
<include name="*.room"/>
<include name="*.config"/>
<include name="*.rt-config"/>
</fileset>
<fileset dir="../../runtime/org.eclipse.etrice.modellib.java/models">
<include name="TimingService.room"/>
<include name="Types.room"/>
<include name="TcpService.room"/>
<include name="Language.room"/>
</fileset>
</copy>
<move file="models/StaticConfigTest_Java.room" toFile="models/StaticConfigTest.room"/>
</target>
<!--
generate: invokes the Java generator for the ROOM models
-->
<target name="generate" depends="set_tp,copy_models">
<mkdir dir="${output}"/>
<path id="clspath">
<pathelement location="../../plugins/org.eclipse.etrice.generator.java/bin"/>
<pathelement location="../../plugins/org.eclipse.etrice.generator.config/bin"/>
<pathelement location="../../plugins/org.eclipse.etrice.generator.doc/bin"/>
<pathelement location="../../plugins/org.eclipse.etrice.generator/bin"/>
<pathelement location="../../plugins/org.eclipse.etrice.generator.config/bin"/>
<pathelement location="../../plugins/org.eclipse.etrice.core.room/bin"/>
<pathelement location="../../plugins/org.eclipse.etrice.core.etphys/bin"/>
<pathelement location="../../plugins/org.eclipse.etrice.core.etmap/bin"/>
<pathelement location="../../plugins/org.eclipse.etrice.core.config/bin"/>
<pathelement location="../../plugins/org.eclipse.etrice.core.genmodel/bin"/>
<fileset dir="${target.platform}/plugins/">
<include name="org.eclipse.emf.ecore_2.8*.jar" />
<include name="org.eclipse.emf.common_2.8*.jar" />
<include name="org.eclipse.emf.ecore.xmi_2.8*.jar" />
<include name="org.eclipse.xtext_2.*.jar" />
<include name="com.google.inject_*.jar" />
<include name="com.google.guava_10.*.jar" />
<include name="org.eclipse.equinox.common_3.6.*.jar" />
<include name="org.eclipse.xtext.util_2.*.jar" />
<include name="org.eclipse.xtend.lib_2.*.jar" />
<include name="org.eclipse.xtext.xbase.lib_2.*.jar" />
<include name="org.apache.log4j_1.2*.jar" />
<include name="org.antlr.runtime_3.2*.jar" />
<include name="javax.inject_1.0*.jar" />
</fileset>
</path>
<java output="${output}/generate.txt" error="${output}/generate_err.txt" classname="org.eclipse.etrice.generator.java.Main" fork="true" failonerror="true">
<arg value="${java.tests.model.path}/HandlerTest.room"/>
<arg value="${java.tests.model.path}/ChoicePointTest.room"/>
<arg value="${java.tests.model.path}/PingPongThreadTest.room"/>
<arg value="${java.tests.model.path}/PingPongThreadReplPortTest.room"/>
<arg value="${java.tests.model.path}/SendingDataTestJava.room"/>
<arg value="${java.tests.model.path}/TCPTest.room"/>
<arg value="${java.tests.model.path}/StaticConfigTest.room"/>
<arg value="${java.tests.model.path}/StaticConfigTest.config"/>
<arg value="${java.tests.model.path}/DynamicConfigTest_Java.room"/>
<arg value="${java.tests.model.path}/DynamicConfigTest_Java.config"/>
<classpath refid="clspath"/>
</java>
</target>
<!--
compile: compiles the generated Java sources
-->
<target name="compile" depends="generate">
<mkdir dir="${bin.path}"/>
<javac srcdir="src-gen:src"
destdir="${bin.path}"
classpath="${runtime.path}/bin"
debug="on"
/>
</target>
<!--
run: runs all executables
-->
<target name="run" depends="compile">
<mkdir dir="tmp/log"/>
<java output="${output}/runStaticConfigTest.txt" classname="StaticConfigTest.SubSystem_StaticConfigTestRunner" fork="true" failonerror="true">
<arg value="-run_as_test"/>
<classpath path="${bin.path};${runtime.path}/bin;${modellib.path}/bin"/>
</java>
<!--
<java output="${output}/runDynamicConfigTest.txt" classname="DynamicConfigTest.SubSystemRunner" fork="true" failonerror="true">
<arg value="-run_as_test"/>
<classpath path="${bin.path};${runtime.path}/bin;${modellib.path}/bin"/>
</java>
-->
<java output="${output}/runHandlerTest.txt" classname="HandlerTest.SubSystem_HandlerTestRunner" fork="true" failonerror="true">
<arg value="-run_as_test"/>
<classpath path="${bin.path};${runtime.path}/bin;${modellib.path}/bin"/>
</java>
<java output="${output}/runChoicePointTest.txt" classname="ChoicePointTest.SubSystem_CPTestRunner" fork="true" failonerror="true">
<arg value="-run_as_test"/>
<classpath path="${bin.path};${runtime.path}/bin;${modellib.path}/bin"/>
</java>
<java output="${output}/runPingPongThreadTest.txt" classname="PingPongThreadTest.SubSystem_PingPongRunner" fork="true" failonerror="true">
<arg value="-run_as_test"/>
<classpath path="${bin.path};${runtime.path}/bin;${modellib.path}/bin"/>
</java>
<java output="${output}/runPingPongThreadReplPortTest.txt" classname="PingPongThreadTestReplPort.SubSystem_PingPongRunner" fork="true" failonerror="true">
<arg value="-run_as_test"/>
<classpath path="${bin.path};${runtime.path}/bin;${modellib.path}/bin"/>
</java>
<java output="${output}/runSendingDataTestJava.txt" classname="SendingDataTestJava.SubSys_SendingDataRunner" fork="true" failonerror="true">
<arg value="-run_as_test"/>
<classpath path="${bin.path};${runtime.path}/bin;${modellib.path}/bin"/>
</java>
<java output="${output}/runTCPTest.txt" classname="TCPTest.TCPTestSubSysRunner" fork="true" failonerror="true">
<arg value="-run_as_test"/>
<classpath path="${bin.path};${runtime.path}/bin;${modellib.path}/bin"/>
</java>
</target>
<!--
convert: converts etu- into xunit xml-format
-->
<target name="convert" depends="run,set_tp">
<path id="clspath">
<pathelement location="../../plugins/org.eclipse.etrice.etunit.converter/bin"/>
<fileset dir="${target.platform}/plugins/">
<include name="org.eclipse.core.runtime_3.8*.jar" />
<include name="org.eclipse.emf.ecore_2.8*.jar" />
<include name="org.eclipse.emf.ecore.xmi_2.8*.jar" />
<include name="org.eclipse.emf.common_2.8*.jar" />
</fileset>
</path>
<java output="${output}/convert.txt" classname="org.eclipse.etrice.etunit.converter.EtUnitReportConverter" fork="true" failonerror="true">
<arg value="-suite"/>
<arg value="org.eclipse.etrice.generator.java.tests.ChoicePointTest"/>
<arg value="./tmp/ChoicePointTest.etu"/>
<classpath refid="clspath"/>
</java>
<java output="${output}/convert.txt" append="true" classname="org.eclipse.etrice.etunit.converter.EtUnitReportConverter" fork="true" failonerror="true">
<arg value="-suite"/>
<arg value="org.eclipse.etrice.generator.java.tests.HandlerTest"/>
<arg value="./tmp/HandlerTest.etu"/>
<classpath refid="clspath"/>
</java>
<java output="${output}/convert.txt" append="true" classname="org.eclipse.etrice.etunit.converter.EtUnitReportConverter" fork="true" failonerror="true">
<arg value="-suite"/>
<arg value="org.eclipse.etrice.generator.java.tests.PingPongThreadTest"/>
<arg value="./tmp/PingPongThreadTest.etu"/>
<classpath refid="clspath"/>
</java>
<java output="${output}/convert.txt" append="true" classname="org.eclipse.etrice.etunit.converter.EtUnitReportConverter" fork="true" failonerror="true">
<arg value="-suite"/>
<arg value="org.eclipse.etrice.generator.java.tests.PingPongThreadTestReplPort"/>
<arg value="./tmp/PingPongThreadTestReplPort.etu"/>
<classpath refid="clspath"/>
</java>
<java output="${output}/convert.txt" append="true" classname="org.eclipse.etrice.etunit.converter.EtUnitReportConverter" fork="true" failonerror="true">
<arg value="-suite"/>
<arg value="org.eclipse.etrice.generator.java.tests.SendingDataTest"/>
<arg value="./tmp/SendingDataTestJava.etu"/>
<classpath refid="clspath"/>
</java>
<java output="${output}/convert.txt" append="true" classname="org.eclipse.etrice.etunit.converter.EtUnitReportConverter" fork="true" failonerror="true">
<arg value="-suite"/>
<arg value="org.eclipse.etrice.generator.java.tests.TCPTest"/>
<arg value="./tmp/TCPTest.etu"/>
<classpath refid="clspath"/>
</java>
<java output="${output}/convert.txt" append="true" classname="org.eclipse.etrice.etunit.converter.EtUnitReportConverter" fork="true" failonerror="true">
<arg value="-suite"/>
<arg value="org.eclipse.etrice.generator.java.tests.StaticConfigTest"/>
<arg value="./tmp/StaticConfigTest.etu"/>
<classpath refid="clspath"/>
</java>
<java output="${output}/convert.txt" append="true" classname="org.eclipse.etrice.etunit.converter.EtUnitReportConverter" fork="true" failonerror="true">
<arg value="-suite"/>
<arg value="org.eclipse.etrice.generator.java.tests.DynamicConfigTest"/>
<arg value="./tmp/DynamicConfigTest.etu"/>
<classpath refid="clspath"/>
</java>
</target>
<!--
copy_results: copies the *.xml results to their final destination
-->
<target name="copy_results" depends="set_tr">
<move file="./tmp/HandlerTest.xml" tofile="./tmp/JavaHandlerTest.xml"/>
<move file="./tmp/ChoicePointTest.xml" tofile="./tmp/JavaChoicePointTest.xml"/>
<move file="./tmp/StaticConfigTest.xml" tofile="./tmp/StaticConfigTest.xml"/>
<move file="./tmp/DynamicConfigTest.xml" tofile="./tmp/DynamicConfigTest.xml"/>
<copy todir="${test.results}" >
<fileset dir="./tmp">
<include name="*.xml"/>
</fileset>
</copy>
</target>
</project>