Skip to main content
aboutsummaryrefslogblamecommitdiffstats
blob: ff06266ed5a697591f8d9460ce7c64dd3488fe90 (plain) (tree)
1
2
3
4
5
6
7
8
9


                                                       

                                                                          
   
                                                                                 
 
                                                                     
 


                                                           
 







                                                                                                                                                  

                 


                                                              
                       
                                                                                                                                                      
                 
 
                                                                                 
 
                                                                                            
 







                                                                                                 
                 
                                                                      
 



























                                                                                                                                                                                  
 
            
                                                                   
           




























                                                                                                                                                            
          
<?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="ActorCommunicationTest" models="${models.path}/ActorCommunicationTest.room ${models.path}/GenericPhysical.etphys" />
		<test testid="ChoicePointTest" models="${models.path}/ChoicePointTest.room ${models.path}/GenericPhysical.etphys" />
		<test testid="DataDrivenTest" models="${models.path}/DataDrivenTest.room ${models.path}/GenericPhysical.etphys" />
		<test testid="HandlerTest" models="${models.path}/HandlerTest.room ${models.path}/GenericPhysical.etphys" />
		<test testid="PingPongThreadTest" models="${models.path}/PingPongThreadTest.etmap" />
		<test testid="PingPongThreadReplPortTest" models="${models.path}/PingPongThreadReplPortTest.etmap" />
	</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>
			<standaloneGenerator testId="@{testId}" models="@{models}"/>
			<build testId="@{testId}"/>
			<run testId="@{testId}"/>
			<convert testId="@{testId}"/>
			<copyResult testId="@{testId}" targetId="${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.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}/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}/run.txt" resolveexecutable="true" executable="${bin.path}/@{testId}.exe" timeout="${run.msTimout}">
				<arg value="-run_as_test"/>
			</exec>
		</sequential>
	</macrodef>

</project>

Back to the top