blob: c31c499a0f9f3b055a0d2d39441416b16f8c2cd8 [file] [log] [blame]
<?xml version="1.0"?>
<!--
Ant makefile for building and running of tests.
This includes 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
ETRICE_C_RUNTIME=path to the org.eclipse.etrice.runtime.c folder (relative path doesn't work)
ETRICE_GCC_PATH=folder where gcc resides
@author Henrik Rentz-Reichert
-->
<project name="project" default="all">
<property name="runtime.path" value="../../runtime/org.eclipse.etrice.runtime.c"/>
<property name="bin.path" value="./bin"/>
<property name="xml.output" value="./tmp"/>
<property name="output" value="./output"/>
<property environment="env"/>
<!--
all: compiles, runs, converts and copies the results
-->
<target name="all" depends="convert,copy_results">
<echo>done with org.eclipse.etrice.runtime.c.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>
<!--
set_platform: sets the runtime.platform property if not set already
-->
<target name="set_platform" unless="runtime.platform">
<echo>using MinGW runtime platform</echo>
<!--
<property name="runtime.platform" value="MT_WIN_MinGW"/>
-->
<property name="runtime.platform" value="MT_POSIX_GENERIC_GCC"/>
</target>
<!--
set_rp: sets the runtime.path from the ETRICE_C_RUNTIME environment variable property if not set already
-->
<target name="set_rp" unless="c-runtime.path">
<echo>using local runtime folder</echo>
<property name="c-runtime.path" value="${env.ETRICE_C_RUNTIME}"/>
</target>
<!--
set_gcc_path: sets the gcc.path property from the ETRICE_GCC_PATH environment variable property if not set already
-->
<target name="set_gcc_path" unless="gcc.path">
<echo>using gcc from path</echo>
<property name="gcc.path" value="${env.ETRICE_GCC_PATH}"/>
</target>
<!--
clean: deletes all folders created by this script
-->
<target name="clean" depends="set_tr,set_rp">
<delete dir="${bin.path}"/>
<delete dir="${c-runtime.path}/bin"/>
<delete dir="${output}"/>
<delete dir="src-gen"/>
<delete dir="tmp"/>
</target>
<!--
compile_runtime: compiles the C runtime library
-->
<target name="compile_runtime" depends="clean,set_rp,set_gcc_path">
<mkdir dir="${c-runtime.path}/bin"/>
<mkdir dir="${output}"/>
<exec dir="${c-runtime.path}/bin" executable="${gcc.path}/gcc" failonerror="true" output="${output}/compile_runtime.txt">
<arg value="-I${c-runtime.path}/src/common"/>
<arg value="-I${c-runtime.path}/src/config"/>
<arg value="-I${c-runtime.path}/src/platforms/${runtime.platform}"/>
<arg value="-I${c-runtime.path}/src/util"/>
<arg value="-c"/>
<arg value="-g3"/>
<arg value="-O0"/>
<arg value="-Wall"/>
<!--<arg value="-ansi"/>-->
<arg value="../src/common/debugging/etMSCLogger.c"/>
<arg value="../src/common/etUnit/etUnit.c"/>
<arg value="../src/common/base/etMemory_FreeList.c"/>
<arg value="../src/common/base/etMemory_FixedSize.c"/>
<arg value="../src/common/base/etQueue.c"/>
<arg value="../src/common/messaging/etMessage.c"/>
<arg value="../src/common/messaging/etMessageQueue.c"/>
<arg value="../src/common/messaging/etMessageService.c"/>
<arg value="../src/common/messaging/etSystemProtocol.c"/>
<arg value="../src/common/helpers/etTimeHelpers.c"/>
<arg value="../src/common/runtime/etRuntime.c"/>
<arg value="../src/common/modelbase/etActor.c"/>
<arg value="../src/common/modelbase/etPort.c"/>
<arg value="../src/util/RandomGenerator.c"/>
<arg value="../src/platforms/${runtime.platform}/etLogger.c"/>
<arg value="../src/platforms/${runtime.platform}/etMutex.c"/>
<arg value="../src/platforms/${runtime.platform}/etPlatformLifecycle.c"/>
<arg value="../src/platforms/${runtime.platform}/etSema.c"/>
<arg value="../src/platforms/${runtime.platform}/etThread.c"/>
<arg value="../src/platforms/${runtime.platform}/etTime.c"/>
<arg value="../src/platforms/${runtime.platform}/etTimer.c"/>
</exec>
<exec dir="${c-runtime.path}/bin" executable="ar" failonerror="true" output="${output}/compile_runtime.txt" append="true">
<arg value="-r"/>
<arg value="liborg.eclipse.etrice.runtime.c.a"/>
<arg value="etActor.o"/>
<arg value="etLogger.o"/>
<arg value="etMessage.o"/>
<arg value="etMessageQueue.o"/>
<arg value="etMessageService.o"/>
<arg value="etSystemProtocol.o"/>
<arg value="etTimeHelpers.o"/>
<arg value="etRuntime.o"/>
<arg value="etMSCLogger.o"/>
<arg value="etMutex.o"/>
<arg value="etPlatformLifecycle.o"/>
<arg value="etPort.o"/>
<arg value="RandomGenerator.o"/>
<arg value="etSema.o"/>
<arg value="etThread.o"/>
<arg value="etTime.o"/>
<arg value="etTimer.o"/>
<arg value="etUnit.o"/>
<arg value="etMemory_FreeList.o"/>
<arg value="etMemory_FixedSize.o"/>
<arg value="etQueue.o"/>
</exec>
</target>
<!--
build: compiles and links the generated C sources
-->
<target name="build" depends="set_rp,set_gcc_path,set_platform,compile_runtime">
<!-- compile and link RuntimeTest -->
<mkdir dir="bin/test"/>
<exec dir="bin/test" executable="${gcc.path}/gcc" failonerror="true" output="${output}/build.txt">
<arg value="-I../../src/"/>
<arg value="-I../../src/runtime/"/>
<arg value="-I${c-runtime.path}/src/common"/>
<arg value="-I${c-runtime.path}/src/config"/>
<arg value="-I${c-runtime.path}/src/platforms/${runtime.platform}"/>
<arg value="-I${c-runtime.path}/src/util"/>
<arg value="-c"/>
<arg value="-g3"/>
<arg value="-O0"/>
<arg value="-Wall"/>
<!--<arg value="-ansi"/>-->
<arg value="../../src/RunAllTestcases.c"/>
<arg value="../../src/runtime/RunCRuntimeTestcases.c"/>
<arg value="../../src/runtime/TestEtMemory.c"/>
<arg value="../../src/runtime/TestEtMessage.c"/>
<arg value="../../src/runtime/TestEtMessageQueue.c"/>
<arg value="../../src/runtime/TestEtMessageService.c"/>
<arg value="../../src/runtime/TestEtQueue.c"/>
<arg value="../../src/runtime/TestEtTimer.c"/>
<arg value="../../src/runtime/TestEtUnit.c"/>
<arg value="../../src/runtime/helpers/TestEtTimeHelpers.c"/>
<arg value="../../src/runtime/util/TestUtil.c"/>
</exec>
<exec dir="bin/test" executable="${gcc.path}/gcc" failonerror="true" output="${output}/build.txt" append="true">
<arg value="-L${c-runtime.path}/bin"/>
<arg value="-oRuntimeTest.exe"/>
<arg value="RunAllTestcases.o"/>
<arg value="RunCRuntimeTestcases.o"/>
<arg value="TestEtMemory.o"/>
<arg value="TestEtMessage.o"/>
<arg value="TestEtMessageQueue.o"/>
<arg value="TestEtMessageService.o"/>
<arg value="TestEtQueue.o"/>
<arg value="TestEtTimer.o"/>
<arg value="TestEtUnit.o"/>
<arg value="TestEtTimeHelpers.o"/>
<arg value="TestUtil.o"/>
<!-- library has to be in the last position -->
<arg value="-lorg.eclipse.etrice.runtime.c"/>
<arg value="-lpthread"/>
<arg value="-lrt"/>
<arg value="-lm"/>
</exec>
</target>
<!--
run: runs all executables
-->
<target name="run" depends="build">
<mkdir dir="tmp/testlog"/>
<echo>start RuntimeTest</echo>
<exec dir="./" resolveexecutable="true" executable="./bin/test/RuntimeTest.exe" output="${output}/run.txt" />
<echo>end RuntimeTest</echo>
</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.9*.jar" />
<include name="org.eclipse.emf.ecore_2.10*.jar" />
<include name="org.eclipse.emf.ecore.xmi_2.10*.jar" />
<include name="org.eclipse.emf.common_2.10*.jar" />
</fileset>
</path>
<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.runtime.c.tests.TestEtUnitSpecial"/>
<arg value="./tmp/testlog/TestEtUnitSpecial.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.runtime.c.tests.TestCRuntime"/>
<arg value="./tmp/testlog/TestCRuntime.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/testlog/TestEtUnitSpecial.xml" tofile="./tmp/testlog/CTestEtUnitSpecial.xml"/>
<copy todir="${test.results}" >
<fileset dir="./tmp/testlog">
<include name="*.xml"/>
</fileset>
</copy>
</target>
</project>