pjs/js/rhino/testsrc/build.xml

175 строки
5.9 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<project name="testsrc" basedir="..">
<!--
Location of mozilla/js/tests directory
-->
<property name="test.library.dir" location="../tests" />
<!--
Destination to which testing classes should be built
-->
<property name="test.classes" value="${build.dir}/test/classes" />
<!--
Output directory for HTML files generated by jsdriver
-->
<property name="test.output" value="${build.dir}/test/output" />
<!--
Timeout in milliseconds for tests
-->
<property name="test.timeout" value="60000" />
<!--
Maximum heap size for VM executing test cases.
-->
<property name="test.vm.mx" value="256m" />
<target name="junit-compile">
<mkdir dir="${test.classes}" />
<get src="http://mirrors.ibiblio.org/pub/mirrors/maven2/junit/junit/3.8.2/junit-3.8.2.jar" dest="lib/junit.jar" usetimestamp="true"/>
<javac
srcdir="testsrc"
destdir="${test.classes}" debug="true"
target="${target-jvm}"
source="${source-level}"
>
<classpath>
<pathelement path="lib/junit.jar" />
<pathelement path="${classes}" />
<pathelement path="${test-classes}" />
</classpath>
<include name="org/mozilla/javascript/drivers/StandardTests.java" />
</javac>
<antcall target="copy-files" />
</target>
<target name="compile">
<mkdir dir="${test.classes}" />
<javac
srcdir="testsrc"
destdir="${test.classes}" debug="true"
target="${target-jvm}"
source="${source-level}"
>
<classpath>
<pathelement path="${classes}" />
</classpath>
<sourcepath path="testsrc" />
<include name="org/mozilla/javascript/drivers/JsDriver.java" />
</javac>
<antcall target="copy-files" />
</target>
<target name="copy-files">
<copy todir="${test.classes}">
<fileset dir="testsrc">
<exclude name="**/*.java build.xml"/>
</fileset>
</copy>
</target>
<target name="clean">
<delete dir="${test.classes}" />
</target>
<target name="coverage-instrument">
<get src="http://mirrors.ibiblio.org/pub/mirrors/maven2/emma/emma/2.0.5312/emma-2.0.5312.jar" dest="lib/emma.jar" usetimestamp="true"/>
<get src="http://mirrors.ibiblio.org/pub/mirrors/maven2/emma/emma_ant/2.0.5312/emma_ant-2.0.5312.jar" dest="lib/emma_ant.jar" usetimestamp="true"/>
<property name="coverage.dir" location="${build.dir}/coverage"/>
<property name="coverage.classes.dir" location="${build.dir}/coverage/classes"/>
<mkdir dir="${coverage.classes.dir}"/>
<path id="emma.lib">
<pathelement location="lib/emma.jar" />
<pathelement location="lib/emma_ant.jar" />
</path>
<taskdef resource="emma_ant.properties" classpathref="emma.lib" />
<property name="coverage.instrumentationfile" location="${coverage.dir}/instrumentation"/>
<emma enabled="true">
<instr
instrpath="${classes}" outdir="${coverage.classes.dir}"
outfile="${coverage.instrumentationfile}" mode="copy"/>
</emma>
<copy todir="${coverage.classes.dir}">
<fileset dir="src" excludes="**/*.java"/>
</copy>
<copy todir="${coverage.classes.dir}">
<fileset dir="${classes}"/>
</copy>
<property name="coverage.outfile" location="${coverage.dir}/coverage"/>
</target>
<target name="junit" depends="junit-compile,coverage-instrument">
<junit printsummary="on" fork="true" forkmode="once" maxmemory="${test.vm.mx}" showoutput="true">
<sysproperty key="mozilla.js.tests" value="${test.library.dir}" />
<sysproperty key="mozilla.js.tests.timeout" value="${test.timeout}" />
<sysproperty key="emma.coverage.out.file" value="${coverage.outfile}"/>
<classpath>
<pathelement location="${xbean.jar}"/>
<pathelement location="${jsr173.jar}"/>
<pathelement path="${coverage.classes.dir}" />
<pathelement path="${classes}" />
<pathelement path="${test.classes}" />
<pathelement path="lib/emma.jar"/>
</classpath>
<test name="org.mozilla.javascript.drivers.StandardTests" todir="build/test"/>
<formatter type="plain" usefile="false" />
<formatter type="xml"/>
</junit>
</target>
<target name="junit-coveragereport" depends="junit">
<property name="coverage.report.dir" location="${build.dir}/coverage/report"/>
<mkdir dir="${coverage.report.dir}"/>
<delete dir="${coverage.report.dir}"/>
<mkdir dir="${coverage.report.dir}"/>
<emma enabled="true">
<report>
<fileset dir="${basedir}">
<include name="build/coverage/instrumentation"/>
<include name="build/coverage/coverage"/>
</fileset>
<sourcepath>
<dirset dir="${basedir}">
<include name="src"/>
</dirset>
</sourcepath>
<html outfile="${coverage.report.dir}/index.html"/>
</report>
</emma>
</target>
<target name="jsdriver" depends="compile">
<tstamp>
<format property="test.timestamp" pattern="yyyy.MM.dd.HH.mm.ss" />
</tstamp>
<mkdir dir="${test.output}" />
<java
fork="true"
classname="org.mozilla.javascript.drivers.JsDriver"
maxmemory="${test.vm.mx}"
>
<classpath>
<pathelement location="${xbean.jar}"/>
<pathelement location="${jsr173.jar}"/>
<pathelement path="${classes}" />
<pathelement path="${test.classes}" />
</classpath>
<arg value="-p" />
<arg file="${test.library.dir}" />
<arg value="-f" />
<arg value="${test.output}/rhino-test-results.${test.timestamp}.html" />
<arg value="--timeout" />
<arg value="${test.timeout}" />
</java>
</target>
<target name="copy-source">
<mkdir dir="${dist.dir}/testsrc"/>
<copy todir="${dist.dir}/testsrc">
<fileset dir="testsrc"
includes="**/*.java,**/*.properties,**/*.xml,**/*.html,**/*.skip" />
</copy>
</target>
</project>