Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/org.eclipse.etrice.generator.java.tests/make.xml')
-rw-r--r--tests/org.eclipse.etrice.generator.java.tests/make.xml130
1 files changed, 130 insertions, 0 deletions
diff --git a/tests/org.eclipse.etrice.generator.java.tests/make.xml b/tests/org.eclipse.etrice.generator.java.tests/make.xml
new file mode 100644
index 000000000..bb84b48e3
--- /dev/null
+++ b/tests/org.eclipse.etrice.generator.java.tests/make.xml
@@ -0,0 +1,130 @@
+
+<?xml version="1.0"?>
+<!--
+ Ant makefile for building and running of tests.
+
+ Includes common.xml from org.eclipse.etrice.generator.common.tests
+-->
+<project name="org.eclipse.etrice.generator.java.tests" basedir="." default="all">
+
+ <target name="testing" depends="dynamicActorTests,common.testing">
+
+ <!-- add test here, testid==testSuiteFileName -->
+ <test testid="TCPTest" models="${models.path}/TCPTest.room ${models.path}/GenericPhysical.etphys" />
+ <test testid="DynamicConfigTest" models="${models.path}/DynamicConfigTest.etmap ${models.path}/DynamicConfigTest.config"/>
+ <test testid="StaticConfigTest" models="${models.path}/staticConfig/StaticConfigTest.etmap ${models.path}/staticConfig/StaticConfigTest.config" />
+ <test testid="SendingDataTestJava" models="${models.path}/sendingData/SendingDataTestJava.room ${models.path}/GenericPhysical.etphys" />
+
+ <echo>done with ${ant.project.name}</echo>
+ </target>
+
+ <target name="dynamicActorTests">
+ <property name="genOptions" value="-persistable -storeDataObj"/>
+
+ <test testid="DynamicActorTest1" genOptions="${genOptions}" models="${models.path}/DynamicActorTest1.etmap" />
+ <test testid="DynamicActorTest2" genOptions="${genOptions}" models="${models.path}/DynamicActorTest2.etmap" />
+ <test testid="DynamicActorTest3" genOptions="${genOptions}" models="${models.path}/DynamicActorTest3.room ${models.path}/GenericPhysical.etphys" />
+ <test testid="DynamicActorTest4" genOptions="${genOptions}" models="${models.path}/DynamicActorTest4.room ${models.path}/GenericPhysical.etphys" />
+ <test testid="DynamicActorTest5" genOptions="${genOptions}" models="${models.path}/DynamicActorTest5.room ${models.path}/GenericPhysical.etphys" />
+ <test testid="DynamicActorTest6" genOptions="${genOptions}" models="${models.path}/DynamicActorTest6.room ${models.path}/GenericPhysical.etphys" />
+ <test testid="DynamicActorTest7" genOptions="${genOptions}" models="${models.path}/DynamicActorTest7.etmap" />
+ <test testid="StoreRestore" genOptions="${genOptions}" models="${models.path}/StoreRestore.room ${models.path}/GenericPhysical.etphys" />
+ </target>
+
+ <target name="copyModels" depends="common.copyModels">
+ <copy todir="${models.path}">
+ <fileset dir="./targetModels"/>
+ </copy>
+ <move file="${models.path}/staticConfig/StaticConfigTest_Java.room" toFile="${models.path}/staticConfig//StaticConfigTest.room" />
+ </target>
+
+ <!-- ################################################################ -->
+
+ <import file="../org.eclipse.etrice.generator.common.tests/common.xml" as="common"/>
+
+ <property name="modellib.path" value="../../runtime/org.eclipse.etrice.modellib.java" />
+ <property name="runtime.path" value="../../runtime/org.eclipse.etrice.runtime.java" />
+
+ <target name="all" depends="clean,copyModels,testing"/>
+
+ <!-- test := generate 1 executable, build, run, process results -->
+ <macrodef name="test">
+ <attribute name="testId"/>
+ <attribute name="models"/>
+ <attribute name="genOptions" default=""/>
+ <sequential>
+ <standaloneGenerator testId="@{testId}" models="@{models}" genOptions="@{genOptions}"/>
+ <build testId="@{testId}"/>
+ <run testId="@{testId}"/>
+ <convert testId="@{testId}"/>
+ <copyResult testId="@{testId}" targetId="Java_"/>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="standaloneGenerator">
+ <attribute name="testId"/>
+ <attribute name="models"/>
+ <attribute name="genOptions" default=""/>
+ <sequential>
+ <mkdir dir="${output}"/>
+ <java output="${output}/generate.txt" error="${output}/generate_err.txt" classname="org.eclipse.etrice.generator.java.Main" fork="true" failonerror="true">
+ <arg line="@{models}"/>
+ <arg value="-genDir"/><arg value="src-gen/@{testId}"/>
+ <arg value="-msc_instr" />
+ <arg line="@{genOptions}" />
+ <classpath refid="etrice.clspath" />
+ </java>
+ </sequential>
+ </macrodef>
+
+ <!--
+ compile: compiles the generated Java sources
+ -->
+ <macrodef name="build">
+ <attribute name="testId"/>
+ <sequential>
+ <mkdir dir="${bin.path}/@{testId}" />
+ <!-- ./src/xxx is optional, create it anyway to avoid error -->
+ <mkdir dir="./src/@{testId}" />
+ <record name="${basedir}/output/compile.txt" action="start"/>
+ <javac destdir="${bin.path}/@{testId}" source="1.6" classpath="${runtime.path}/target/classes" debug="off" verbose="off">
+ <src>
+ <pathelement location="src-gen/@{testId}" />
+ <pathelement location="src/@{testId}" />
+ </src>
+ </javac>
+ <record name="${basedir}/output/compile.txt" action="stop"/>
+ </sequential>
+ </macrodef>
+
+ <!--
+ run: runs all executables
+ -->
+ <macrodef name="run">
+ <attribute name="testId"/>
+ <sequential>
+ <mkdir dir="${testlog.path}" />
+ <!-- get runner class -->
+ <local name="runner.class"/>
+ <fileset id="runnerFileSet" dir="./src-gen/@{testId}">
+ <include name="**/*Runner.java"/>
+ </fileset>
+ <pathconvert property="runner.class">
+ <string>${toString:runnerFileSet}</string>
+ <chainedmapper>
+ <globmapper from="*.java" to="*"/>
+ <packagemapper from="*" to="*"/>
+ </chainedmapper>
+ </pathconvert>
+ <!--<echo>path of runner.java: ${toString:runnerFileSet}</echo>
+ <echo>runner path converted to class: ${runner.class}</echo>-->
+
+ <echo>run @{testId}</echo>
+ <java output="${output}/run@{testId}.txt" classname="${runner.class}" fork="true" failonerror="true" timeout="${run.msTimout}">
+ <arg value="-run_as_test" />
+ <classpath path="./bin/@{testId};${runtime.path}/target/classes;" />
+ </java>
+ </sequential>
+ </macrodef>
+
+</project>

Back to the top