You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by qi...@apache.org on 2009/05/05 09:03:40 UTC
svn commit: r771594 - in /harmony/enhanced/classlib/trunk:
make/build-test.xml make/properties.xml make/run-test.xml
make/test.properties modules/luni/build.xml
Author: qiuxx
Date: Tue May 5 07:03:39 2009
New Revision: 771594
URL: http://svn.apache.org/viewvc?rev=771594&view=rev
Log:
Apply for HARMONY-6083, package the compiled tests into the HDK to reuse, complete testing archive for luni
Added:
harmony/enhanced/classlib/trunk/make/run-test.xml
harmony/enhanced/classlib/trunk/make/test.properties
Modified:
harmony/enhanced/classlib/trunk/make/build-test.xml
harmony/enhanced/classlib/trunk/make/properties.xml
harmony/enhanced/classlib/trunk/modules/luni/build.xml
Modified: harmony/enhanced/classlib/trunk/make/build-test.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/make/build-test.xml?rev=771594&r1=771593&r2=771594&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/make/build-test.xml (original)
+++ harmony/enhanced/classlib/trunk/make/build-test.xml Tue May 5 07:03:39 2009
@@ -53,6 +53,8 @@
</target>
<target name="test-modules" depends="support-jar, test-jre-vm-info">
+ <copy file="${basedir}/make/test.properties" tofile="${hy.hdk}/build/test/test.properties"/>
+ <copy file="${basedir}/make/run-test.xml" tofile="${hy.hdk}/build/test/build.xml"/>
<poll-modules target="-test-module" />
</target>
Modified: harmony/enhanced/classlib/trunk/make/properties.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/make/properties.xml?rev=771594&r1=771593&r2=771594&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/make/properties.xml (original)
+++ harmony/enhanced/classlib/trunk/make/properties.xml Tue May 5 07:03:39 2009
@@ -275,14 +275,6 @@
<property name="build.module" value="*" />
<property name="exclude.module" value="nothing" />
- <!-- names of exclude lists, used by prepare-exclude-list macro -->
- <property name="common.exclude.file" value="exclude.common" />
- <property name="common.exclude.interm" value="exclude.interm" />
- <property name="platform.exclude.file"
- value="exclude.${hy.platform}.${hy.test.vm.name}" />
- <property name="platform.exclude.interm"
- value="exclude.${hy.platform}.${hy.test.vm.name}.interm" />
-
<!-- flags -->
<property name="hy.no.thr" value="false" />
<condition property="hy.skip.thr" value="true">
@@ -578,6 +570,15 @@
<!-- name of concatenated list, should be an absolute pathname -->
<attribute name="result"/>
<sequential>
+ <!-- names of exclude lists, used by prepare-exclude-list macro -->
+ <property name="common.exclude.file" value="exclude.common" />
+ <property name="common.exclude.interm" value="exclude.interm" />
+ <property name="platform.exclude.file"
+ value="exclude.${hy.platform}.${hy.test.vm.name}" />
+ <property name="platform.exclude.interm"
+ value="exclude.${hy.platform}.${hy.test.vm.name}.interm"
+ />
+
<echo message="" file="@{result}"/>
<concat destfile="@{result}" force="yes" fixlastline="yes" append="true">
<fileset dir="@{dir}">
Added: harmony/enhanced/classlib/trunk/make/run-test.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/make/run-test.xml?rev=771594&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/make/run-test.xml (added)
+++ harmony/enhanced/classlib/trunk/make/run-test.xml Tue May 5 07:03:39 2009
@@ -0,0 +1,199 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<project name="Harmony Test" default="test" basedir=".">
+
+ <property file="test.properties" />
+ <property name="build.module" value="all"/>
+ <import file="properties.xml" />
+
+ <!-- These two parameters could be assigned by user -->
+ <property name="target.dir" value="." />
+ <property name="work.dir" value="${target.dir}" />
+ <property name="test.report.dir" value="${work.dir}/report" />
+ <property name="junit.jar" value="${target.dir}/junit.jar" />
+
+ <target name="test" depends="test-jre-vm-info">
+ <echo message="Test Work Dir: ${work.dir}" />
+ <echo message="Test Target Dir: ${target.dir}" />
+ <mkdir dir="${work.dir}" />
+ <delete dir="${test.report.dir}" quiet="true"/>
+ <convert-test-as-class from="test.case" to="converted.tc.class" />
+
+ <antcall target="test-module"/>
+
+ <antcall target="generate-report"/>
+ <antcall target="check-test-result"/>
+ </target>
+
+ <target name="test-module">
+ <antcall target="test-${build.module}"/>
+ </target>
+
+ <target name="test-all">
+ <echo message="Test all modules"/>
+ <!--TODO: will add all modules here -->
+ <antcall target="test-luni"/>
+ </target>
+
+ <target name="test-luni">
+ <run-tests module="luni" jar="luni_tests_api.jar">
+ <junit-elements>
+ <!-- Required by various tests that set security manager etc -->
+ <jvmarg value="-Djava.security.policy=${target.dir}/luni/resources/config/testing.policy" />
+
+ <!-- Required for running the java.net unit tests -->
+ <jvmarg value="-Dtest.ini.file=${target.dir}/luni/resources/config/localhosttest.ini" />
+ </junit-elements>
+ </run-tests>
+
+ <run-tests module="luni" jar="luni_tests_impl.jar">
+ <junit-elements>
+ <!-- Required by various tests that set security manager etc -->
+ <jvmarg value="-Djava.security.policy=${target.dir}/luni/resources/config/testing.policy" />
+
+ <!-- Required for running the java.net unit tests -->
+ <jvmarg value="-Dtest.ini.file=${target.dir}/luni/resources/config/localhosttest.ini" />
+ </junit-elements>
+ </run-tests>
+ </target>
+
+ <target name="touch-failures-file" if="test.failures">
+ <echo file="${work.dir}/report/test.failures" append="true">failure${line.separator}</echo>
+ </target>
+
+ <target name="touch-errors-file" if="test.errors">
+ <echo file="${work.dir}/report/test.errors" append="true">error${line.separator}</echo>
+ </target>
+
+ <target name="check-test-result">
+ <available property="test.errors" file="${work.dir}/report/test.errors" />
+ <available property="test.failures" file="${work.dir}/report/test.failures" />
+ <fail if="test.errors" message="There were test errors." />
+ <fail if="test.failures" message="There were test failures." />
+ </target>
+
+ <target name="generate-report">
+ <junitreport todir="${test.report.dir}">
+ <fileset dir="${test.report.dir}">
+ <include name="**/TEST*-*.xml" />
+ </fileset>
+ <report format="frames" todir="${test.report.dir}" />
+ </junitreport>
+ </target>
+
+ <target name="failure">
+ <fail message="Some tests failed">
+ <condition>
+ <or>
+ <isset property="test.failures" />
+ <isset property="test.errors" />
+ </or>
+ </condition>
+ </fail>
+ </target>
+
+ <macrodef name="run-tests">
+ <attribute name="module" />
+ <attribute name="jar" />
+ <element name="junit-elements" optional="true"/>
+ <element name="excludeorinclude" optional="true"/>
+ <sequential>
+ <echo message="Running @{module} Unit Test from @{jar}" />
+ <echo message="Tested jre: ${test.jre.home}/bin/java" />
+ <property name="test.module.dir" value="${target.dir}/@{module}" />
+ <property name="test.excludes.dir" value="${test.module.dir}/excludes" />
+ <property name="test.resources.dir" value="${test.module.dir}/resources" />
+ <property name="test.exclude.file" value="${work.dir}/@{module}.exclude" />
+
+ <mkdir dir="${test.report.dir}/@{module}" />
+
+ <prepare-exclude-list moduleName="@{module}" dir="${test.excludes.dir}" result="${test.exclude.file}" />
+ <junit fork="yes"
+ forkmode="${hy.test.forkmode}"
+ timeout="${hy.test.timeout}"
+ printsummary="withOutAndErr"
+ errorproperty="test.errors"
+ failureproperty="test.failures"
+ showoutput="on"
+ dir="${work.dir}"
+ tempdir="${work.dir}"
+ jvm="${test.jre.home}/bin/java">
+
+ <classpath>
+ <fileset dir="${target.dir}">
+ <include name="*.jar" />
+ </fileset>
+ <pathelement path="${test.resources.dir}/" />
+ <pathelement path="${test.module.dir}/" />
+ <pathelement location="${test.module.dir}/@{jar}" />
+ </classpath>
+
+ <junit-elements />
+
+ <batchtest todir="${test.report.dir}/@{module}" haltonfailure="no">
+ <zipfileset src="${test.module.dir}/@{jar}">
+ <exclude name="Test.class" />
+ <exclude name="**/*$*" />
+
+ <!-- if ${test.case} -->
+ <include name="${converted.tc.class}" if="test.case" />
+ <!-- unless ${test.case} -->
+ <include name="**/*Test.class" unless="test.case" />
+ <excludesfile name="${test.exclude.file}" unless="test.case"/>
+ <excludeorinclude/>
+ </zipfileset>
+ </batchtest>
+
+ <assertions enableSystemAssertions="true">
+ <enable />
+ </assertions>
+
+ <jvmarg line="${hy.test.vmargs}" />
+ <!-- Used by Support_Exec.execJava() -->
+ <jvmarg value="-Dhy.test.vmargs=${hy.test.vmargs}" />
+
+ <formatter type="xml" />
+ </junit>
+
+ <antcall target="touch-failures-file" />
+ <antcall target="touch-errors-file" />
+
+ </sequential>
+ </macrodef>
+
+ <!-- To use with -Dtest.case=... option -->
+ <!-- if ${test.case} is provided in package+class form -->
+ <!-- it is converted to dir+filename form -->
+ <macrodef name="convert-test-as-class">
+ <attribute name="from" />
+ <attribute name="to" />
+ <sequential>
+ <pathconvert property="@{to}" setonempty="no">
+ <path path="${@{from}}" />
+ <chainedmapper>
+ <filtermapper>
+ <replaceregex pattern="\.java$$" />
+ </filtermapper>
+ <unpackagemapper from="${basedir}${file.separator}*" to="*.class" />
+ </chainedmapper>
+ </pathconvert>
+ </sequential>
+ </macrodef>
+
+</project>
Added: harmony/enhanced/classlib/trunk/make/test.properties
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/make/test.properties?rev=771594&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/make/test.properties (added)
+++ harmony/enhanced/classlib/trunk/make/test.properties Tue May 5 07:03:39 2009
@@ -0,0 +1,32 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements. See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership. The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied. See the License for the
+## specific language governing permissions and limitations
+## under the License.
+## ======================================================================================
+##
+
+
+# Use "ant echo" to get more configuration parameters
+
+
+# To be tested runtime location
+test.jre.home=
+
+# Junit test mode
+hy.test.forkmode=perTest
+
+# Junit test timeout
+hy.test.timeout=900000
+
Modified: harmony/enhanced/classlib/trunk/modules/luni/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/build.xml?rev=771594&r1=771593&r2=771594&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/build.xml (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/build.xml Tue May 5 07:03:39 2009
@@ -27,9 +27,9 @@
<xmlproperty file="make/hyproperties.xml" semanticAttributes="true" />
<property name="hy.luni.src.test.api.java.platform"
- value="${hy.luni.src.test.api}/${hy.os.family}" />
- <property name="hy.luni.src.test.impl.java.platform"
- value="${hy.luni.src.test.impl}/${hy.os.family}" />
+ value="${hy.luni.src.test.api}/${hy.os.family}" />
+ <property name="hy.luni.src.test.impl.java.platform"
+ value="${hy.luni.src.test.impl}/${hy.os.family}" />
<fileset id="classes" dir="${hy.build}">
<or>
<present targetdir="${hy.luni.src.main.java}" />
@@ -41,6 +41,13 @@
</or>
</fileset>
+ <fileset id="tests.api" dir="${hy.luni.bin.test}/api"/>
+ <fileset id="tests.impl" dir="${hy.luni.bin.test}/impl"/>
+
+ <property name="tests.hdk.dir" value="${hy.hdk}/build/test/luni" />
+ <property name="tests.resources.hdk.dir" value="${tests.hdk.dir}/resources" />
+ <property name="tests.excludes.hdk.dir" value="${tests.hdk.dir}/excludes" />
+
<property file="../../make/depends.properties" />
<property name="fdlibm.zip" location="${depends.oss}/fdlibm_5.2.zip" />
@@ -210,7 +217,7 @@
</target>
<!-- internal target for local and global test run sequence -->
- <target name="-test-module" depends="build, compile-tests, prepare-exclude, run-tests" />
+ <target name="-test-module" depends="build, compile-tests, prepare-exclude, test-jar, run-tests" />
<target name="clean" depends="clean-native-includes" >
<delete file="${hy.jdk}/jre/lib/boot/luni.jar" />
@@ -219,6 +226,7 @@
<fileset refid="classes" />
</delete>
<delete failonerror="false" dir="bin"/>
+ <delete dir="${tests.hdk.dir}" quiet="true" />
</target>
<target name="clean-native-includes">
@@ -287,6 +295,55 @@
</jar>
</target>
+ <target name="test-jar" depends="svn-info">
+ <mkdir dir="${tests.hdk.dir}"/>
+
+ <jar destfile="${tests.hdk.dir}/${hy.luni.packaging.jarname}_tests_api.jar">
+ <fileset refid="tests.api" />
+ <manifest>
+ <attribute name="Implementation-Version" value="${svn.info}"/>
+ </manifest>
+ </jar>
+
+ <jar destfile="${tests.hdk.dir}/${hy.luni.packaging.jarname}_tests_impl.jar">
+ <fileset refid="tests.impl" />
+ <manifest>
+ <attribute name="Implementation-Version" value="${svn.info}"/>
+ </manifest>
+ </jar>
+
+ <copy todir="${tests.hdk.dir}">
+ <fileset dir="${hy.luni.src.test.resources}" >
+ <include name="org/**/*"/>
+ </fileset>
+ </copy>
+
+ <mkdir dir="${tests.resources.hdk.dir}/config"/>
+ <copy file="../../support/src/test/resources/config/testing.policy"
+ todir="${tests.resources.hdk.dir}/config"/>
+ <copy file="../../support/src/test/resources/config/localhosttest.ini"
+ todir="${tests.resources.hdk.dir}/config"/>
+
+ <copy todir="${tests.resources.hdk.dir}">
+ <fileset dir="${hy.luni.src.test.resources}" >
+ <include name="serialization/**/*"/>
+ </fileset>
+ </copy>
+
+ <mkdir dir="${tests.excludes.hdk.dir}"/>
+ <copy todir="${tests.excludes.hdk.dir}">
+ <fileset dir="./make" includes="exclude*"/>
+ <filterchain>
+ <tokenfilter>
+ <replaceregex pattern="\.java" replace="\.class" flags="g"/>
+ </tokenfilter>
+ </filterchain>
+ </copy>
+
+ <copy todir="${tests.hdk.dir}/.." file="${hy.hdk}/build/ant/properties.xml"/>
+
+ </target>
+
<!-- compile both api tests and impl tests-->
<target name="compile-tests" depends="compile-tests-api, compile-tests-impl" />