forked from apache/cloudstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-tests.xml
More file actions
executable file
·319 lines (273 loc) · 12.9 KB
/
Copy pathbuild-tests.xml
File metadata and controls
executable file
·319 lines (273 loc) · 12.9 KB
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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="Cloud Stack Tests" default="help" basedir=".">
<description>
Cloud Stack ant build file
</description>
<!--
Always use this variable to refer to the base directory because this
variable is changeable
-->
<dirname property="base.dir" file="${ant.file.Cloud Stack Tests}/.." />
<property name="build.dir" location="${base.dir}/build" />
<import file="${build.dir}/build-cloud.xml" optional="false" />
<property name="server.test.dir" location="${server.dir}/test" />
<property name="core.test.dir" location="${core.dir}/test/" />
<property name="agent.test.dir" location="${utils.dir}/test/" />
<!-- directories for agent simulator code compilation-->
<property name="agent-simulator.dir" location="${base.dir}/agent-simulator" />
<property name="agent-simulator.dist.dir" location="${dist.dir}/agent-simulator" />
<!-- directories for the test client code compilation-->
<property name="testclient.dir" location="${base.dir}/test" />
<property name="testclient.dist.dir" location="${dist.dir}/test" />
<property name="tools.dist.dir" location="${dist.dir}/cloudapitools" />
<property name="test.target.dir" location="${target.dir}/test" />
<property name="test.classes.dir" location="${test.target.dir}/classes"/>
<property name="agent-simulator.jar" value="cloud-agent-simulator.jar" />
<property name="testclient.jar" value="cloud-test.jar" />
<property name="simulator.setup.dir" value="${base.dir}/setup/db/" />
<property name="marvin.sandbox.dir" value="${base.dir}/tools/marvin/marvin/sandbox/" />
<property name="marvin.config" value="${base.dir}/tools/marvin/marvin/sandbox/demo/simulator/simulator.cfg" />
<property name="marvin.config.abspath" location="${marvin.config}" />
<!-- =================== Agent Simulator ==================== -->
<path id="agent-simulator.classpath">
<path refid="deps.classpath" />
<path refid="dist.classpath" />
</path>
<target name="compile-agent-simulator" depends="-init, compile-api, compile-utils, compile-core, compile-agent, compile-server" description="Compile the agent simulator.">
<compile-java jar.name="${agent-simulator.jar}" top.dir="${agent-simulator.dir}" classpath="agent-simulator.classpath" />
<copy overwrite="true" todir="${server.dist.dir}/conf">
<fileset dir="${agent-simulator.dir}/tomcatconf">
<include name="*.in" />
</fileset>
<globmapper from="*.in" to="*" />
</copy>
</target>
<target name="build-agent-simulator" depends="-init, compile-agent-simulator">
<mkdir dir="${agent-simulator.dist.dir}" />
<mkdir dir="${agent-simulator.dist.dir}/conf" />
<mkdir dir="${agent-simulator.dist.dir}/logs" />
<copy todir="${agent-simulator.dist.dir}">
<fileset dir="${jar.dir}">
<include name="${agent-simulator.jar}" />
<include name="${agent.jar}" />
<include name="${utils.jar}" />
<include name="${core.jar}" />
<include name="${api.jar}" />
</fileset>
<fileset dir="${deps.dir}">
<include name="log4j-1.2.15.jar" />
<include name="gson-1.3.jar" />
<include name="commons-logging-1.1.1.jar" />
<include name="commons-collections-3.2.1.jar" />
</fileset>
</copy>
<copy overwrite="true" todir="${server.dist.dir}/conf">
<fileset dir="${agent-simulator.dir}/tomcatconf">
<include name="*.in" />
</fileset>
<globmapper from="*.in" to="*" />
</copy>
<copy todir="${agent-simulator.dist.dir}/conf">
<fileset dir="${agent.dir}/conf">
<include name="log4j-cloud.xml" />
</fileset>
</copy>
</target>
<!-- =================== Agent Simulator ==================== -->
<!-- Run Simulator Tests -->
<target name="setup-simulator" depends="clean-all">
<mkdir dir="${simulator.setup.dir}/override">
</mkdir>
<copy overwrite="true" file="${simulator.setup.dir}/templates.simulator.sql" tofile="${simulator.setup.dir}/override/templates.sql" />
<mkdir dir="${build.dir}/override">
</mkdir>
<copy overwrite="true" file="${build.dir}/replace.properties" tofile="${build.dir}/override/replace.properties" />
<!-- Replace the COMPONENT-SPEC for components-simulator.xml -->
<copy overwrite="true" file="${build.dir}/simulator.properties" tofile="${build.dir}/override/replace.properties" />
</target>
<target name="run-simulator" depends="setup-simulator, build-all-with-simulator, deploy-server, deploydb-simulator, debug">
</target>
<target name="run-marvin" depends="install-marvin">
<exec dir="${marvin.sandbox.dir}/" executable="bash">
<arg line="run-marvin.sh -d localhost -m localhost -c ${marvin.config.abspath}" />
</exec>
</target>
<!-- -->
<!-- =================== QA Testing Client ==================== -->
<target name="-init-test" depends="-init">
<mkdir dir="${test.target.dir}" />
<mkdir dir="${test.classes.dir}" />
</target>
<path id="testclient.classpath">
<path refid="deps.classpath" />
<path refid="dist.classpath" />
</path>
<target name="compile-testclient" depends="-init-test, compile-utils" description="Compile the test client.">
<echo message="src is ${testclient.dir}"/>
<compile-java jar.name="${testclient.jar}" top.dir="${testclient.dir}" classpath="testclient.classpath" />
</target>
<target name="build-testclient" depends="-init-test, compile-testclient">
<mkdir dir="${testclient.dist.dir}/src" />
<mkdir dir="${testclient.dist.dir}/conf" />
<mkdir dir="${testclient.dist.dir}/metadata" />
<mkdir dir="${testclient.dist.dir}/usage" />
<copy todir="${testclient.dist.dir}/src">
<fileset dir="${jar.dir}">
<include name="${testclient.jar}" />
<include name="${utils.jar}" />
</fileset>
<fileset dir="${deps.dir}">
<include name="commons-httpclient-3.1.jar" />
<include name="commons-logging-1.1.1.jar" />
<include name="commons-codec-1.4.jar" />
<include name="log4j.jar" />
<include name="log4j-extras.jar" />
<include name="trilead-ssh2-build213.jar" />
<include name="mysql-connector-java-5.1.7-bin.jar" />
</fileset>
</copy>
<copy overwrite="true" todir="${testclient.dist.dir}/conf">
<fileset dir="${testclient.dir}/conf">
<include name="log4j.properties" />
<include name="templates.sql" />
<include name="deploy.xml" />
<include name="config.xml" />
<include name="tool.properties" />
</fileset>
</copy>
<copy overwrite="true" todir="${testclient.dist.dir}/scripts">
<fileset dir="${testclient.dir}/scripts" />
</copy>
<copy overwrite="true" todir="${testclient.dist.dir}/metadata">
<fileset dir="${testclient.dir}/metadata" />
</copy>
<copy todir="${testclient.dist.dir}/usage" overwrite="true">
<fileset dir="${testclient.dir}/scripts/usage" />
</copy>
<copy overwrite="true" todir="${testclient.dist.dir}">
<fileset dir="${testclient.dir}/conf/">
<include name="deploy.properties" />
</fileset>
</copy>
<chmod file="${testclient.dist.dir}/scripts/deploy.sh" perm="uog+xr" />
<chmod file="${testclient.dist.dir}/scripts/cleanup.sh" perm="uog+xr" />
<chmod file="${testclient.dist.dir}/scripts/cleanparallel.sh" perm="uog+xr" />
<chmod file="${testclient.dist.dir}/scripts/deploycluster.sh" perm="uog+xr" />
</target>
<target name="build-tools" depends="-init-test, compile-testclient">
<mkdir dir="${tools.dist.dir}/src" />
<mkdir dir="${tools.dist.dir}/conf" />
<copy todir="${tools.dist.dir}/src">
<fileset dir="${jar.dir}">
<include name="${testclient.jar}" />
<include name="${utils.jar}" />
</fileset>
<fileset dir="${deps.dir}">
<include name="commons-httpclient-3.1.jar" />
<include name="commons-logging-1.1.1.jar" />
<include name="commons-codec-1.4.jar" />
<include name="log4j-1.2.15.jar" />
<include name="apache-log4j-extras-1.0.jar" />
<include name="trilead-ssh2-build213.jar" />
<include name="mysql-connector-java-5.1.7-bin.jar" />
</fileset>
</copy>
<copy overwrite="true" todir="${tools.dist.dir}/conf">
<fileset dir="${testclient.dir}/conf">
<include name="tool.properties" />
<include name="log4j.properties" />
</fileset>
</copy>
<copy overwrite="true" todir="${tools.dist.dir}">
<fileset dir="${testclient.dir}/scripts" >
<include name="certSubmitEC2.sh" />
<include name="certDeleteEC2.sh" />
<include name="sign.sh" />
</fileset>
<fileset dir="${testclient.dir}/conf">
<include name="README" />
</fileset>
</copy>
<chmod file="${tools.dist.dir}/certSubmitEC2.sh" perm="a+xr" />
<chmod file="${tools.dist.dir}/certDeleteEC2.sh" perm="a+xr" />
<chmod file="${tools.dist.dir}/sign.sh" perm="a+xr" />
</target>
<target name="-clean-test">
<delete dir="${test.classes.dir}" />
<delete dir="${test.target.dir}" />
</target>
<!-- =================== QA Testing Client ==================== -->
<!-- ============== Server Testing =============== -->
<target name="compile-server-test" depends="-init-test, compile-server" description="Compile all the source code in the server directory">
<property name="server.test.target.dir" location="${test.classes.dir}/server" />
<property name="jarname" value="server-test.jar" />
<mkdir dir="${server.test.target.dir}" />
<depend srcdir="${server.test.dir}" destdir="${server.test.target.dir}" cache="${dep.cache.dir}">
</depend>
<javac srcdir="${server.test.dir}" debug="${debug}" debuglevel="${debuglevel}" deprecation="${deprecation}" source="1.5" target="1.5" destdir="${server.test.target.dir}" includeantruntime="false">
<classpath refid="deps.classpath" />
<classpath refid="test.classpath" />
<compilerarg value="-Xlint:all" />
</javac>
<jar jarfile="${test.target.dir}/${jarname}" basedir="${server.test.target.dir}">
<metainf dir="${server.dir}/metadata">
<include name="**/*.xml" />
</metainf>
<manifest>
<attribute name="Class-Path" value="" />
<attribute name="Built-By" value="${built.by}" />
<section name="com/cloud/">
<attribute name="Specification-Title" value="Cloud Stack" />
<attribute name="Specification-Version" value="${version}" />
<attribute name="Specification-Vendor" value="${company.name}" />
<attribute name="Implementation-Title" value="Server" />
<attribute name="Implementation-Version" value="${impl.version}" />
<attribute name="Implementation-Vendor" value="${company.name}" />
</section>
</manifest>
</jar>
</target>
<!-- ====================== XMLTEST Python Based testing ================== -->
<target name="xmltest-translate" description="Translate an XML test file into Python">
<echo message="Translating: ${xmltest}"/>
<exec dir="tools/testClient" executable="python">
<arg line="translator.py -i ${xmltest}"/>
</exec>
</target>
<target name="xmltest-execute" description="Specify XML test file with -Dxmltest=filename" depends="xmltest-translate">
<echo message="Executing: ${xmltest}.py"/>
<exec dir="tools/testClient" executable="python">
<arg line="${xmltest}.py"/>
</exec>
</target>
<target name="xmltest-automated" description="Used to run the daily tests using tools/testClient/automated.xml as the source of tests">
<property name="xmltest" value="automated/automated.xml"/>
<echo message="Running daily test run with ${xmltest}.py"/>
<antcall target="xmltest-execute"/>
</target>
<target name="automated-test-run" description="Run the automated tests in tools/testClient/testcases/automated.xml using the debug server">
<antcall target="build-all"/>
<antcall target="deploy-server"/>
<antcall target="deploydb"/>
<antcall target="start-tomcat"/>
<echo message="running tests..."/>
<antcall target="xmltest-automated"/>
<antcall target="stop-tomcat"/>
<antcall target="clean-tomcat"/>
</target>
<!-- ====================== XMLTEST Python Based testing ================== -->
</project>