Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: d2d67ba6f5300675a98425d53cd45ba371b702c0 (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
<?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.
	
	@author Henrik Rentz-Reichert
-->
<project name="project">
	
	<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 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.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="${test.results}"/>
		<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">
		<copy todir="models" >
			<fileset dir="../org.eclipse.etrice.generator.common.tests/models">
				<include name="*.room"/>
			</fileset>
			<fileset dir="../../runtime/org.eclipse.etrice.modellib.java/models">
				<include name="TimingService.room"/>
				<include name="Types.room"/>
			</fileset>
		</copy>
	</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.doc/bin"/>
			<pathelement location="../../plugins/org.eclipse.etrice.generator/bin"/>
			<pathelement location="../../plugins/org.eclipse.etrice.core.genmodel/bin"/>
			<pathelement location="../../plugins/org.eclipse.etrice.core.room/bin"/>
			<pathelement location="../../plugins/org.eclipse.etrice.core.config/bin"/>
			<fileset dir="${target.platform}/plugins/">
				<include name="org.eclipse.emf.ecore_2.8.0*.jar" />
				<include name="org.eclipse.emf.common_2.8.0*.jar" />
				<include name="org.eclipse.emf.ecore.xmi_2.8.0*.jar" />
				<include name="org.eclipse.xtext_2.*.jar" />
				<include name="com.google.inject_*.jar" />
				<include name="com.google.guava_10.*.jar" />
				<include name="org.eclipse.equinox.common_3.6.*.jar" />
				<include name="org.eclipse.xtext.util_2.*.jar" />
				<include name="org.eclipse.xtext.xtend2.lib_2.*.jar" />
				<include name="org.eclipse.xtext.xbase.lib_2.*.jar" />
				<include name="org.apache.log4j_1.2.15*.jar" />
				<include name="org.antlr.runtime_3.2.0*.jar" />
				<include name="javax.inject_1.0.0*.jar" />
			</fileset>
		</path>

		<java output="${output}/generate.txt" classname="org.eclipse.etrice.generator.java.Main" fork="true" failonerror="true">
			<arg value="${java.tests.model.path}/HandlerTest.room"/>
			<arg value="${java.tests.model.path}/ChoicePointTest.room"/>
			<arg value="${modellib.path}/models/TimingService.room"/>
			<arg value="${modellib.path}/models/Types.room"/>
			<classpath refid="clspath"/>
		</java>
	</target>
	
	<!--
		compile: compiles the generated Java sources
	-->
	<target name="compile" depends="generate">
		<mkdir dir="${bin.path}"/>
		<javac srcdir="src-gen"
			 destdir="${bin.path}"
			 classpath="${runtime.path}/bin;${modellib.path}/bin"
			 debug="on"
			/>
	</target>

	<!--
		run: runs all executables
	-->
	<target name="run" depends="compile">
		<mkdir dir="tmp/log"/>
		<java output="${output}/runHandlerTest.txt" classname="HandlerTest.SubSystem_HandlerTestRunner" fork="true" failonerror="true">
			<arg value="-run_as_test"/>
			<classpath path="${bin.path};${runtime.path}/bin;${modellib.path}/bin"/>
		</java>
		<java output="${output}/runChoicePointTest.txt" classname="ChoicePointTest.SubSystem_CPTestRunner" fork="true" failonerror="true">
			<arg value="-run_as_test"/>
			<classpath path="${bin.path};${runtime.path}/bin;${modellib.path}/bin"/>
		</java>
	</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.8.0*.jar" />
				<include name="org.eclipse.emf.ecore_2.8.0*.jar" />
				<include name="org.eclipse.emf.ecore.xmi_2.8.0*.jar" />
				<include name="org.eclipse.emf.common_2.8.0*.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" 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>
	</target>
	
	<!--
		copy_results: copies the *.xml results to their final destination
	-->
	<target name="copy_results" depends="set_tr">
		<copy todir="${test.results}" >
			<fileset dir="./tmp">
				<include name="*.xml"/>
			</fileset>
		</copy>
	</target>
	
</project>

Back to the top