build.xml (fc8fec4e) build.xml (6467ecbf)
1<?xml version="1.0"?>
2<!--***********************************************************
3 *
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the

--- 10 unchanged lines hidden (view full) ---

19 * under the License.
20 *
21 ***********************************************************-->
22
23
24
25<project basedir="." default="test">
26 <property environment="env" />
1<?xml version="1.0"?>
2<!--***********************************************************
3 *
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the

--- 10 unchanged lines hidden (view full) ---

19 * under the License.
20 *
21 ***********************************************************-->
22
23
24
25<project basedir="." default="test">
26 <property environment="env" />
27 <property file="build.properties" />
28 <property name="env.DISPLAY" value=":0.0"/>
29 <property name="env.TESTSPACE" value="testspace" />
30 <property name="env.JUNIT_HOME" value="external/junit" />
31 <property name="junit.home" value="${env.JUNIT_HOME}" />
27 <property name="junit.home" value="${env.JUNIT_HOME}" />
32 <property name="testspace" value="${env.TESTSPACE}" />
33 <property name="classes" value="${testspace}/class" />
34 <property name="dist" value="${testspace}" />
35 <property name="test.name" value="BVT" />
36 <property name="test.classes" value="testcase/gui/bvt/*.class" />
37 <property name="test.output" value="${testspace}/output" />
38 <property name="test.result" value="${test.output}/result" />
39 <property name="test.report" value="${test.output}/report" />
40 <property name="junit.style.dir" value="reportstyle" />
41
42 <path id="junit.classpath">
43 <fileset dir="${junit.home}" erroronmissingdir="false">
44 <include name="*.jar" />
28 <property name="dist.dir" value="." />
29 <property name="dist.name" value="aoo_test" />
30 <property name="junit.jar.repos" value="http://repo1.maven.org/maven2/junit/junit/4.10/junit-4.10.jar" />
31
32 <path id="uno.classpath">
33 <fileset dir="${env.OUTDIR}" erroronmissingdir="false">
34 <include name="**/juh.jar" />
35 <include name="**/unoil.jar" />
36 <include name="**/ridl.jar" />
37 <include name="**/jurt.jar" />
45 </fileset>
38 </fileset>
39 <fileset dir="${openoffice.home}" erroronmissingdir="false">
40 <include name="**/juh.jar" />
41 <include name="**/unoil.jar" />
42 <include name="**/ridl.jar" />
43 <include name="**/jurt.jar" />
44 </fileset>
46 </path>
45 </path>
47
48 <target name="upgrade">
49 <property name="upgrade.script" location="${java.io.tmpdir}/aoo_test_upgrade.xml"/>
50 <property name="upgrade.to" location="."/>
51 <copy file="build.xml" tofile="${upgrade.script}"/>
52 <condition property="ant.executable" value="ant.bat">
53 <os family="windows" />
54 </condition>
55 <property name="ant.executable" value="ant"/>
56 <exec executable="${ant.executable}" spawn="true">
57 <arg value="-Dupgrade.to=${upgrade.to}"/>
58 <arg value="-f"/>
59 <arg value="${upgrade.script}"/>
60 <arg value="upgrade.run"/>
61 </exec>
46
47 <target name="check.junit">
48 <copy todir="lib" >
49 <fileset dir="${junit.home}" erroronmissingdir="false">
50 <include name="junit*.jar" />
51 </fileset>
52 <globmapper from="*" to="junit.jar" />
53 </copy>
54 <available file="lib/junit.jar" property="junit.jar.exists"/>
62 </target>
63
55 </target>
56
64 <target name="upgrade.run">
65 <property name="testpack.url" value="http://9.123.117.85/testpack/trunk/aoo_test.zip"/>
66 <property name="testack.temp" location="${java.io.tmpdir}/aoo_test.zip"/>
67 <get src="${testpack.url}" dest="${testack.temp}"/>
68 <delete dir="${upgrade.to}" failonerror="false"/>
69 <mkdir dir="${upgrade.to}"/>
70 <unzip src="${testack.temp}" dest="${upgrade.to}"/>
57 <target name="prepare.junit" depends="check.junit" unless="junit.jar.exists">
58 <mkdir dir="lib" />
59 <get src="${junit.jar.repos}" dest="lib/junit.jar" skipexisting="true" />
71 </target>
60 </target>
72
73 <target name="testcommon.init">
74 <mkdir dir="${classes}" />
75 <copy includeemptydirs="false" todir="${classes}">
61
62 <target name="testcommon.init">
63 <mkdir dir="testcommon/bin" />
64 <copy includeemptydirs="false" todir="testcommon/bin">
76 <fileset dir="testcommon/source">
77 <exclude name="**/*.java" />
78 </fileset>
79 </copy>
80 </target>
81
82 <target name="testcommon.compile" depends="testcommon.init, prepare.junit">
65 <fileset dir="testcommon/source">
66 <exclude name="**/*.java" />
67 </fileset>
68 </copy>
69 </target>
70
71 <target name="testcommon.compile" depends="testcommon.init, prepare.junit">
83 <javac destdir="${classes}" debug="on" source="1.6" encoding="utf-8" includeantruntime="false">
72 <javac destdir="testcommon/bin" debug="on" source="1.6" encoding="utf-8" includeantruntime="false">
84 <src path="testcommon/source"/>
85 <classpath>
73 <src path="testcommon/source"/>
74 <classpath>
86 <path refid="junit.classpath"/>
75 <fileset dir="lib">
76 <include name="*.jar" />
77 </fileset>
87 </classpath>
88 </javac>
89 </target>
90
91 <target name="testgui.init">
78 </classpath>
79 </javac>
80 </target>
81
82 <target name="testgui.init">
92 <mkdir dir="${classes}" />
93 <copy includeemptydirs="false" todir="${classes}">
83 <mkdir dir="testgui/bin" />
84 <copy includeemptydirs="false" todir="testgui/bin">
94 <fileset dir="testgui/source">
95 <exclude name="**/*.java" />
96 </fileset>
97 </copy>
98 </target>
99
85 <fileset dir="testgui/source">
86 <exclude name="**/*.java" />
87 </fileset>
88 </copy>
89 </target>
90
100 <target name="testgui.compile" depends="testgui.init, prepare.junit">
101 <javac destdir="${classes}" debug="on" source="1.6" encoding="utf-8" includeantruntime="false">
91 <target name="testgui.compile" depends="testcommon.compile, testgui.init">
92 <javac destdir="testgui/bin" debug="on" source="1.6" encoding="utf-8" includeantruntime="false">
102 <src path="testgui/source"/>
103 <classpath>
93 <src path="testgui/source"/>
94 <classpath>
104 <pathelement location="${classes}" />
105 <path refid="junit.classpath"/>
95 <fileset dir="lib">
96 <include name="*.jar" />
97 </fileset>
98 <pathelement location="testcommon/bin" />
106 </classpath>
107 </javac>
108 </target>
109
110 <target name="testuno.init">
99 </classpath>
100 </javac>
101 </target>
102
103 <target name="testuno.init">
111 <mkdir dir="${classes}" />
112 <copy includeemptydirs="false" todir="${classes}">
104 <mkdir dir="testuno/bin" />
105 <copy includeemptydirs="false" todir="testuno/bin">
113 <fileset dir="testuno/source">
114 <exclude name="**/*.java" />
115 </fileset>
116 </copy>
117 </target>
118
106 <fileset dir="testuno/source">
107 <exclude name="**/*.java" />
108 </fileset>
109 </copy>
110 </target>
111
119 <target name="testuno.compile" depends="testuno.init">
120 <path id="uno.classpath">
121 <fileset dir="${openoffice.home}" erroronmissingdir="false">
122 <include name="**/juh.jar" />
123 <include name="**/unoil.jar" />
124 <include name="**/ridl.jar" />
125 <include name="**/jurt.jar" />
126 </fileset>
127 </path>
128 <javac destdir="${classes}" debug="on" source="1.6" encoding="utf-8" includeantruntime="false">
112 <target name="testuno.compile" depends="testcommon.compile, testuno.init">
113 <javac destdir="testuno/bin" debug="on" source="1.6" encoding="utf-8" includeantruntime="false">
129 <src path="testuno/source"/>
130 <classpath>
114 <src path="testuno/source"/>
115 <classpath>
131 <pathelement location="${classes}" />
132 <path refid="junit.classpath"/>
116 <fileset dir="lib">
117 <include name="*.jar" />
118 </fileset>
119 <pathelement location="testcommon/bin" />
133 <path refid="uno.classpath"/>
134 </classpath>
135 </javac>
136 </target>
137
138 <target name="clean" description="Clean all output">
120 <path refid="uno.classpath"/>
121 </classpath>
122 </javac>
123 </target>
124
125 <target name="clean" description="Clean all output">
139 <delete dir="${testspace}" />
126 <delete dir="testcommon/bin" />
127 <delete dir="testgui/bin" />
128 <delete dir="testuno/bin" />
140 </target>
129 </target>
141
142 <target name="check.junit">
143 <available file="junit.jar" property="junit.jar.exists">
144 <filepath refid="junit.classpath" />
145 </available>
130
131 <target name="compile" depends="testcommon.compile,testgui.compile,testuno.compile" description="Compile source code">
146 </target>
132 </target>
147
148 <target name="prepare.junit" depends="check.junit" unless="junit.jar.exists">
149 <property name="junit.jar.repos" value="http://repo1.maven.org/maven2/junit/junit/4.10/junit-4.10.jar" />
150 <mkdir dir="${junit.home}" />
151 <get src="${junit.jar.repos}" dest="${junit.home}/junit.jar" skipexisting="true" />
133
134 <target name="dist" depends="clean,compile">
135 <tstamp/>
136 <zip destfile="${dist.dir}/${dist.name}_${DSTAMP}.zip" update="false">
137 <zipfileset dir="." includes="lib/**, testcommon/**,testgui/**,testuno/**,build.xml" prefix="aoo_test/"/>
138 <zipfileset dir="." includes="test,test.bat" filemode="751" prefix="aoo_test/"/>
139 </zip>
152 </target>
140 </target>
153
154 <target name="compile" depends="testcommon.init, testcommon.compile, testgui.init, testgui.compile, testuno.init, testuno.compile" description="Compile source code">
141
142 <target name="test" depends="compile" description="start test">
143 <property name="openoffice.home" value=""/>
144 <condition property="test.arg0" value="-Dopenoffice.home=${openoffice.home}">
145 <isset property="openoffice.home" />
146 </condition>
147 <pathconvert property="openoffice.pack" setonempty="false">
148 <path>
149 <fileset dir="${env.SRC_ROOT}/instsetoo_native/${env.INPATH}/OpenOffice/archive/install/en-US" includes="*.tar.gz,*.zip" erroronmissingdir="false"/>
150 </path>
151 </pathconvert>
152 <condition property="test.arg0" value="-Dopenoffice.pack=${openoffice.pack}">
153 <isset property="openoffice.pack" />
154 </condition>
155 <fail message="No OpenOffice available!" unless="test.arg0"/>
156 <condition property="test.executable" value="./test.bat">
157 <os family="windows" />
158 </condition>
159 <echo>${test.arg0}</echo>
160 <property name="test.executable" value="./test"/>
161 <exec executable="${test.executable}">
162 <arg value="${test.arg0}"/>
163 <arg value="-tp"/>
164 <arg value="bvt"/>
165 </exec>
155 </target>
166 </target>
167
168 <target name="upgrade">
169 <property name="upgrade.script" location="${java.io.tmpdir}/aoo_test_upgrade.xml"/>
170 <property name="upgrade.to" location="."/>
171 <copy file="build.xml" tofile="${upgrade.script}"/>
172 <condition property="ant.executable" value="ant.bat">
173 <os family="windows" />
174 </condition>
175 <property name="ant.executable" value="ant"/>
176 <exec executable="${ant.executable}" spawn="true">
177 <arg value="-Dupgrade.to=${upgrade.to}"/>
178 <arg value="-f"/>
179 <arg value="${upgrade.script}"/>
180 <arg value="upgrade.run"/>
181 </exec>
182 </target>
156
183
157 <target name="dist">
158 <tstamp />
159 <tstamp>
160 <format property="testpack.version" pattern="yyyyMMddhhmmss"/>
161 </tstamp>
162 <property name="dist.archive" value="aoo_test_${DSTAMP}.zip" />
163 <echo file="${testpack.version}">${testpack.version}</echo>
164 <zip destfile="${dist}/${dist.archive}" basedir="." update="false" excludes="testspace/**,testassistant/**,testassistant.feature/**,**/bin/**">
165 </zip>
166 <delete file="${testpack.version}"/>
184 <target name="upgrade.run">
185 <property name="testpack.url" value="http://9.123.117.85/testpack/trunk/aoo_test.zip"/>
186 <property name="testack.temp" location="${java.io.tmpdir}/aoo_test.zip"/>
187 <get src="${testpack.url}" dest="${testack.temp}"/>
188 <delete dir="${upgrade.to}" failonerror="false"/>
189 <mkdir dir="${upgrade.to}"/>
190 <unzip src="${testack.temp}" dest="${upgrade.to}"/>
167 </target>
191 </target>
192
193
168
169 <target name="check.build" description="Check the build context">
170 <condition property="openoffice.pack.dir" value="${env.SRC_ROOT}/instsetoo_native/${env.INPATH}/OpenOffice/archive/install/en-US">
171 <isset property="env.SRC_ROOT" />
172 </condition>
173 <condition property="find.build.skip">
174 <or>
175 <isset property="openoffice.pack.url" />

--- 6 unchanged lines hidden (view full) ---

182 <isset property="openoffice.pack.dir" />
183 <isset property="openoffice.home" />
184 </or>
185 </condition>
186 <condition property="install.build.skip">
187 <isset property="openoffice.home" />
188 </condition>
189 </target>
194
195 <target name="check.build" description="Check the build context">
196 <condition property="openoffice.pack.dir" value="${env.SRC_ROOT}/instsetoo_native/${env.INPATH}/OpenOffice/archive/install/en-US">
197 <isset property="env.SRC_ROOT" />
198 </condition>
199 <condition property="find.build.skip">
200 <or>
201 <isset property="openoffice.pack.url" />

--- 6 unchanged lines hidden (view full) ---

208 <isset property="openoffice.pack.dir" />
209 <isset property="openoffice.home" />
210 </or>
211 </condition>
212 <condition property="install.build.skip">
213 <isset property="openoffice.home" />
214 </condition>
215 </target>
190
191 <target name="find.build" unless="find.build.skip" description="Find the newest build on the remote server">
192 <loadresource property="openoffice.build">
193 <url url="${openoffice.build.url}" />
194 <filterchain>
195 <deletecharacters chars=" \t\r\n" />
196 </filterchain>
197 </loadresource>
198
199 <echo message="openoffice.pack.url=${openoffice.archive.url}" file="${testspace}/.temp.properties" />
200 <property file="${testspace}/.temp.properties"/>
201 <property name="openoffice.build.name" value="${openoffice.build}" />
202 <echo>#OpenOffice Build Name: ${openoffice.build.name}</echo>
203 <echo>#OpenOffice Package URL: ${openoffice.pack.url}</echo>
204 </target>
205
206 <target name="download" unless="${skip}">
207 <delete dir="${dest}" />
208 <mkdir dir="${dest}" />
209 <get src="${src}" dest="${dest}" verbose="false" usetimestamp="true" skipexisting="true" />
210 </target>
211
212 <target name="download.build" unless="download.build.skip" description="Download the specified build from the remote server">
213 <property name="openoffice.pack.dir" value="${testspace}/download" />
214 <property name="openoffice.pack.download.mark" value="${testspace}/download/url.txt"/>
215 <loadfile property="openoffice.pack.download.url" srcFile="${openoffice.pack.download.mark}" quiet="true" failonerror="false"/>
216 <condition property="download.build.skip" value="true" else="false">
217 <equals arg1="${openoffice.pack.download.url}" arg2="${openoffice.pack.url}"/>
218 </condition>
219
220 <echo>#Build is Downloaded: ${download.build.skip}</echo>
221 <antcall target="download" inheritAll="false">
222 <param name="skip" value="${download.build.skip}"/>
223 <param name="src" value="${openoffice.pack.url}"/>
224 <param name="dest" value="${openoffice.pack.dir}"/>
225 </antcall>
226 <!--
227 <get src="${openoffice.pack.url}" dest="${openoffice.pack.dir}" verbose="false" usetimestamp="true" skipexisting="true" />
228 -->
229 <echo message="${openoffice.pack.url}" file="${openoffice.pack.download.mark}" />
230 <echo>#OpenOffice Package Dir: ${openoffice.pack.dir}</echo>
231 </target>
232
233 <target name="install.build" unless="install.build.skip" description="Install the build to the local">
234 <property name="openoffice.install.dir" value="${testspace}/install/aoo" />
235 <property name="openoffice.install.temp" value="${testspace}/install/temp" />
236 <delete dir="${openoffice.install.temp}" failonerror="false"/>
237 <mkdir dir="${openoffice.install.temp}" />
238 <unzip dest="${openoffice.install.temp}">
239 <fileset dir="${openoffice.pack.dir}">
240 <include name="**/Apache_OpenOffice*.zip" />
241 </fileset>
242 </unzip>
243 <pathconvert property="gz.files" pathsep=" " setonempty="false">
244 <path>
245 <fileset dir="${openoffice.pack.dir}" includes="Apache_OpenOffice*.gz" />
246 </path>
247 </pathconvert>
248 <exec dir="${openoffice.install.temp}" executable="tar" failifexecutionfails="false">
249 <arg line="-zxpf ${gz.files}" />
250 </exec>
251 <pathconvert property="openoffice.root.dir" pathsep=" " setonempty="false">
252 <path>
253 <dirset dir="${openoffice.install.temp}">
254 <include name="*"/>
255 </dirset>
256 </path>
257 </pathconvert>
258 <delete dir="${openoffice.install.dir}" failonerror="false"/>
259 <move file="${openoffice.root.dir}" tofile="${openoffice.install.dir}" failonerror="false"/>
260 <delete dir="${openoffice.install.temp}" failonerror="false"/>
261 <pathconvert property="openoffice.bin" pathsep=" " setonempty="false">
262 <path>
263 <fileset dir="${openoffice.install.dir}" includes="**/*/soffice.bin" followsymlinks="false" />
264 </path>
265 </pathconvert>
266 <dirname property="openoffice.bin.parent" file="${openoffice.bin}" />
267 <property name="openoffice.home" location="${openoffice.bin.parent}/../" />
268 <fail unless="openoffice.home" />
269 <echo>#Openoffice Home: ${openoffice.home}</echo>
270 </target>
271
272 <target name="run.test" depends="compile, detect.testenv" description="Run junit">
273 <tstamp>
274 <format property="output.stamp" pattern="yyMMdd.hhmm" />
275 </tstamp>
276
277 <move file="${test.output}" tofile="${test.output}.${output.stamp}" failonerror="false" />
278 <mkdir dir="${test.result}" />
279 <mkdir dir="${test.report}" />
280 <mkdir dir="${test.output}/temp" />
281
282 <junit fork="yes" forkmode="once" tempdir="${test.output}/temp" printsummary="yes" showoutput="false" errorProperty="test.failed" failureProperty="test.failed" dir=".">
283 <env key="DISPLAY" value="${env.DISPLAY}"/>
284 <sysproperty key="openoffice.home" value="${openoffice.home}" />
285 <sysproperty key="testspace" value="${testspace}" />
286 <syspropertyset>
287 <propertyref builtin="commandline" />
288 </syspropertyset>
289 <batchtest todir="${test.result}">
290 <fileset dir="${classes}" includes="${test.classes}" />
291 </batchtest>
292
293 <formatter type="xml" />
294 <classpath>
295 <pathelement location="${classes}" />
296 <pathelement location="testgui/data" />
297 <pathelement location="testuno/data" />
298 <path refid="junit.classpath"/>
299 <path refid="uno.classpath"/>
300 </classpath>
301 </junit>
302
303 <junitreport todir="${test.report}">
304 <fileset dir="${test.result}">
305 <include name="TEST-*.xml" />
306 </fileset>
307 <report format="frames" styledir="${junit.style.dir}" todir="${test.report}">
308 <param name="TITLE" expression="${test.name}: ${openoffice.build.name}, ${test.os.name}-${test.os.version}-${test.os.arch}"/>
309 </report>
310 </junitreport>
311 <property name="test.report.index" location="${test.report}/index.html" />
312 <echo>Open ${test.report.index} in browser to view the test report.</echo>
313 </target>
314
315 <target name="test" depends="check.build,find.build,download.build,install.build,run.test" description="Run testing on the specified build. The build is automatically downloaded and installed according to the context.">
316 <fail message="Test Failed" if="test.failed" />
317 </target>
318
319 <target name="detect.testenv">
320 <exec outputproperty="test.os.name" executable="lsb_release" failifexecutionfails="false" os="Linux">
321 <arg line="-is" />
322 </exec>
323 <exec outputproperty="test.os.version" executable="lsb_release" failifexecutionfails="false" os="Linux">
324 <arg line="-rs" />
325 </exec>
326 <property name="test.os.name" value="${os.name}" />
327 <property name="test.os.version" value="${os.version}" />
328 <property name="test.os.arch" value="${os.arch}" />
329 <echo>${test.os.name}-${test.os.version}-${test.os.arch}</echo>
330 <property file="${openoffice.home}/program/versionrc" prefix="openoffice"/>
331 <property file="${openoffice.home}/program/version.ini" prefix="openoffice"/>
332 <property name="openoffice.build.name" value=""/>
333 </target>
334
335
336 <target name="report.test" unless="report.test.skip" description="Upload the testing result to report repository." depends="detect.testenv">
337 <property name="report.to" value="${openoffice.build.name}-${test.name}/${test.os.name}-${test.os.version}-${test.os.arch}" />
338 <echo>Uploading report to ${report.repos}/${report.to}</echo>
339 <property name="report.to.temp" location="${testspace}/.temp.ouput"/>
340 <delete dir="${report.to.temp}" deleteonexit="true"/>
341 <copy todir="${report.to.temp}/${report.to}">
342 <fileset dir="${test.output}" />
343 </copy>
344 <scp todir="${report.repos}" trust="true">
345 <fileset dir="${report.to.temp}"/>
346 </scp>
347 <delete dir="${report.to.temp}" deleteonexit="true"/>
348 </target>
349
350 <target name="detect.build" depends="find.build" description="Check if new build is available. If no new build is available, the target will be failed.">
351 <property name="test.mark.file" location="${testspace}/${test.name}.build"/>
352 <loadfile property="local.build" srcFile="${test.mark.file}" quiet="true" failonerror="false" />
353 <fail message="The build has been tested! We don't want to test it twice.">
354 <condition>
355 <equals arg1="${openoffice.build}" arg2="${local.build}" trim="true" />
356 </condition>
357 </fail>
358 <mkdir dir="${testspace}" />
359 <echo file="${test.mark.file}">${openoffice.build}</echo>
360 </target>
361
362 <target name="routine.test" depends="detect.build,download.build,install.build,run.test,report.test" description="Periodically run testing.">
363 <fail message="Test Failed" if="test.failed" />
364 </target>
365</project>
216</project>