| <?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.c.tests" basedir="." default="all"> |
| |
| <target name="testing" depends="common.testing"> |
| |
| <!-- add test here, testid==testSuiteFileName --> |
| <test testid="StaticConfigTest" models="${models.path}/staticConfig/StaticConfigTest.etmap ${models.path}/staticConfig/StaticConfigTest.room ${models.path}/staticConfig/StaticConfigTest.config ${models.path}/TimingService.room" /> |
| |
| <!-- fail on build server --> |
| <!--<test testid="SendingDataTestC" models="${models.path}/sendingData/SendingDataTestC.room ${models.path}/GenericPhysical.etphys" />--> |
| <echo>done with ${ant.project.name}</echo> |
| </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="modellib.path" value="../../runtime/org.eclipse.etrice.modellib.c" /> |
| <property name="runtime.path" value="../../runtime/org.eclipse.etrice.runtime.c" /> |
| |
| <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> |
| <standaloneGenerator testId="@{testId}" models="@{models}"/> |
| <build testId="@{testId}"/> |
| <run testId="@{testId}"/> |
| <convert testId="@{testId}"/> |
| <copyResult testId="@{testId}" targetId="C_${runtime.platform}_"/> |
| </sequential> |
| </macrodef> |
| |
| <macrodef name="standaloneGenerator"> |
| <attribute name="testId"/> |
| <attribute name="models"/> |
| <sequential> |
| <mkdir dir="${output}"/> |
| <java output="${output}/generate.txt" error="${output}/generate_err.txt" classname="org.eclipse.etrice.generator.c.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 C sources |
| --> |
| <macrodef name="build"> |
| <attribute name="testId"/> |
| <sequential> |
| <mkdir dir="${bin.path}"/> |
| <mkdir dir="${output}"/> |
| <exec executable="make" failonerror="true" output="${output}/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="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}/run.txt" resolveexecutable="true" executable="${bin.path}/@{testId}.exe" timeout="${run.msTimout}"> |
| <arg value="-run_as_test"/> |
| </exec> |
| </sequential> |
| </macrodef> |
| |
| </project> |