Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 2a27239f06d74add8faa2b6edc1a9f5d3d18d8ae (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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
<?xml version="1.0"?>
<!--
	Ant makefile for building and running of tests.
	This includes invocation of the Java code generator and 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
	
	@author Henrik Rentz-Reichert
-->
<project name="project" default="all">
	
	<property name="java.tests.model.path" value="./models"/>
	<property name="modellib.path" value="../../runtime/org.eclipse.etrice.modellib.java"/>
	<property name="runtime.path" value="../../runtime/org.eclipse.etrice.runtime.java"/>
	<property name="bin.path" value="./bin"/>
	<property name="xml.output" value="./tmp"/>
	<property name="output" value="./output"/>
	<property environment="env"/>
	
	<!--
		all: copies the models, generates, compiles, runs, converts and copies the results
	-->
	<target name="all" depends="convert,copy_results">
		<echo>done with org.eclipse.etrice.generator.java.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>
	
	<!--
		clean: deletes all folders created by this script
	-->
	<target name="clean" depends="set_tr">
		<delete dir="${bin.path}"/>
		<delete dir="models"/>
		<delete dir="${output}"/>
		<delete dir="src-gen"/>
		<delete dir="tmp"/>
	</target>
	
	<!--
		copy_models: copies the models from their original folders to the build location
	-->
	<target name="copy_models" depends="clean">
		<copy todir="models" >
			<fileset dir="../org.eclipse.etrice.generator.common.tests/models">
				<include name="*.room"/>
				<include name="*.config"/>
				<include name="*.etmap"/>
				<include name="*.etphys"/>
				<include name="*.rt-config"/>
			</fileset>
			<fileset dir="../../runtime/org.eclipse.etrice.modellib.java/model">
				<include name="TimingService.room"/>
				<include name="Types.room"/>
				<include name="TcpService.room"/>
				<include name="Language.room"/>
			</fileset>
		</copy>
		<move file="models/StaticConfigTest_Java.room" toFile="models/StaticConfigTest.room"/>
	</target>
	
	<!--
		generate: invokes the Java generator for the ROOM models
	-->
	<target name="generate" depends="set_tp,copy_models">
		<mkdir dir="${output}"/>
		<path id="clspath">
			<pathelement location="../../plugins/org.eclipse.etrice.generator.java/bin"/>
			<pathelement location="../../plugins/org.eclipse.etrice.generator.config/bin"/>
			<pathelement location="../../plugins/org.eclipse.etrice.generator.doc/bin"/>
			<pathelement location="../../plugins/org.eclipse.etrice.generator/bin"/>
			<pathelement location="../../plugins/org.eclipse.etrice.generator.config/bin"/>
			<pathelement location="../../plugins/org.eclipse.etrice.core.room/bin"/>
			<pathelement location="../../plugins/org.eclipse.etrice.core.etphys/bin"/>
			<pathelement location="../../plugins/org.eclipse.etrice.core.etmap/bin"/>
			<pathelement location="../../plugins/org.eclipse.etrice.core.config/bin"/>
			<pathelement location="../../plugins/org.eclipse.etrice.core.genmodel/bin"/>
			<fileset dir="${target.platform}/plugins/">
				<include name="org.eclipse.emf.ecore_2.9*.jar" />
				<include name="org.eclipse.emf.common_2.9*.jar" />
				<include name="org.eclipse.emf.ecore.xmi_2.9*.jar" />
				<include name="org.eclipse.xtext_2.4*.jar" />
				<include name="com.google.inject_*.jar" />
				<include name="com.google.guava_1*.jar" />
				<include name="org.eclipse.equinox.common_3.6.*.jar" />
				<include name="org.eclipse.xtext.util_2.4*.jar" />
				<include name="org.eclipse.xtend.lib_2.4*.jar" />
				<include name="org.eclipse.xtext.xbase.lib_2.4*.jar" />
				<include name="org.apache.log4j_1.2*.jar" />
				<include name="org.antlr.runtime_3.2*.jar" />
				<include name="javax.inject_1.0*.jar" />
			</fileset>
		</path>

		<java output="${output}/generate.txt" error="${output}/generate_err.txt" classname="org.eclipse.etrice.generator.java.Main" fork="true" failonerror="true">
			<arg value="${java.tests.model.path}/generator.java.tests.config"/>
			<arg value="${java.tests.model.path}/generator.java.tests.etmap"/>
			<classpath refid="clspath"/>
		</java>
	</target>
	
	<!--
		compile: compiles the generated Java sources
	-->
	<target name="compile" depends="generate">
		<!-- introduced this indirection to be able to log the output -->
		<ant antfile="make.xml" target="logged_compile" output="${output}/compile.txt">
		</ant>
	</target>

	<!-- set debug and verbose to on to produce more output -->
	<target name="logged_compile">
		<mkdir dir="${bin.path}"/>
		<javac srcdir="src-gen:src"
			 destdir="${bin.path}"
			 classpath="${runtime.path}/bin"
			 debug="off"
			 verbose="off"
			/>
	</target>
	
	<!--
		run: runs all executables
	-->
	<target name="run" depends="compile">
		<mkdir dir="tmp/log"/>
		<echo>start HandlerTest</echo>
		<java output="${output}/runHandlerTest.txt" classname="HandlerTest.Node_node3_hdTestRunner" fork="true" failonerror="true">
			<arg value="-run_as_test"/>
			<classpath path="${bin.path};${runtime.path}/bin;${modellib.path}/bin"/>
		</java>
		<echo>end   HandlerTest</echo>
		<echo>start ChoicePointTest</echo>
		<java output="${output}/runChoicePointTest.txt" classname="ChoicePointTest.Node_node1_cpTestRunner" fork="true" failonerror="true">
			<arg value="-run_as_test"/>
			<classpath path="${bin.path};${runtime.path}/bin;${modellib.path}/bin"/>
		</java>
		<echo>end   ChoicePointTest</echo>
		<echo>start PingPongThreadTest</echo>
		<java output="${output}/runPingPongThreadTest.txt" classname="PingPongThreadTest.Node_node6_ppTestRunner" fork="true" failonerror="true">
			<arg value="-run_as_test"/>
			<classpath path="${bin.path};${runtime.path}/bin;${modellib.path}/bin"/>
		</java>
		<echo>end   PingPongThreadTest</echo>
		<echo>start PingPongThreadTestReplPort</echo>
		<java output="${output}/runPingPongThreadReplPortTest.txt" classname="PingPongThreadTestReplPort.Node_node7_prTestRunner" fork="true" failonerror="true">
			<arg value="-run_as_test"/>
			<classpath path="${bin.path};${runtime.path}/bin;${modellib.path}/bin"/>
		</java>
		<echo>end   PingPongThreadTestReplPort</echo>
		<echo>start SendingDataTestJava</echo>
		<java output="${output}/runSendingDataTestJava.txt" classname="SendingDataTestJava.Node_node4_sdTestRunner" fork="true" failonerror="true">
			<arg value="-run_as_test"/>
			<classpath path="${bin.path};${runtime.path}/bin;${modellib.path}/bin"/>
		</java>
		<echo>end   SendingDataTestJava</echo>
		<echo>start TCPTest</echo>
		<java output="${output}/runTCPTest.txt" classname="TCPTest.Node_node8_tcTestRunner" fork="true" failonerror="true">
			<arg value="-run_as_test"/>
			<classpath path="${bin.path};${runtime.path}/bin;${modellib.path}/bin"/>
		</java>
		<echo>end   TCPTest</echo>
		<echo>start StaticConfigTest</echo>
		<java output="${output}/runStaticConfigTest.txt" classname="StaticConfigTest.Node_node5_scTestRunner" fork="true" failonerror="true">
			<arg value="-run_as_test"/>
			<classpath path="${bin.path};${runtime.path}/bin;${modellib.path}/bin"/>
		</java>
		<echo>end   StaticConfigTest</echo>
		<echo>start DynamicConfigTest</echo>
		<java output="${output}/runDynamicConfigTest.txt" classname="DynamicConfigTest.Node_node9_dcTestRunner" fork="true" failonerror="true">
			<arg value="-run_as_test"/>
			<classpath path="${bin.path};${runtime.path}/bin;${modellib.path}/bin"/>
		</java>
		<echo>end   DynamicConfigTest</echo>
		<echo>start DataDrivenTest</echo>
		<java output="${output}/runDataDrivenTest.txt" classname="DataDrivenTest.Node_node2_ddTestRunner" fork="true" failonerror="true">
			<arg value="-run_as_test"/>
			<classpath path="${bin.path};${runtime.path}/bin;${modellib.path}/bin"/>
		</java>
		<echo>end   DataDrivenTest</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.9*.jar" />
				<include name="org.eclipse.emf.ecore.xmi_2.9*.jar" />
				<include name="org.eclipse.emf.common_2.9*.jar" />
			</fileset>
		</path>

		<java output="${output}/convert.txt" classname="org.eclipse.etrice.etunit.converter.EtUnitReportConverter" fork="true" failonerror="true">
			<arg value="-suite"/>
			<arg value="org.eclipse.etrice.generator.java.tests.ChoicePointTest"/>
			<arg value="./tmp/ChoicePointTest.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.generator.java.tests.HandlerTest"/>
			<arg value="./tmp/HandlerTest.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.generator.java.tests.PingPongThreadTest"/>
			<arg value="./tmp/PingPongThreadTest.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.generator.java.tests.PingPongThreadTestReplPort"/>
			<arg value="./tmp/PingPongThreadTestReplPort.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.generator.java.tests.SendingDataTest"/>
			<arg value="./tmp/SendingDataTestJava.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.generator.java.tests.TCPTest"/>
			<arg value="./tmp/TCPTest.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.generator.java.tests.StaticConfigTest"/>
			<arg value="./tmp/StaticConfigTest.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.generator.java.tests.DynamicConfigTest"/>
			<arg value="./tmp/DynamicConfigTest.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.generator.java.tests.DataDrivenTest"/>
			<arg value="./tmp/DataDrivenTest.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/HandlerTest.xml" tofile="./tmp/JavaHandlerTest.xml"/>
		<move file="./tmp/ChoicePointTest.xml" tofile="./tmp/JavaChoicePointTest.xml"/>
		<move file="./tmp/StaticConfigTest.xml" tofile="./tmp/JavaStaticConfigTest.xml"/>
		<move file="./tmp/DynamicConfigTest.xml" tofile="./tmp/JavaDynamicConfigTest.xml"/>
		<move file="./tmp/DataDrivenTest.xml" tofile="./tmp/JavaDataDrivenTest.xml"/>
		<copy todir="${test.results}" >
			<fileset dir="./tmp">
				<include name="*.xml"/>
			</fileset>
		</copy>
	</target>
	
</project>

Back to the top