build.xml revision d6c71e7b06ef8919af4c8186b4ffb08766c20a09
<!--
! CDDL HEADER START
!
! The contents of this file are subject to the terms of the
! Common Development and Distribution License, Version 1.0 only
! (the "License"). You may not use this file except in compliance
! with the License.
!
! You can obtain a copy of the license at
! See the License for the specific language governing permissions
! and limitations under the License.
!
! When distributing Covered Code, include this CDDL HEADER in each
! file and include the License file at
! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
! add the following below this CDDL HEADER, with the fields enclosed
! by brackets "[]" replaced with your own identifying * information:
! Portions Copyright [yyyy] [name of copyright owner]
!
! CDDL HEADER END
!
!
! Portions Copyright 2006-2007 Sun Microsystems, Inc.
! -->
<project name="opends-tests-integration" basedir="." default="all">
<description>
This is the build script for the functional tests for the
OpenDS Directory Server. See the
BUILDING file in this directory for build instructions.
</description>
<tstamp>
</tstamp>
<property file="/PRODUCT" />
<property name="product.version"
value="${MAJOR_VERSION}.${MINOR_VERSION}${VERSION_QUALIFIER}" />
<!-- in case there's a custom installer properties file -->
<property file="/installer.properties" />
<!-- in case there isn't - load default values -->
<property file="/default.installer.properties" />
<!-- General build-wide properties -->
<property name="tests.build.dir"
location="${opends.dir}/build/integration-tests" />
<property name="tests.classes"
location="${tests.build.dir}/classes" />
<property name="tests.run.dir"
location="${tests.build.dir}" />
<!-- Properties for code coverage -->
<property name="opends.coverage.dir"
location="${opends.build.dir}/coverage" />
<property name="coverage.instr.dir"
location="${opends.coverage.dir}/instrumentedcode" />
<property name="coverage.data.dir"
location="${opends.coverage.dir}/gathereddata" />
<property name="coverage.report.dir"
location="${opends.coverage.dir}/reports" />
<property name="integration.coverage.report.dir"
location="${coverage.report.dir}/integration" />
<property name="global.coverage.report.dir"
location="${coverage.report.dir}/global" />
<!-- assertion to determine the operating system -->
<condition property="isWindows">
<os family="windows"/>
</condition>
<condition property="isUnix">
<not>
<os family="windows"/>
</not>
</condition>
<!-- integration-tests.properties ...
edit or create this file if you need custom port or install path
it can have any of the following properties
see set-default-props target for default values
-->
<property file="integration-tests.properties" />
<target name="set-default-props"
description="defines the default values if no custom values were provided">
<property name="MEM" value="128M" />
</target>
<!-- this is a private target that checks for emma instrumented opends
classes
-->
<target name="check-opends-instrumented">
<available file="${coverage.instr.dir}/org/opends/server"
type="dir"
property="opends.instrumented"
value="true" />
</target>
<target name="coverage"
if="opends.instrumented"
depends="check-opends-instrumented"
description="initialize emma">
<echo message="Found opends emma instrumentation, configuring emma to gather code coverage during integration tests run"/>
<mkdir dir="${coverage.data.dir}" />
<mkdir dir="${coverage.report.dir}" />
<mkdir dir="${global.coverage.report.dir}" />
<mkdir dir="${integration.coverage.report.dir}" />
</target>
<target name="init"
description="initialize properties and create directories to allow for the integration tests to run succesfully"
depends="set-default-props">
<path id="emma.lib">
<pathelement location="${emma.lib.dir}/emma.jar" />
<pathelement location="${emma.lib.dir}/emma_ant.jar" />
</path>
</target>
<!-- The build target that should be used to build everything. -->
<target name="all"
depends="init,clean,tests,bootstrap,run-tests,wipeout"
description="Build using all defined targets." />
<!-- Remove all dynamically-generated build files. -->
<target name="clean"
description="Clean up the compiled integration tests"
depends="set-default-props">
<delete dir="${tests.classes}" />
</target>
<!-- Compile the functional tests source files. -->
<target name="tests"
description="Compile the functional tests source files.">
<mkdir dir="${tests.classes}" />
debug="on" debuglevel="lines,source" source="1.5" target="1.5"
deprecation="true" fork="true" >
<compilerarg value="-Xlint:all" />
<classpath>
<!-- libraries required to build -->
<fileset dir="${lib.dir}">
<include name="*.jar" />
</fileset>
<!-- include the testng library to build the test cases -->
<fileset dir="${testng.lib.dir}">
<include name="*.jar" />
</fileset>
<pathelement location="${opends.classes}" />
</classpath>
</javac>
</target>
<target name="run-tests"
description="run the integration test suite"
depends="init,coverage">
<taskdef resource="testngtasks">
<classpath>
<fileset dir="${testng.lib.dir}">
<include name="*.jar" />
</fileset>
</classpath>
</taskdef>
<mkdir dir="${tests.run.dir}" />
<mkdir dir="${tests.run.dir}/backup" />
<mkdir dir="${tests.run.dir}/logs/tests" />
<mkdir dir="${tests.run.dir}/reports/testng" />
<mkdir dir="${tests.run.dir}/reports/junit" />
<mkdir dir="${tests.run.dir}/logs/server"/>
<echo message="generating tests xml file ..."/>
<copy file="testng.xml.stubs"
tofile="${tests.run.dir}/testng.xml"
overwrite="true" >
<filterchain>
<expandproperties/>
</filterchain>
</copy>
<!-- where for testng to go pick the test suite definition -->
<include name="testng.xml" />
</fileset>
<testng outputdir="${tests.run.dir}/reports/testng"
haltonfailure="true"
enableAssert="false"
listener="org.opends.server.OpenDSTestListener"
verbose="0">
<classpath>
<!-- where to get the instrumented server classes (if built) -->
<pathelement location="${coverage.instr.dir}"/>
<!-- where to get the server classes -->
<pathelement location="${opends.classes}" />
<!-- where to get the testng library -->
<fileset dir="${testng.lib.dir}">
<include name="*.jar" />
</fileset>
<!-- where to get the test classes -->
<pathelement location="${tests.classes}" />
<!-- last but not least, where to get the emma library -->
<path refid="emma.lib"/>
</classpath>
<!--<classfileset dir="${tests.classes}" includes="**/*.class" />-->
<!-- coverage specific jvm options -->
<!-- where to store the run-time coverage data -->
<jvmarg value="-Demma.coverage.out.file=${coverage.data.dir}/integration.emma" />
<!-- do not keep previous run coverage data, start from scratch everytime -->
<jvmarg value="-Demma.coverage.out.merge=false" />
<!-- give the jvm some extra room -->
<jvmarg value="-Xmx${MEM}" />
<jvmarg value="-Xms${MEM}" />
<!-- where to get the test suite definition -->
</testng>
<!-- convert the testng results to junit -->
<junitreport todir="${tests.run.dir}/reports/junit">
<fileset dir="${tests.run.dir}/reports/testng/${SHORT_NAME}">
<include name="integration-tests.xml"/>
</fileset>
</junitreport>
<!-- some cleanup from the tests themselves-->
<delete dir="${tests.run.dir}/backup" />
<!-- save the server log files for issues investigation -->
<copy todir="${tests.run.dir}/logs/server">
<fileset dir="${opends.dir}/build/install/${SHORT_NAME}-${product.version}/logs"/>
</copy>
<emma enabled="${opends.instrumented}" >
<!-- generate the integration test coverage report -->
<report sourcepath="${opends.src}" >
<fileset dir="${coverage.data.dir}" >
<include name="integration.emma" />
<include name="metadata.emma" />
</fileset>
<txt outfile="${integration.coverage.report.dir}/coverage.txt" />
<html outfile="${integration.coverage.report.dir}/index.html" />
</report>
</emma>
<emma enabled="${opends.instrumented}">
<!-- generate the global test coverage report -->
<report sourcepath="${opends.src}" >
<fileset dir="${coverage.data.dir}" >
<include name="*.emma" />
</fileset>
<txt outfile="${global.coverage.report.dir}/coverage.txt" />
<html outfile="${global.coverage.report.dir}/index.html" />
</report>
</emma>
</target>
<target name="bootstrap" >
<ant
antfile="installer.xml"
dir=".."
target="bootstrap"
inheritAll="false" />
</target>
<target name="wipeout">
<ant
antfile="installer.xml"
dir=".."
target="wipeout"
inheritAll="false" />
</target>
</project>