1faa4b864SLei De Bin<?xml version="1.0"?> 27acce70dSLiu Zhe<!--*********************************************************** 37acce70dSLiu Zhe * 47acce70dSLiu Zhe * Licensed to the Apache Software Foundation (ASF) under one 57acce70dSLiu Zhe * or more contributor license agreements. See the NOTICE file 67acce70dSLiu Zhe * distributed with this work for additional information 77acce70dSLiu Zhe * regarding copyright ownership. The ASF licenses this file 87acce70dSLiu Zhe * to you under the Apache License, Version 2.0 (the 97acce70dSLiu Zhe * "License"); you may not use this file except in compliance 107acce70dSLiu Zhe * with the License. You may obtain a copy of the License at 117acce70dSLiu Zhe * 127acce70dSLiu Zhe * http://www.apache.org/licenses/LICENSE-2.0 137acce70dSLiu Zhe * 147acce70dSLiu Zhe * Unless required by applicable law or agreed to in writing, 157acce70dSLiu Zhe * software distributed under the License is distributed on an 167acce70dSLiu Zhe * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 177acce70dSLiu Zhe * KIND, either express or implied. See the License for the 187acce70dSLiu Zhe * specific language governing permissions and limitations 197acce70dSLiu Zhe * under the License. 207acce70dSLiu Zhe * 217acce70dSLiu Zhe ***********************************************************--> 22b164ae3eSLei De Bin 23b164ae3eSLei De Bin 24faa4b864SLei De Bin 25faa4b864SLei De Bin<project basedir="." default="test"> 2609c344eeSLiu Zhe <property environment="env" /> 2709c344eeSLiu Zhe <property file="build.properties" /> 2809c344eeSLiu Zhe <property name="env.DISPLAY" value=":0.0"/> 2909c344eeSLiu Zhe <property name="env.INPATH" value="testspace"/> 3009c344eeSLiu Zhe <property name="env.TESTSPACE" value="${env.INPATH}" /> 3109c344eeSLiu Zhe <property name="env.JUNIT_HOME" value="external/junit" /> 32faa4b864SLei De Bin <property name="junit.home" value="${env.JUNIT_HOME}" /> 33faa4b864SLei De Bin <property name="testspace" value="${env.TESTSPACE}" /> 3409c344eeSLiu Zhe <property name="classes" value="${testspace}/class" /> 3522a14f28SLiu Zhe <property name="dist" value="." /> 36d7740c70SLiu Zhe <property name="test.name" value="BVT" /> 37de586eddSLiu Zhe <property name="test.classes" value="testcase/gui/bvt/*.class" /> 38faa4b864SLei De Bin <property name="test.output" value="${testspace}/output" /> 39faa4b864SLei De Bin <property name="test.result" value="${test.output}/result" /> 40faa4b864SLei De Bin <property name="test.report" value="${test.output}/report" /> 410e2e75f4SLiu Zhe <property name="junit.style.dir" value="reportstyle" /> 427dd2b5bbSLiu Zhe 430e2e75f4SLiu Zhe <path id="junit.classpath"> 44faa4b864SLei De Bin <fileset dir="${junit.home}" erroronmissingdir="false"> 45faa4b864SLei De Bin <include name="*.jar" /> 46faa4b864SLei De Bin </fileset> 47faa4b864SLei De Bin </path> 48faa4b864SLei De Bin 490e2e75f4SLiu Zhe <target name="testcommon.init"> 50faa4b864SLei De Bin <mkdir dir="${classes}" /> 51faa4b864SLei De Bin <copy includeemptydirs="false" todir="${classes}"> 520e2e75f4SLiu Zhe <fileset dir="testcommon/source"> 53faa4b864SLei De Bin <exclude name="**/*.java" /> 54faa4b864SLei De Bin </fileset> 55faa4b864SLei De Bin </copy> 56faa4b864SLei De Bin </target> 57faa4b864SLei De Bin 5822a14f28SLiu Zhe <target name="testcommon.compile" depends="testcommon.init, prepare.junit"> 590e2e75f4SLiu Zhe <javac destdir="${classes}" debug="on" source="1.6" includeantruntime="false"> 600e2e75f4SLiu Zhe <src path="testcommon/source"/> 6122a14f28SLiu Zhe <classpath> 6222a14f28SLiu Zhe <path refid="junit.classpath"/> 6322a14f28SLiu Zhe </classpath> 640e2e75f4SLiu Zhe </javac> 65faa4b864SLei De Bin </target> 66faa4b864SLei De Bin 670e2e75f4SLiu Zhe <target name="testgui.init"> 680e2e75f4SLiu Zhe <mkdir dir="${classes}" /> 690e2e75f4SLiu Zhe <copy includeemptydirs="false" todir="${classes}"> 700e2e75f4SLiu Zhe <fileset dir="testgui/source"> 710e2e75f4SLiu Zhe <exclude name="**/*.java" /> 720e2e75f4SLiu Zhe </fileset> 730e2e75f4SLiu Zhe </copy> 740e2e75f4SLiu Zhe <copy includeemptydirs="false" todir="${classes}"> 750e2e75f4SLiu Zhe <fileset dir="testgui/data"> 760e2e75f4SLiu Zhe <exclude name="**/*.java" /> 770e2e75f4SLiu Zhe </fileset> 780e2e75f4SLiu Zhe </copy> 79faa4b864SLei De Bin </target> 80faa4b864SLei De Bin 810e2e75f4SLiu Zhe <target name="testgui.compile" depends="testgui.init, prepare.junit"> 820e2e75f4SLiu Zhe <javac destdir="${classes}" debug="on" source="1.6" includeantruntime="false"> 830e2e75f4SLiu Zhe <src path="testgui/source"/> 840e2e75f4SLiu Zhe <src path="testgui/data"/> 857acce70dSLiu Zhe <classpath> 867acce70dSLiu Zhe <pathelement location="${classes}" /> 877acce70dSLiu Zhe <path refid="junit.classpath"/> 887acce70dSLiu Zhe </classpath> 890e2e75f4SLiu Zhe </javac> 90faa4b864SLei De Bin </target> 91faa4b864SLei De Bin 920e2e75f4SLiu Zhe <target name="testuno.init"> 930e2e75f4SLiu Zhe <mkdir dir="${classes}" /> 940e2e75f4SLiu Zhe <copy includeemptydirs="false" todir="${classes}"> 950e2e75f4SLiu Zhe <fileset dir="testuno/source"> 960e2e75f4SLiu Zhe <exclude name="**/*.java" /> 970e2e75f4SLiu Zhe </fileset> 980e2e75f4SLiu Zhe </copy> 99faa4b864SLei De Bin </target> 100faa4b864SLei De Bin 10122a14f28SLiu Zhe <target name="testuno.compile" depends="testuno.init"> 1027acce70dSLiu Zhe <path id="uno.classpath"> 1032d64174bSLiu Zhe <fileset dir="${openoffice.home}" erroronmissingdir="false"> 1047acce70dSLiu Zhe <include name="**/juh.jar" /> 1057acce70dSLiu Zhe <include name="**/unoil.jar" /> 1067acce70dSLiu Zhe <include name="**/ridl.jar" /> 1077acce70dSLiu Zhe <include name="**/jurt.jar" /> 1087acce70dSLiu Zhe </fileset> 1097acce70dSLiu Zhe </path> 1100e2e75f4SLiu Zhe <javac destdir="${classes}" debug="on" source="1.6" includeantruntime="false"> 1110e2e75f4SLiu Zhe <src path="testuno/source"/> 1127acce70dSLiu Zhe <classpath> 1137acce70dSLiu Zhe <pathelement location="${classes}" /> 1147acce70dSLiu Zhe <path refid="junit.classpath"/> 1157acce70dSLiu Zhe <path refid="uno.classpath"/> 1167acce70dSLiu Zhe </classpath> 1170e2e75f4SLiu Zhe </javac> 118faa4b864SLei De Bin </target> 119faa4b864SLei De Bin 1200e2e75f4SLiu Zhe <target name="clean" description="Clean all output"> 12109c344eeSLiu Zhe <delete dir="${testspace}" /> 1220e2e75f4SLiu Zhe </target> 1230e2e75f4SLiu Zhe 1240e2e75f4SLiu Zhe <target name="check.junit"> 1250e2e75f4SLiu Zhe <available file="junit.jar" property="junit.jar.exists"> 1260e2e75f4SLiu Zhe <filepath refid="junit.classpath" /> 1270e2e75f4SLiu Zhe </available> 1280e2e75f4SLiu Zhe </target> 1290e2e75f4SLiu Zhe 1300e2e75f4SLiu Zhe <target name="prepare.junit" depends="check.junit" unless="junit.jar.exists"> 1310e2e75f4SLiu Zhe <property name="junit.jar.repos" value="http://repo1.maven.org/maven2/junit/junit/4.10/junit-4.10.jar" /> 1320e2e75f4SLiu Zhe <mkdir dir="${junit.home}" /> 1330e2e75f4SLiu Zhe <get src="${junit.jar.repos}" dest="${junit.home}/junit.jar" skipexisting="true" /> 1340e2e75f4SLiu Zhe </target> 1350e2e75f4SLiu Zhe 1360e2e75f4SLiu Zhe <target name="compile" depends="testcommon.init, testcommon.compile, testgui.init, testgui.compile, testuno.init, testuno.compile" description="Compile source code"> 137faa4b864SLei De Bin </target> 138faa4b864SLei De Bin 13922a14f28SLiu Zhe <target name="dist"> 140faa4b864SLei De Bin <tstamp /> 1410e2e75f4SLiu Zhe <property name="dist.archive" value="aoo_test_${DSTAMP}.zip" /> 14222a14f28SLiu Zhe <zip destfile="${dist}/${dist.archive}" basedir="." update="true" includes="testcommon/**,testgui/**,testuno/**,build.xml,build.example.properties,external/**,reportstyle/**" excludes="**/bin/**"> 14322a14f28SLiu Zhe </zip> 144faa4b864SLei De Bin </target> 145faa4b864SLei De Bin 146faa4b864SLei De Bin <target name="check.build" description="Check the build context"> 147faa4b864SLei De Bin <condition property="openoffice.archive.dir" value="${env.SRC_ROOT}/instsetoo_native/${env.INPATH}/OpenOffice/archive/install/en-US"> 1487acce70dSLiu Zhe <isset property="env.SRC_ROOT" /> 149faa4b864SLei De Bin </condition> 150faa4b864SLei De Bin <condition property="openoffice.build" value="localbuild"> 151faa4b864SLei De Bin <isset property="openoffice.archive.dir" /> 152faa4b864SLei De Bin </condition> 153faa4b864SLei De Bin <condition property="find.build.skip"> 154faa4b864SLei De Bin <or> 155faa4b864SLei De Bin <isset property="openoffice.build" /> 1567dd7871fSLei De Bin <isset property="openoffice.archive.url" /> 157faa4b864SLei De Bin <isset property="openoffice.archive.dir" /> 158faa4b864SLei De Bin <isset property="openoffice.home" /> 159faa4b864SLei De Bin </or> 160faa4b864SLei De Bin </condition> 161faa4b864SLei De Bin <condition property="download.build.skip"> 162faa4b864SLei De Bin <or> 163faa4b864SLei De Bin <isset property="openoffice.archive.dir" /> 164faa4b864SLei De Bin <isset property="openoffice.home" /> 165faa4b864SLei De Bin </or> 166faa4b864SLei De Bin </condition> 167faa4b864SLei De Bin <condition property="install.build.skip"> 1682d64174bSLiu Zhe <or> 1692d64174bSLiu Zhe <isset property="openoffice.home" /> 1702d64174bSLiu Zhe <not> 1712d64174bSLiu Zhe <isset property="openoffice.archive.dir" /> 1722d64174bSLiu Zhe </not> 1732d64174bSLiu Zhe </or> 174faa4b864SLei De Bin </condition> 175faa4b864SLei De Bin </target> 176faa4b864SLei De Bin 177faa4b864SLei De Bin <target name="find.build" unless="find.build.skip" description="Find the newest build on the remote server"> 178faa4b864SLei De Bin <loadresource property="openoffice.build"> 179faa4b864SLei De Bin <url url="${openoffice.build.url}" /> 180faa4b864SLei De Bin <filterchain> 181faa4b864SLei De Bin <deletecharacters chars=" \t\r\n" /> 182faa4b864SLei De Bin </filterchain> 183faa4b864SLei De Bin </loadresource> 184faa4b864SLei De Bin <echo>Latest build: ${openoffice.build}</echo> 185faa4b864SLei De Bin </target> 186faa4b864SLei De Bin 187faa4b864SLei De Bin <target name="download.build" unless="download.build.skip" description="Download the specified build from the remote server"> 18809c344eeSLiu Zhe <echo message="openoffice.archive.url.resolved=${openoffice.archive.url}" file="${testspace}/.temp.properties" /> 18909c344eeSLiu Zhe <property file="${testspace}/.temp.properties"/> 19009c344eeSLiu Zhe <echo>Archive address: ${openoffice.archive.url.resolved}</echo> 191faa4b864SLei De Bin <property name="openoffice.archive.dir" value="${testspace}/download/${openoffice.build}" /> 192faa4b864SLei De Bin <mkdir dir="${openoffice.archive.dir}" /> 19309c344eeSLiu Zhe <get src="${openoffice.archive.url.resolved}" dest="${openoffice.archive.dir}" verbose="false" usetimestamp="true" skipexisting="true" /> 194faa4b864SLei De Bin </target> 195faa4b864SLei De Bin 196faa4b864SLei De Bin <target name="install.build" unless="install.build.skip" description="Install the build to the local"> 19709c344eeSLiu Zhe <property name="openoffice.installation.dir" value="${testspace}/install/${openoffice.build}" /> 19809c344eeSLiu Zhe <property name="openoffice.installation.dest" value="${testspace}/install/dest" /> 19909c344eeSLiu Zhe <delete dir="${openoffice.installation.dest}"/> 20009c344eeSLiu Zhe <mkdir dir="${openoffice.installation.dest}" /> 20109c344eeSLiu Zhe <unzip dest="${openoffice.installation.dest}"> 202faa4b864SLei De Bin <fileset dir="${openoffice.archive.dir}"> 2037acce70dSLiu Zhe <include name="**/Apache_OpenOffice*.zip" /> 204faa4b864SLei De Bin </fileset> 205faa4b864SLei De Bin </unzip> 206faa4b864SLei De Bin <pathconvert property="gz.files" pathsep=" " setonempty="false"> 207faa4b864SLei De Bin <path> 2087acce70dSLiu Zhe <fileset dir="${openoffice.archive.dir}" includes="Apache_OpenOffice*.gz" /> 209faa4b864SLei De Bin </path> 210faa4b864SLei De Bin </pathconvert> 21109c344eeSLiu Zhe <exec dir="${openoffice.installation.dest}" executable="tar" failifexecutionfails="false"> 212d7740c70SLiu Zhe <arg line="-zxpf ${gz.files}" /> 213faa4b864SLei De Bin </exec> 21409c344eeSLiu Zhe 21509c344eeSLiu Zhe <pathconvert property="openoffice.12.dir" pathsep=" " setonempty="false"> 21609c344eeSLiu Zhe <path> 21709c344eeSLiu Zhe <dirset dir="${openoffice.installation.dest}"> 21809c344eeSLiu Zhe <include name="*"/> 21909c344eeSLiu Zhe </dirset> 22009c344eeSLiu Zhe </path> 22109c344eeSLiu Zhe </pathconvert> 22209c344eeSLiu Zhe 22309c344eeSLiu Zhe <move file="${openoffice.12.dir}" tofile="${openoffice.installation.dir}"/> 22409c344eeSLiu Zhe <delete dir="${openoffice.installation.dest}"/> 22509c344eeSLiu Zhe 226faa4b864SLei De Bin <pathconvert property="openoffice.bin" pathsep=" " setonempty="false"> 227faa4b864SLei De Bin <path> 228faa4b864SLei De Bin <fileset dir="${openoffice.installation.dir}" includes="**/*/soffice.bin" followsymlinks="false" /> 229faa4b864SLei De Bin </path> 230faa4b864SLei De Bin </pathconvert> 2312d64174bSLiu Zhe <dirname property="openoffice.bin.parent" file="${openoffice.bin}" /> 2322d64174bSLiu Zhe <property name="openoffice.home" location="${openoffice.bin.parent}/../" /> 233faa4b864SLei De Bin <fail unless="openoffice.home" /> 234faa4b864SLei De Bin <echo>Openoffice is installed to ${openoffice.home}</echo> 235faa4b864SLei De Bin </target> 236faa4b864SLei De Bin 237faa4b864SLei De Bin <target name="run.test" depends="compile" description="Run junit"> 238faa4b864SLei De Bin <tstamp> 239faa4b864SLei De Bin <format property="output.stamp" pattern="yyMMdd.hhmm" /> 240faa4b864SLei De Bin </tstamp> 241faa4b864SLei De Bin 242faa4b864SLei De Bin <move file="${test.output}" tofile="${test.output}.${output.stamp}" failonerror="false" /> 243faa4b864SLei De Bin <mkdir dir="${test.result}" /> 244faa4b864SLei De Bin <mkdir dir="${test.report}" /> 245faa4b864SLei De Bin <mkdir dir="${test.output}/temp" /> 2462d64174bSLiu Zhe 247faa4b864SLei De Bin <junit fork="yes" forkmode="once" tempdir="${test.output}/temp" printsummary="yes" showoutput="false" errorProperty="test.failed" failureProperty="test.failed" dir="."> 24809c344eeSLiu Zhe <env key="DISPLAY" value="${env.DISPLAY}"/> 24909c344eeSLiu Zhe <sysproperty key="openoffice.home" value="${openoffice.home}" /> 250faa4b864SLei De Bin <sysproperty key="testspace" value="${testspace}" /> 251faa4b864SLei De Bin <syspropertyset> 252faa4b864SLei De Bin <propertyref builtin="commandline" /> 253faa4b864SLei De Bin </syspropertyset> 254faa4b864SLei De Bin <batchtest todir="${test.result}"> 255faa4b864SLei De Bin <fileset dir="${classes}" includes="${test.classes}" /> 256faa4b864SLei De Bin </batchtest> 257faa4b864SLei De Bin 258faa4b864SLei De Bin <formatter type="xml" /> 2597acce70dSLiu Zhe <classpath> 2607acce70dSLiu Zhe <pathelement location="${classes}" /> 2617acce70dSLiu Zhe <path refid="junit.classpath"/> 2627acce70dSLiu Zhe <path refid="uno.classpath"/> 2637acce70dSLiu Zhe </classpath> 264faa4b864SLei De Bin </junit> 2659f0b5ddbSLiu Zhe <property file="${openoffice.home}/program/versionrc" prefix="openoffice"/> 2669f0b5ddbSLiu Zhe <property file="${openoffice.home}/program/version.ini" prefix="openoffice"/> 267faa4b864SLei De Bin <junitreport todir="${test.report}"> 268faa4b864SLei De Bin <fileset dir="${test.result}"> 269faa4b864SLei De Bin <include name="TEST-*.xml" /> 270faa4b864SLei De Bin </fileset> 271faa4b864SLei De Bin <report format="frames" styledir="${junit.style.dir}" todir="${test.report}"> 2729f0b5ddbSLiu Zhe <param name="TITLE" expression="Test Build: AOO${openoffice.buildid}.r${openoffice.Revision}, OS: ${os.name}-${os.version}-${os.arch}"/> 273faa4b864SLei De Bin </report> 274faa4b864SLei De Bin </junitreport> 2757acce70dSLiu Zhe <property name="test.report.index" location="${test.report}/index.html" /> 2767acce70dSLiu Zhe <echo>Open ${test.report.index} in browser to view the test report.</echo> 277faa4b864SLei De Bin </target> 278faa4b864SLei De Bin 2790e2e75f4SLiu Zhe <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."> 280faa4b864SLei De Bin <fail message="Test Failed" if="test.failed" /> 281faa4b864SLei De Bin </target> 282d7740c70SLiu Zhe 283d7740c70SLiu Zhe <target name="detect.testenv" unless="report.test.skip"> 284*96b3c68eSLiu Zhe <exec outputproperty="test.os.name" executable="lsb_release" failifexecutionfails="false" os="Linux"> 285d7740c70SLiu Zhe <arg line="-is" /> 286d7740c70SLiu Zhe </exec> 287*96b3c68eSLiu Zhe <exec outputproperty="test.os.version" executable="lsb_release" failifexecutionfails="false" os="Linux"> 288d7740c70SLiu Zhe <arg line="-rs" /> 289d7740c70SLiu Zhe </exec> 290d7740c70SLiu Zhe <property name="test.os.name" value="${os.name}" /> 291d7740c70SLiu Zhe <property name="test.os.version" value="${os.version}" /> 292d7740c70SLiu Zhe <property name="test.os.arch" value="${os.arch}" /> 293d7740c70SLiu Zhe <echo>${test.os.name}-${test.os.version}-${test.os.arch}</echo> 294d7740c70SLiu Zhe </target> 295d7740c70SLiu Zhe 296faa4b864SLei De Bin 297d7740c70SLiu Zhe <target name="report.test" unless="report.test.skip" description="Upload the testing result to report repository." depends="detect.testenv"> 298d7740c70SLiu Zhe <property name="report.to" value="r${openoffice.Revision}/${test.name}/${test.os.name}-${test.os.version}-${test.os.arch}" /> 2997dd2b5bbSLiu Zhe <echo>Uploading report to ${report.repos}/${report.to}</echo> 30009c344eeSLiu Zhe <property name="report.to.temp" location="${testspace}/.temp.ouput"/> 30109c344eeSLiu Zhe <delete dir="${report.to.temp}" deleteonexit="true"/> 3027dd2b5bbSLiu Zhe <copy todir="${report.to.temp}/${report.to}"> 3037dd2b5bbSLiu Zhe <fileset dir="${test.output}" /> 3047dd2b5bbSLiu Zhe </copy> 30509c344eeSLiu Zhe <scp todir="${report.repos}" trust="true"> 3067dd2b5bbSLiu Zhe <fileset dir="${report.to.temp}"/> 3077dd2b5bbSLiu Zhe </scp> 30809c344eeSLiu Zhe <delete dir="${report.to.temp}" deleteonexit="true"/> 309faa4b864SLei De Bin </target> 310faa4b864SLei De Bin 311faa4b864SLei De Bin <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."> 312d7740c70SLiu Zhe <property name="test.mark.file" location="${testspace}/${test.name}.build"/> 313d7740c70SLiu Zhe <loadfile property="local.build" srcFile="${test.mark.file}" quiet="true" failonerror="false" /> 314faa4b864SLei De Bin <fail message="The build has been tested! We don't want to test it twice."> 315faa4b864SLei De Bin <condition> 316faa4b864SLei De Bin <equals arg1="${openoffice.build}" arg2="${local.build}" trim="true" /> 317faa4b864SLei De Bin </condition> 318faa4b864SLei De Bin </fail> 319faa4b864SLei De Bin <mkdir dir="${testspace}" /> 320d7740c70SLiu Zhe <echo file="${test.mark.file}">${openoffice.build}</echo> 321faa4b864SLei De Bin </target> 322faa4b864SLei De Bin 3230e2e75f4SLiu Zhe <target name="routine.test" depends="detect.build,download.build,install.build,run.test,report.test" description="Periodically run testing."> 324faa4b864SLei De Bin <fail message="Test Failed" if="test.failed" /> 325faa4b864SLei De Bin </target> 326faa4b864SLei De Bin</project> 327