tests.xml revision f297f739a5d87cf4c8cbb21bed39a54e7c5804f5
2cacab200fb387e290386593d9b2fca2e7beef33csovant<!--
2cacab200fb387e290386593d9b2fca2e7beef33csovant ! CDDL HEADER START
2cacab200fb387e290386593d9b2fca2e7beef33csovant !
2cacab200fb387e290386593d9b2fca2e7beef33csovant ! The contents of this file are subject to the terms of the
2cacab200fb387e290386593d9b2fca2e7beef33csovant ! Common Development and Distribution License, Version 1.0 only
2cacab200fb387e290386593d9b2fca2e7beef33csovant ! (the "License"). You may not use this file except in compliance
2cacab200fb387e290386593d9b2fca2e7beef33csovant ! with the License.
2cacab200fb387e290386593d9b2fca2e7beef33csovant !
2cacab200fb387e290386593d9b2fca2e7beef33csovant ! You can obtain a copy of the license at
2cacab200fb387e290386593d9b2fca2e7beef33csovant ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
2cacab200fb387e290386593d9b2fca2e7beef33csovant ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
2cacab200fb387e290386593d9b2fca2e7beef33csovant ! See the License for the specific language governing permissions
2cacab200fb387e290386593d9b2fca2e7beef33csovant ! and limitations under the License.
2cacab200fb387e290386593d9b2fca2e7beef33csovant !
2cacab200fb387e290386593d9b2fca2e7beef33csovant ! When distributing Covered Code, include this CDDL HEADER in each
2cacab200fb387e290386593d9b2fca2e7beef33csovant ! file and include the License file at
2cacab200fb387e290386593d9b2fca2e7beef33csovant ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
2cacab200fb387e290386593d9b2fca2e7beef33csovant ! add the following below this CDDL HEADER, with the fields enclosed
2cacab200fb387e290386593d9b2fca2e7beef33csovant ! by brackets "[]" replaced with your own identifying information:
2cacab200fb387e290386593d9b2fca2e7beef33csovant ! Portions Copyright [yyyy] [name of copyright owner]
2cacab200fb387e290386593d9b2fca2e7beef33csovant !
2cacab200fb387e290386593d9b2fca2e7beef33csovant ! CDDL HEADER END
2cacab200fb387e290386593d9b2fca2e7beef33csovant !
2cacab200fb387e290386593d9b2fca2e7beef33csovant !
2cacab200fb387e290386593d9b2fca2e7beef33csovant ! Copyright 2008 Sun Microsystems, Inc.
2cacab200fb387e290386593d9b2fca2e7beef33csovant ! -->
2cacab200fb387e290386593d9b2fca2e7beef33csovant<project name="tests">
2cacab200fb387e290386593d9b2fca2e7beef33csovant <description>
2cacab200fb387e290386593d9b2fca2e7beef33csovant Execute the tests.
2cacab200fb387e290386593d9b2fca2e7beef33csovant </description>
2cacab200fb387e290386593d9b2fca2e7beef33csovant
2cacab200fb387e290386593d9b2fca2e7beef33csovant <target name="run">
2cacab200fb387e290386593d9b2fca2e7beef33csovant <tstamp>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <format property="tests.run.time" pattern="yyyy.MM.dd-HH.mm.ss"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </tstamp>
2cacab200fb387e290386593d9b2fca2e7beef33csovant
2cacab200fb387e290386593d9b2fca2e7beef33csovant <!-- clean up some -->
2cacab200fb387e290386593d9b2fca2e7beef33csovant <delete dir="${tests.tmp.dir}"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant
2cacab200fb387e290386593d9b2fca2e7beef33csovant <!-- make all the necessary directories for this test run -->
2cacab200fb387e290386593d9b2fca2e7beef33csovant <mkdir dir="${tests.tmp.dir}"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <mkdir dir="${tests.run.dir}/${tests.run.time}"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <mkdir dir="${tests.run.dir}/${tests.run.time}/config"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <mkdir dir="${tests.run.dir}/${tests.run.time}/report"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <!-- these will serve for after-the-fact archiving the logs -->
2cacab200fb387e290386593d9b2fca2e7beef33csovant <mkdir dir="${tests.run.dir}/${tests.run.time}/staf-logs"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <mkdir dir="${tests.run.dir}/${tests.run.time}/server-logs"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <mkdir dir="${tests.run.dir}/${tests.run.time}/coverage"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant
d25372dc8e65a9ed019a88fdf659ca61313f1b31jcduff <!--<delete file="${test.plan.default}"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <for list="${test.plan.list}" param="item">
2cacab200fb387e290386593d9b2fca2e7beef33csovant <sequential>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <echo file="${test.plan.default}" append="true">@{item}
2cacab200fb387e290386593d9b2fca2e7beef33csovant</echo>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </sequential>
d25372dc8e65a9ed019a88fdf659ca61313f1b31jcduff </for>-->
2cacab200fb387e290386593d9b2fca2e7beef33csovant
2cacab200fb387e290386593d9b2fca2e7beef33csovant <!-- generate the timestamped config file that will be used for this run -->
2cacab200fb387e290386593d9b2fca2e7beef33csovant <copy file="${tests.config.stubs}"
2cacab200fb387e290386593d9b2fca2e7beef33csovant tofile="${tests.run.dir}/${tests.run.time}/config/${tests.config.file}">
2cacab200fb387e290386593d9b2fca2e7beef33csovant <filterchain>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <expandproperties/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </filterchain>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </copy>
2cacab200fb387e290386593d9b2fca2e7beef33csovant
2cacab200fb387e290386593d9b2fca2e7beef33csovant <!-- this is a windows-specific measure to replace the windows file
2cacab200fb387e290386593d9b2fca2e7beef33csovant separator by a forward slash. Staf otherwise fails to find the files. -->
2cacab200fb387e290386593d9b2fca2e7beef33csovant <replace file="${tests.run.dir}/${tests.run.time}/config/${tests.config.file}" token="\" value="/"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant
f297f739a5d87cf4c8cbb21bed39a54e7c5804f5csovant <property name="tests.request" value="EXECUTE FILE ${tests.xml} JOBNAME OpenDS_${tests.type} SCRIPTFILE ${tests.run.dir}/${tests.run.time}/config/${tests.config.file} WAIT CLEARLOGS"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant
2cacab200fb387e290386593d9b2fca2e7beef33csovant <echo>While the tests are running you may tail the job logs at</echo>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <echo>${staf.install.dir}/logs/MACHINE/${host.name}</echo>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <echo>Running tests. This will take more than a while.</echo>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <property name="CLASSPATH" value="${staf.lib.dir}/JSTAF.jar${path.separator}${e.CLASSPATH}"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <exec
2cacab200fb387e290386593d9b2fca2e7beef33csovant dir="${staf.bin.dir}"
2cacab200fb387e290386593d9b2fca2e7beef33csovant executable="${staf.executable}"
2cacab200fb387e290386593d9b2fca2e7beef33csovant >
2cacab200fb387e290386593d9b2fca2e7beef33csovant <arg line="LOCAL STAX ${tests.request}"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <env key="CLASSPATH" path="${staf.lib.dir}/JSTAF.jar${path.separator}${e.CLASSPATH}"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <env key="LD_LIBRARY_PATH" value="${staf.lib.dir}"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <env key="STAFCONVDIR" value="${staf.install.dir}/codepage"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <env key="STAFCODEPAGE" value="LATIN_1"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </exec>
2cacab200fb387e290386593d9b2fca2e7beef33csovant
2cacab200fb387e290386593d9b2fca2e7beef33csovant <symlink link="${tests.run.dir}/latest" resource="${tests.run.time}" overwrite="true"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <if>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <available file="${tests.tmp.dir}/${product.name}/logs"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <then>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <echo>Saving server logs</echo>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <copy todir="${tests.run.dir}/${tests.run.time}/server-logs">
2cacab200fb387e290386593d9b2fca2e7beef33csovant <fileset dir="${tests.tmp.dir}/${product.name}/logs"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </copy>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </then>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </if>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <echo>Saving Staf/Stax logs</echo>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <copy todir="${tests.run.dir}/${tests.run.time}/staf-logs">
2cacab200fb387e290386593d9b2fca2e7beef33csovant <fileset dir="${staf.install.dir}/logs"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </copy>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <delete dir="${staf.install.dir}/logs"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <echo>Saving report</echo>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <copy todir="${tests.run.dir}/${tests.run.time}/report">
2cacab200fb387e290386593d9b2fca2e7beef33csovant <fileset dir="${tests.tmp.dir}">
2cacab200fb387e290386593d9b2fca2e7beef33csovant <include name="r*"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </fileset>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </copy>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <delete file="${tests.tmp.dir}/percentage.properties"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </target>
2cacab200fb387e290386593d9b2fca2e7beef33csovant
2cacab200fb387e290386593d9b2fca2e7beef33csovant <target name="configure">
2cacab200fb387e290386593d9b2fca2e7beef33csovant <condition property="already.customized" value="true" else="false">
2cacab200fb387e290386593d9b2fca2e7beef33csovant <available file="${test.plan.custom}" />
2cacab200fb387e290386593d9b2fca2e7beef33csovant </condition>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <if>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <equals arg1="${already.customized}" arg2="true" />
2cacab200fb387e290386593d9b2fca2e7beef33csovant <then>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <input message="A previously customized test plan was detected. Do you want to change the list of suites to run?" validargs="y,n" defaultvalue="n" addproperty="prompt.do" />
2cacab200fb387e290386593d9b2fca2e7beef33csovant </then>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <else>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <echo>No previous customized test plan found.</echo>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <property name="prompt.do" value="y" />
2cacab200fb387e290386593d9b2fca2e7beef33csovant </else>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </if>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <if>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <equals arg1="${prompt.do}" arg2="y" />
2cacab200fb387e290386593d9b2fca2e7beef33csovant <then>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <delete file="${test.plan.custom}" />
2cacab200fb387e290386593d9b2fca2e7beef33csovant
2cacab200fb387e290386593d9b2fca2e7beef33csovant <for param="item">
2cacab200fb387e290386593d9b2fca2e7beef33csovant <dirset dir="${tests.dir}/testcases"
2cacab200fb387e290386593d9b2fca2e7beef33csovant includes="*">
2cacab200fb387e290386593d9b2fca2e7beef33csovant <type type="dir"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </dirset>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <sequential>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <var name="test" unset="true"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <var name="answer" unset="true"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant
2cacab200fb387e290386593d9b2fca2e7beef33csovant <basename property="test" file="@{item}"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <input message="Do you want to execute ${test}?" validargs="y,n" defaultvalue="y" addproperty="answer"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <if>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <equals arg1="${answer}" arg2="y" />
2cacab200fb387e290386593d9b2fca2e7beef33csovant <then>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <echo file="${test.plan.custom}" append="true">${test}
2cacab200fb387e290386593d9b2fca2e7beef33csovant</echo>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </then>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </if>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </sequential>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </for>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </then>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </if>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </target>
2cacab200fb387e290386593d9b2fca2e7beef33csovant
2cacab200fb387e290386593d9b2fca2e7beef33csovant <target name="send-mail-prepare">
2cacab200fb387e290386593d9b2fca2e7beef33csovant <condition property="test.successful">
2cacab200fb387e290386593d9b2fca2e7beef33csovant <available file="${tests.tmp.dir}/my-report.html"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </condition>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <condition property="email.send">
2cacab200fb387e290386593d9b2fca2e7beef33csovant <equals arg1="${email.enabled}" arg2="y"
2cacab200fb387e290386593d9b2fca2e7beef33csovant casesensitive="false" trim="true"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </condition>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </target>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <target name="send-mail-get-percentage" depends="send-mail-prepare" if="test.successful">
2cacab200fb387e290386593d9b2fca2e7beef33csovant <echo>test report found.Proceeding...</echo>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <delete file="${tests.tmp.dir}/percentage.properties"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <copy file="${tests.tmp.dir}/my-report.html" tofile="${tests.tmp.dir}/percentage.properties">
2cacab200fb387e290386593d9b2fca2e7beef33csovant <filterchain>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <linecontains>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <contains value='font size="+2'/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </linecontains>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <tokenfilter>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <replaceregex pattern=".*font size=.+2..(.*\d+)%/font.*" replace="test.percentage=\1"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </tokenfilter>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </filterchain>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </copy>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <property file="${tests.tmp.dir}/percentage.properties"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <echo>Test Success Rate: ${test.percentage}%</echo>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </target>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <target name="send-mail" if="email.send" depends="send-mail-get-percentage">
2cacab200fb387e290386593d9b2fca2e7beef33csovant <condition property="email.send.noauth">
2cacab200fb387e290386593d9b2fca2e7beef33csovant <or>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <not>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <isset property="email.server.user"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </not>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <not>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <length string="${email.server.user}" when="greater"
2cacab200fb387e290386593d9b2fca2e7beef33csovant trim="true" length="0"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </not>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </or>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </condition>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <condition property="email.file"
2cacab200fb387e290386593d9b2fca2e7beef33csovant value="${tests.tmp.dir}/my-report.html"
2cacab200fb387e290386593d9b2fca2e7beef33csovant else="staf-installer/failure.html">
2cacab200fb387e290386593d9b2fca2e7beef33csovant <available file="${tests.tmp.dir}/my-report.html"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </condition>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <condition property="email.subject"
2cacab200fb387e290386593d9b2fca2e7beef33csovant value="FT - Run - ${daily.date} - ${os.name} - ${os.arch} - ${test.percentage}%"
2cacab200fb387e290386593d9b2fca2e7beef33csovant else="FT - Failed -${daily.date} - ${os.name} - ${os.arch}">
2cacab200fb387e290386593d9b2fca2e7beef33csovant <available file="${tests.tmp.dir}/my-report.html"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </condition>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <antcall target="send-mail-noauth"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <antcall target="send-mail-withauth"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </target>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <target name="send-mail-noauth" if="email.send.noauth">
2cacab200fb387e290386593d9b2fca2e7beef33csovant <mail from="${email.from}"
2cacab200fb387e290386593d9b2fca2e7beef33csovant tolist="${email.to}"
2cacab200fb387e290386593d9b2fca2e7beef33csovant subject="${email.subject}"
2cacab200fb387e290386593d9b2fca2e7beef33csovant mailhost="${email.server.host}"
2cacab200fb387e290386593d9b2fca2e7beef33csovant mailport="${email.server.port}"
2cacab200fb387e290386593d9b2fca2e7beef33csovant messagefile="${email.file}"
2cacab200fb387e290386593d9b2fca2e7beef33csovant messagemimetype="text/html" />
2cacab200fb387e290386593d9b2fca2e7beef33csovant </target>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <target name="send-mail-withauth" unless="email.send.noauth">
2cacab200fb387e290386593d9b2fca2e7beef33csovant <mail from="${email.from}"
2cacab200fb387e290386593d9b2fca2e7beef33csovant tolist="${email.to}"
2cacab200fb387e290386593d9b2fca2e7beef33csovant subject="${email.subject}"
2cacab200fb387e290386593d9b2fca2e7beef33csovant mailhost="${email.server.host}"
2cacab200fb387e290386593d9b2fca2e7beef33csovant mailport="${email.server.port}"
2cacab200fb387e290386593d9b2fca2e7beef33csovant user="${email.server.user}"
2cacab200fb387e290386593d9b2fca2e7beef33csovant password="${email.server.pwd}"
2cacab200fb387e290386593d9b2fca2e7beef33csovant messagefile="${email.file}"
2cacab200fb387e290386593d9b2fca2e7beef33csovant messagemimetype="text/html" />
2cacab200fb387e290386593d9b2fca2e7beef33csovant </target>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <target name="coverage-init">
2cacab200fb387e290386593d9b2fca2e7beef33csovant <path id="emma.lib">
2cacab200fb387e290386593d9b2fca2e7beef33csovant <pathelement location="${project.home}/ext/emma/lib/emma.jar" />
2cacab200fb387e290386593d9b2fca2e7beef33csovant <pathelement location="${project.home}/ext/emma/lib/emma_ant.jar" />
2cacab200fb387e290386593d9b2fca2e7beef33csovant </path>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <taskdef resource="emma_ant.properties" classpathref="emma.lib" />
2cacab200fb387e290386593d9b2fca2e7beef33csovant </target>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <target name="coverage-on" depends="coverage-init">
2cacab200fb387e290386593d9b2fca2e7beef33csovant <property name="coverage.on" value="true"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </target>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <target name="coverage-instrument" if="coverage.on">
2cacab200fb387e290386593d9b2fca2e7beef33csovant <delete dir="${tests.tmp.dir}/coverage-instr" />
2cacab200fb387e290386593d9b2fca2e7beef33csovant <mkdir dir="${tests.tmp.dir}/coverage-instr" />
2cacab200fb387e290386593d9b2fca2e7beef33csovant <!-- unzip the original package in a temporary location to make the
2cacab200fb387e290386593d9b2fca2e7beef33csovant changes necessary so that the coverage tool is called
2cacab200fb387e290386593d9b2fca2e7beef33csovant -->
2cacab200fb387e290386593d9b2fca2e7beef33csovant <unzip src="${product.package}"
2cacab200fb387e290386593d9b2fca2e7beef33csovant dest="${tests.tmp.dir}/coverage-instr"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant
2cacab200fb387e290386593d9b2fca2e7beef33csovant <!-- Add emma in the package along with the other librairies
2cacab200fb387e290386593d9b2fca2e7beef33csovant this has the advantage of being automatically picked up by the scripts
2cacab200fb387e290386593d9b2fca2e7beef33csovant -->
2cacab200fb387e290386593d9b2fca2e7beef33csovant <copy file="${project.home}/ext/emma/lib/emma.jar"
2cacab200fb387e290386593d9b2fca2e7beef33csovant tofile="${tests.tmp.dir}/coverage-instr/${product.name}/lib/emma.jar"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant
2cacab200fb387e290386593d9b2fca2e7beef33csovant <!-- move the original product package to make room for the coverage
2cacab200fb387e290386593d9b2fca2e7beef33csovant enabled package
2cacab200fb387e290386593d9b2fca2e7beef33csovant -->
2cacab200fb387e290386593d9b2fca2e7beef33csovant <move file="${product.package}" tofile="${product.package}.nocov"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant
2cacab200fb387e290386593d9b2fca2e7beef33csovant <!-- intrument the OpenDS java archive to gather coverage -->
2cacab200fb387e290386593d9b2fca2e7beef33csovant <java classpath="${tests.tmp.dir}${file.separator}coverage-instr${file.separator}${product.name}${file.separator}lib${file.separator}emma.jar"
2cacab200fb387e290386593d9b2fca2e7beef33csovant classname="emma" fork="true">
2cacab200fb387e290386593d9b2fca2e7beef33csovant <jvmarg value="-Demma.metadata.out.file=${tests.tmp.dir}${file.separator}coverage-instr${file.separator}${product.name}${file.separator}coverage.em" />
2cacab200fb387e290386593d9b2fca2e7beef33csovant <arg value="instr" />
2cacab200fb387e290386593d9b2fca2e7beef33csovant <arg value="-m" />
2cacab200fb387e290386593d9b2fca2e7beef33csovant <arg value="overwrite" />
2cacab200fb387e290386593d9b2fca2e7beef33csovant <arg value="-ip" />
2cacab200fb387e290386593d9b2fca2e7beef33csovant <arg value="${tests.tmp.dir}${file.separator}coverage-instr${file.separator}${product.name}${file.separator}lib${file.separator}OpenDS.jar:${tests.tmp.dir}${file.separator}coverage-instr${file.separator}${product.name}${file.separator}lib${file.separator}extensions${file.separator}snmp-mib2605.jar" />
2cacab200fb387e290386593d9b2fca2e7beef33csovant </java>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <echo>Writing properties file</echo>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <echo file="${tests.tmp.dir}/coverage-instr/${product.name}/classes/emma.properties">coverage.out.file=${tests.tmp.dir}/emma.coverage
2cacab200fb387e290386593d9b2fca2e7beef33csovant </echo>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <!-- Repackage the product with coverage enabled scripts -->
2cacab200fb387e290386593d9b2fca2e7beef33csovant <zip basedir="${tests.tmp.dir}/coverage-instr" destfile="${product.package}">
2cacab200fb387e290386593d9b2fca2e7beef33csovant <zipfileset dir="${tests.tmp.dir}/coverage-instr"
2cacab200fb387e290386593d9b2fca2e7beef33csovant includes="${product.name}/setup,${product.name}/uninstall,${product.name}/upgrade,${product.name}/bin/*,${product.name}/lib/*.sh"
2cacab200fb387e290386593d9b2fca2e7beef33csovant filemode="755" dirmode="755" />
2cacab200fb387e290386593d9b2fca2e7beef33csovant </zip>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <!-- <delete dir="${tests.tmp.dir}/coverage-instr"/> -->
2cacab200fb387e290386593d9b2fca2e7beef33csovant </target>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <target name="coverage-report" if="coverage.on">
2cacab200fb387e290386593d9b2fca2e7beef33csovant <delete dir="${tests.tmp.dir}/coverage/all" />
2cacab200fb387e290386593d9b2fca2e7beef33csovant <mkdir dir="${tests.tmp.dir}/coverage/all" />
2cacab200fb387e290386593d9b2fca2e7beef33csovant <emma enabled="${coverage.on}" >
2cacab200fb387e290386593d9b2fca2e7beef33csovant <report >
2cacab200fb387e290386593d9b2fca2e7beef33csovant <infileset dir="${tests.tmp.dir}" includes="**/*.em,**/*.ec" />
2cacab200fb387e290386593d9b2fca2e7beef33csovant <sourcepath>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <dirset dir="${project.home}" >
2cacab200fb387e290386593d9b2fca2e7beef33csovant <include name="src" />
2cacab200fb387e290386593d9b2fca2e7beef33csovant </dirset>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </sourcepath>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <html outfile="${tests.tmp.dir}/coverage/all/index.html"
2cacab200fb387e290386593d9b2fca2e7beef33csovant columns="name, method, line"
2cacab200fb387e290386593d9b2fca2e7beef33csovant sort="+line, +name"
2cacab200fb387e290386593d9b2fca2e7beef33csovant metrics="line:80"
2cacab200fb387e290386593d9b2fca2e7beef33csovant />
2cacab200fb387e290386593d9b2fca2e7beef33csovant </report>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </emma>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </target>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <target name="restore-pkg" if="coverage.on">
2cacab200fb387e290386593d9b2fca2e7beef33csovant <delete file="${product.package}"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <move file="${product.package}.nocov" tofile="${product.package}"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant </target>
2cacab200fb387e290386593d9b2fca2e7beef33csovant <target name="testwithcoverage" depends="coverage-on,coverage-instrument,restore-pkg,coverage-report"/>
2cacab200fb387e290386593d9b2fca2e7beef33csovant<!-- Run tests section - bottom -->
2cacab200fb387e290386593d9b2fca2e7beef33csovant
2cacab200fb387e290386593d9b2fca2e7beef33csovant</project>