view test-ng/build.xml @ 8903:a35de55b9a42

Add Iterable.spliterator()
author briangoetz
date Wed, 26 Jun 2013 15:41:05 -0400
parents 95c666af903d
children f2afea5107e0
line wrap: on
line source
<?xml version="1.0" encoding="UTF-8"?>

<!--
        * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
        * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        *
        * This code is free software; you can redistribute it and/or modify it
        * under the terms of the GNU General Public License version 2 only, as
        * published by the Free Software Foundation.  Oracle designates this
        * particular file as subject to the "Classpath" exception as provided
        * by Oracle in the LICENSE file that accompanied this code.
        *
        * This code is distributed in the hope that it will be useful, but WITHOUT
        * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        * version 2 for more details (a copy is included in the LICENSE file that
        * accompanied this code).
        *
        * You should have received a copy of the GNU General Public License version
        * 2 along with this work; if not, write to the Free Software Foundation,
        * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
        *
        * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
        * or visit www.oracle.com if you need additional information or have any
        * questions.
-->

<project name="jdk" default="test">

    <property name="build.dir" value="../../build/test-ng" />
    <property name="tests.classes.dir" value="${build.dir}/test-classes"/>
    <property name="mangled.jdk.dir" value="${build.dir}/mangled-jdk"/>
    <property name="mangled.bootlib.dir" value="${build.dir}/mangled-bootlib"/>
    <property name="mangled.boottests.dir" value="${build.dir}/mangled-boottests"/>
    <property name="mangled.tests.dir" value="${build.dir}/mangled-testclasses"/>
    <property name="boottests.classes.dir" value="${build.dir}/boottest-classes"/>
    <property name="bootlib.classes.dir" value="${build.dir}/test-bootlib"/>
    <property name="test.reports.dir" value="${build.dir}/test-reports"/>
    <property name="lambda.test.dir" value="../test/jdk/lambda" />
    <property name="spliterator.test.dir" value="../test/java/util/Spliterator" />
    <property name="tests.src.dir" value="../test/java/util/stream/test"/>
    <property name="boottests.src.dir" value="../test/java/util/stream/boottest"/>
    <property name="bootlib.src.dir" value="../test/java/util/stream/bootlib"/>
    <property name="lib.dir" location="lib" />
    <property name="test.pattern" value="*" />
    <property name="lambda.metafactory" value="" />
    <property name="generated.dir" value="gen-separate"/>
    <property name="agent.dir"       location="${basedir}/agent"/>
    <property name="agent.jar"       value="${build.dir}/agent/dist/SerializationInjectorAgent.jar" />
    <property name="agent.serial.file" value="${agent.dir}/conf/serialize.list" />
    <property name="agent.rt.jar"    value="${java.home}/lib/rt.jar" />
    <property name="agent.heap.size" value="-Xmx4g"/>
    <property name="parallel.mode"    value="classes" />
    <property name="parallel.suitePool"    value="1" />
    <property name="parallel.providerPool"    value="1" />

    <property name="lib.testng.jar" value="${lib.dir}/testng.jar"/>
    <property name="lib.tools.jar" value="${java.home}/../lib/tools.jar"/>

    <path id="compile.class.path">
        <pathelement location="${bootlib.classes.dir}" />
        <pathelement location="${tests.classes.dir}" />
        <pathelement location="${lib.testng.jar}"/>
        <pathelement location="${lib.tools.jar}"/>
    </path>

    <path id="test.class.path">
        <pathelement location="${tests.classes.dir}" />
        <pathelement location="${lib.testng.jar}"/>
        <pathelement location="${lib.tools.jar}"/>
    </path>

    <path id="mangled.class.path">
        <pathelement location="${mangled.tests.dir}" />
        <pathelement location="${lib.testng.jar}"/>
        <pathelement location="${lib.tools.jar}"/>
    </path>

    <taskdef name="testng" classpathref="test.class.path" classname="org.testng.TestNGAntTask" />

    <target name="prepare">
        <mkdir dir="${build.dir}"/>
        <mkdir dir="${mangled.jdk.dir}"/>
        <mkdir dir="${tests.classes.dir}"/>
        <mkdir dir="${boottests.classes.dir}"/>
        <mkdir dir="${bootlib.classes.dir}"/>
        <mkdir dir="${test.reports.dir}"/>
    </target>

    <target name="test-compile" depends="prepare">
        <javac destdir="${bootlib.classes.dir}" debug="on" srcdir="${bootlib.src.dir}" fork="true"
               classpathref="compile.class.path">
            <compilerarg value="-Xlint:all"/>
            <compilerarg value="-XDignore.symbol.file"/>
        </javac>
        <javac destdir="${tests.classes.dir}" debug="on" srcdir="${tests.src.dir}:${lambda.test.dir}:${spliterator.test.dir}" fork="true"
               classpathref="compile.class.path">
            <compilerarg value="-Xlint:all"/>
            <compilerarg value="-XDignore.symbol.file"/>
        </javac>
        <javac destdir="${boottests.classes.dir}" debug="on" srcdir="${boottests.src.dir}" fork="true"
               classpathref="compile.class.path">
            <compilerarg value="-Xlint:all"/>
            <compilerarg value="-XDignore.symbol.file"/>
        </javac>
   </target>

   <target name="test" depends="test-compile" >
        <echo>Results at: file:${test.reports.dir}/index.html</echo>
        <testng classpathref="test.class.path" outputdir="${test.reports.dir}" listener="org.testng.reporters.DotTestListener">
            <classfileset dir="${tests.classes.dir}" includes="**/${test.pattern}.class"/>
            <classfileset dir="${boottests.classes.dir}" includes="**/${test.pattern}.class"/>
            <jvmarg value="-Xbootclasspath/p:${boottests.classes.dir}"/>
            <jvmarg value="-Xbootclasspath/p:${bootlib.classes.dir}"/>
            <jvmarg value="-Xbootclasspath/p:${lib.testng.jar}"/>
            <jvmarg value="-ea"/>
            <jvmarg value="-esa"/>
            <jvmarg value="-Xverify:all"/>
            <jvmarg value="-Xmx2g"/>
            <sysproperty key="org.openjdk.java.util.stream.tripwire" value="true"/>
        </testng>
    </target>

    <target name="test-libs" depends="test-compile" >
        <echo>Results at: file:${test.reports.dir}/index.html</echo>
        <testng classpathref="test.class.path" outputdir="${test.reports.dir}"
              parallel="${parallel.mode}" suiteThreadPoolSize="${parallel.suitePool}" dataProviderThreadCount="${parallel.providerPool}" >
            <classfileset dir="${tests.classes.dir}" includes="org/openjdk/tests/java/**/*.class"/>
            <classfileset dir="${boottests.classes.dir}" includes="java/**/*.class"/>
            <jvmarg value="-Xbootclasspath/p:${boottests.classes.dir}"/>
            <jvmarg value="-Xbootclasspath/p:${bootlib.classes.dir}"/>
            <jvmarg value="-Xbootclasspath/p:${lib.testng.jar}"/>
            <jvmarg value="-ea" />
            <jvmarg value="-esa" />
            <jvmarg value="-Xverify:all" />
            <jvmarg value="-Xmx2500m" />
            <sysproperty key="org.openjdk.java.util.stream.tripwire" value="true"/>
        </testng>
    </target>

    <target name="test-notlibs" depends="test-compile" >
        <echo>Results at: file:${test.reports.dir}/index.html</echo>
        <testng classpathref="test.class.path" outputdir="${test.reports.dir}"
              parallel="${parallel.mode}" suiteThreadPoolSize="${parallel.suitePool}" dataProviderThreadCount="${parallel.providerPool}" >
            <classfileset dir="${tests.classes.dir}" excludes="org/openjdk/tests/java/**/*.class"/>
            <jvmarg value="-Xbootclasspath/p:${boottests.classes.dir}"/>
            <jvmarg value="-Xbootclasspath/p:${bootlib.classes.dir}"/>
            <jvmarg value="-Xbootclasspath/p:${lib.testng.jar}"/>
            <jvmarg value="-ea" />
            <jvmarg value="-esa" />
            <jvmarg value="-Xverify:all" />
            <jvmarg value="-Xmx2500m" />
            <sysproperty key="org.openjdk.java.util.stream.tripwire" value="true"/>
        </testng>
    </target>

    <target name="clean" depends="clean-mangler">
        <delete includeEmptyDirs="true" failonerror="false">
            <fileset dir="${build.dir}" />
            <fileset dir="${generated.dir}" />
        </delete>
    </target>

    <!-- mangler related start -->
    <target name="clean-mangler">
        <ant antfile="${agent.dir}/make/build.xml" inheritAll="false"
             target="clean">
        </ant>
    </target>

    <target name="build-mangler">
        <ant antfile="${agent.dir}/make/build.xml" inheritAll="false"
             target="dist">
        </ant>
    </target>

    <target name="mangler-sanity">
        <condition property="agent.rt.jar.available">
            <available file="${agent.rt.jar}"/>
        </condition>
        <echo message="java.home        : ${java.home}"/>
        <echo message="agent.rt.jar     : ${agent.rt.jar}"/>
        <echo message="agent.heap.size  : ${agent.heap.size}"/>
        <fail message="agent.rt.jar was not found, please set it to a valid rt.jar"
              unless="agent.rt.jar.available"/>
    </target>

    <target name="premangle" depends="mangler-sanity, clean, build-mangler, test-compile">
        <!-- Mangle JDK to mangled.jdk.dir (serialization injection only, no SAND) -->
        <delete dir="${mangled.jdk.dir}" />
        <mkdir dir="${mangled.jdk.dir}" />
        <java jar="${agent.jar}" fork="true" >
            <jvmarg value="-Dcom.oracle.lambda.serialize.file=${agent.serial.file}"/>
            <arg value="-s"/>
            <arg value="-o"/>
            <arg value="${mangled.jdk.dir}" />
            <arg value="-s"/>
            <arg value="${agent.rt.jar}"/>
        </java>
        <!-- Mangle boot test classes to mangled.boottests.dir -->
        <delete dir="${mangled.boottests.dir}" />
        <mkdir dir="${mangled.boottests.dir}" />
        <jar destfile="${build.dir}/tmpA.jar" basedir="${boottests.classes.dir}"/>
        <java jar="${agent.jar}" fork="true" >
            <jvmarg value="-Dcom.oracle.lambda.serialize.file=${agent.serial.file}"/>
            <arg value="-o"/>
            <arg value="${mangled.boottests.dir}" />
            <arg value="-s"/>
            <arg value="${build.dir}/tmpA.jar"/>
        </java>
        <!-- Mangle boot test classes to mangled.bootlib.dir (serialization injection only, no SAND) -->
        <delete dir="${mangled.bootlib.dir}" />
        <mkdir dir="${mangled.bootlib.dir}" />
        <jar destfile="${build.dir}/tmpB.jar" basedir="${bootlib.classes.dir}"/>
        <java jar="${agent.jar}" fork="true" >
            <jvmarg value="-Dcom.oracle.lambda.serialize.file=${agent.serial.file}"/>
            <arg value="-s"/>
            <arg value="-o"/>
            <arg value="${mangled.bootlib.dir}" />
            <arg value="${build.dir}/tmpB.jar"/>
        </java>
        <!-- Mangle test classes to mangled.testdir -->
        <delete dir="${mangled.tests.dir}" />
        <mkdir dir="${mangled.tests.dir}" />
        <jar destfile="${build.dir}/tmpC.jar" basedir="${tests.classes.dir}"/>
        <java jar="${agent.jar}" fork="true" >
            <jvmarg value="-Dcom.oracle.lambda.serialize.file=${agent.serial.file}"/>
            <arg value="-o"/>
            <arg value="${mangled.tests.dir}" />
            <arg value="${build.dir}/tmpC.jar"/>
        </java>
    </target>

    <!--
        Some tests are hostile to our serialization testing strategy; these are those where lambdas
        have side-effects on captured arguments, and then we test properties of the captured arguments
        separately.  This is because serialization/deserialization severs the aliasing that this test
        strategy depends on.  So we mark and exclude these classes.
    -->
    <target name="test-mangled" depends="mangler-sanity, test-compile, build-mangler" >
        <testng classpathref="mangled.class.path" outputdir="${test.reports.dir}"
                excludedgroups="serialization-hostile">
            <classfileset dir="${mangled.tests.dir}" includes="org/openjdk/tests/java/**/*.class"
                          excludes="**/SerializedLambdaTest.class"/>
            <classfileset dir="${mangled.boottests.dir}" includes="**/*.class"/>
            <jvmarg value="-Xbootclasspath/p:${agent.jar}"/>
            <jvmarg value="-Xbootclasspath/p:${mangled.jdk.dir}"/>
            <jvmarg value="-Xbootclasspath/p:${mangled.bootlib.dir}"/>
            <jvmarg value="-Xbootclasspath/p:${mangled.boottests.dir}"/>
            <jvmarg value="-Xbootclasspath/p:${lib.testng.jar}"/>
            <!--<jvmarg value="-Dsun.io.serialization.extendedDebugInfo=true" />-->
            <jvmarg value="-ea" />
            <jvmarg value="-esa" />
            <jvmarg value="-Xverify:none" />
            <jvmarg value="${agent.heap.size}"/>
            <sysproperty key="org.openjdk.java.util.stream.tripwire" value="true"/>
            <!-- properties specific to agent config -->
            <jvmarg value="-Dcom.oracle.lambda.store.frames=false"/>
            <jvmarg value="-Dcom.oracle.lambda.nrounds=1"/>
            <jvmarg value="-javaagent:${agent.jar}"/>
        </testng>
    </target>

    <target name="test-mangledp" depends="test-compile, build-mangler" >
        <testng classpathref="mangled.class.path" outputdir="${test.reports.dir}"
                excludedgroups="serialization-hostile">
            <classfileset dir="${mangled.tests.dir}" includes="**/${test.pattern}.class"/>
            <classfileset dir="${mangled.boottests.dir}" includes="**/${test.pattern}.class"/>
            <jvmarg value="-Xbootclasspath/p:${agent.jar}"/>
            <jvmarg value="-Xbootclasspath/p:${mangled.jdk.dir}"/>
            <jvmarg value="-Xbootclasspath/p:${mangled.bootlib.dir}"/>
            <jvmarg value="-Xbootclasspath/p:${mangled.boottests.dir}"/>
            <jvmarg value="-Xbootclasspath/p:${lib.testng.jar}"/>
            <!--<jvmarg value="-Dsun.io.serialization.extendedDebugInfo=true" />-->
            <jvmarg value="-ea" />
            <jvmarg value="-esa" />
            <jvmarg value="-Xverify:none" />
            <jvmarg value="-Xmx2500m" />
            <sysproperty key="org.openjdk.java.util.stream.tripwire" value="true"/>
            <jvmarg value="-javaagent:${agent.jar}"/>
        </testng>
    </target>
    <!-- mangler related,  end -->
</project>