blob: af3fe27d6cd1111b32c01154e435902ab0ec784b [file] [log] [blame]
<?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.cpp.tests" basedir="." default="all">
<!-- <target name="testing" depends="setVars,common.testing">
// add test here, testid==testSuiteFileName
<echo>done with ${ant.project.name}</echo>
</target> -->
<target name="testing" depends="copyModels">
<!-- modified target from common.xml because cpp is not complete yet -->
<test testid="SendingDataTestCpp" models="${models.path}/sendingData/SendingDataTestCpp.room ${models.path}/GenericPhysical.etphys" />
<test testid="CompileTests" models="${models.path}/CompileTests.room ${models.path}/GenericPhysical.etphys ${models.path}/DetailExpressionTest.room ${models.path}/StatemachineInterfaceTest.room ${models.path}/StatemachineInterfaceInheritedTest.room ${models.path}/StatemachineInterfaceTest.room ${models.path}/ContinuationTransitionTest.room ${models.path}/TimingService.room" />
<test testid="ActorCommunicationTest" models="${models.path}/ActorCommunicationTest.room ${models.path}/GenericPhysical.etphys ${models.path}/TimingService.room" />
<test testid="ChoicePointTest" models="${models.path}/ChoicePointTest.room ${models.path}/GenericPhysical.etphys" />
<test testid="ChoicePointTestExtended" models="${models.path}/ChoicePointTestExtended.room ${models.path}/GenericPhysical.etphys" />
<test testid="DataDrivenTest" models="${models.path}/DataDrivenTest.room ${models.path}/GenericPhysical.etphys ${models.path}/TimingService.room" />
<test testid="HandlerTest" models="${models.path}/HandlerTest.room ${models.path}/GenericPhysical.etphys" />
<test testid="OperationInheritanceTest" models="${models.path}/OperationInheritanceTest.room ${models.path}/GenericPhysical.etphys" />
<test testid="PingPongThreadTest" models="${models.path}/PingPongThreadTest.etmap ${models.path}/PingPongThreadTest.room ${models.path}/TimingService.room" />
<test testid="PingPongThreadReplPortTest" models="${models.path}/PingPongThreadReplPortTest.etmap ${models.path}/PingPongThreadReplPortTest.room ${models.path}/TimingService.room" />
<test testid="InitializationTest" models="${models.path}/InitializationTest.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_C.room" toFile="${models.path}/staticConfig//StaticConfigTest.room" />-->
</target>
<!-- ################################################################ -->
<import file="../org.eclipse.etrice.generator.common.tests/common.xml" as="common"/>
<property name="runtime.path" value="../../runtime/org.eclipse.etrice.runtime.c" />
<property name="modellib.path" value="../../runtime/org.eclipse.etrice.modellib.cpp" />
<property name="cpp-runtime.path" value="../../runtime/org.eclipse.etrice.runtime.cpp" />
<target name="set_local_rt" unless="runtime.platform">
<!--<property name="runtime.platform" value="MT_POSIX_GENERIC_GCC"/>-->
<property name="runtime.platform" value="MT_WIN_MinGW"/>
<echo> runtime.platform = ${runtime.platform} </echo>
</target>
<target name="setVars" depends="set_local_rt,common.setVars"/>
<target name="all" depends="clean,copyModels,testing"></target>
<!-- test := generate 1 executable, build, run, process results -->
<macrodef name="test">
<attribute name="testId"/>
<attribute name="models"/>
<sequential>
<echo>generating @{testId}</echo>
<standaloneGenerator testId="@{testId}" models="@{models}"/>
<echo>building @{testId}</echo>
<build testId="@{testId}"/>
<echo>running @{testId}</echo>
<run testId="@{testId}"/>
<echo>converting @{testId}</echo>
<convert testId="@{testId}"/>
<echo>copying result @{testId}</echo>
<copyResult testId="@{testId}" targetId="CPP_${runtime.platform}_"/>
</sequential>
</macrodef>
<macrodef name="standaloneGenerator">
<attribute name="testId"/>
<attribute name="models"/>
<sequential>
<mkdir dir="${output}"/>
<java output="${output}/@{testId}_generate.txt" error="${output}/@{testId}_generate_err.txt" classname="org.eclipse.etrice.generator.cpp.Main" fork="true" failonerror="true">
<arg line="@{models}"/>
<arg value="-genDir"/><arg value="src-gen/@{testId}"/>
<arg value="-msc_instr"/>
<classpath refid="etrice.clspath"/>
</java>
</sequential>
</macrodef>
<!--
build: compiles and links the generated Cpp sources
-->
<macrodef name="build">
<attribute name="testId"/>
<sequential>
<mkdir dir="${bin.path}"/>
<mkdir dir="${output}"/>
<exec executable="make" failonerror="true" output="${output}/@{testId}_build.txt">
<arg line="all"/>
<arg line="APP_TARGET=@{testId}.exe"/>
<arg line="APP_BUILD_DIR=${bin.path}"/>
<arg line="APP_SRCDIRS_REC='./src-gen/@{testId} ./src/@{testId}'"/>
<arg line="RUNTIME_ROOTDIR=${runtime.path}"/>
<arg line="CPP_RUNTIME_ROOTDIR=${cpp-runtime.path}"/>
<arg line="MODELLIB_ROOTDIR=${modellib.path}"/>
<arg line="TARGET_PLATFORM=${runtime.platform}"/>
</exec>
</sequential>
</macrodef>
<macrodef name="run">
<attribute name="testId"/>
<sequential>
<mkdir dir="${output}"/>
<mkdir dir="${testlog.path}"/>
<exec dir="./" output="${output}/@{testId}_run.txt" resolveexecutable="true" executable="${bin.path}/@{testId}.exe" timeout="${run.msTimout}">
<arg value="-run_as_test"/>
</exec>
</sequential>
</macrodef>
</project>