Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 7fe1b251cdfdaaf7e5145540154cd455ccadc488 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
<?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="log"/>
	<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">
		<property name="target.platform" value="${env.ETRICE_TARGET_PLATFORM}"/>
		<echo>using local target platform (${target.platform})</echo>
	</target>

	<!--
		set_tr: sets the test.result property if not set already
	-->
	<target name="set_tr" unless="test.results">
		<property name="test.results" value="./results"/>
		<echo>using local test result folder (${test.results})</echo>
	</target>

	<!--
		set_platform: sets the runtime.platform property if not set already
	-->
	<target name="set_platform" unless="runtime.platform">
		<!--
		<property name="runtime.platform" value="MT_WIN_MinGW"/>
		-->
		<property name="runtime.platform" value="MT_POSIX_GENERIC_GCC"/>
		<echo>using runtime platform ${runtime.platform}</echo>
	</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">
		<property name="c-runtime.path" value="${env.ETRICE_C_RUNTIME}"/>
		<echo>using local runtime folder (${c-runtime.path})</echo>
	</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">
		<property name="gcc.path" value="${env.ETRICE_GCC_PATH}"/>
		<echo>using gcc from path (${gcc.path})</echo>
	</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="log"/>
	</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/TestEtDatatypes.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="TestEtDatatypes.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="log"/>
		<mkdir dir="log/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="./log/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="./log/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="./log/testlog/TestEtUnitSpecial.xml" tofile="./log/testlog/CTestEtUnitSpecial.xml"/>
		<copy todir="${test.results}" >
			<fileset dir="./log/testlog">
				<include name="*.xml"/>
			</fileset>
		</copy>
	</target>
	
</project>

Back to the top