You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by sm...@apache.org on 2007/06/18 12:37:26 UTC
svn commit: r548293 - in /harmony/enhanced/buildtest/branches/2.0:
adaptors/tptp/ tests/tptp/
Author: smishura
Date: Mon Jun 18 03:37:24 2007
New Revision: 548293
URL: http://svn.apache.org/viewvc?view=rev&rev=548293
Log:
Apply patch from HARMONY-3579:
([testing] tptp jvmti tests execution integrates into B&T 2.0)
Added:
harmony/enhanced/buildtest/branches/2.0/adaptors/tptp/
harmony/enhanced/buildtest/branches/2.0/adaptors/tptp/README_tptp_tests.txt (with props)
harmony/enhanced/buildtest/branches/2.0/adaptors/tptp/adaptor.xml (with props)
harmony/enhanced/buildtest/branches/2.0/adaptors/tptp/parameters.xml (with props)
harmony/enhanced/buildtest/branches/2.0/tests/tptp/
harmony/enhanced/buildtest/branches/2.0/tests/tptp/build.xml (with props)
harmony/enhanced/buildtest/branches/2.0/tests/tptp/exclude.list
harmony/enhanced/buildtest/branches/2.0/tests/tptp/report.xsl (with props)
harmony/enhanced/buildtest/branches/2.0/tests/tptp/test.xsl (with props)
harmony/enhanced/buildtest/branches/2.0/tests/tptp/testsCount.java (with props)
harmony/enhanced/buildtest/branches/2.0/tests/tptp/updateExclude.java (with props)
harmony/enhanced/buildtest/branches/2.0/tests/tptp/updateResults.java (with props)
Added: harmony/enhanced/buildtest/branches/2.0/adaptors/tptp/README_tptp_tests.txt
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/adaptors/tptp/README_tptp_tests.txt?view=auto&rev=548293
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/adaptors/tptp/README_tptp_tests.txt (added)
+++ harmony/enhanced/buildtest/branches/2.0/adaptors/tptp/README_tptp_tests.txt Mon Jun 18 03:37:24 2007
@@ -0,0 +1,61 @@
+ ===================================================
+ Run TPTP test using Build Test 2.0
+ ====================================================
+
+---------------
+Archive Content
+---------------
+
+This archive contains adaptor and custom configuration for running TPTP Eclipse
+Profiler test suite under Build Test 2.0
+
+ +/
+ |-+adaptors/
+ | |
+ | |-+tptp/ - TPTP test suite adaptor directory
+ | |
+ | |--adaptor.xml - The adaptor
+ | |
+ | |--parameters.xml - Parameters file
+ | |
+ | |--README_tptp_tests.txt - This readme file
+ |
+ |-+tests/
+ |
+ |-+tptp/ - Scripts which will be used during tests running
+
+------------------------------------------------
+TPTP test suite running under BT 2.0
+------------------------------------------------
+1. Install the TPTP Agent Controller and TPTP tests. To do that follow the
+ instructions from this guide:
+
+ http://dev.eclipse.org/viewcvs/index.cgi/test-results/platform/org.eclipse.tptp.ac.testautomation/automation-files/notes/building_tptp_jvmti_tests.txt?root=TPTP_Project&view=co&pathrev=HEAD
+
+
+2. Perform setup:
+
+ ant -Dtest.suites="classlib,drlvm,tptp" setup
+
+
+3. Set required parameters in : <BT-infrastructure>/required-parameters.properties
+
+ tptp.agent.controller.home = Location of the Agent Controller binaries
+ tptp.tests.build.home = Location of the built TPTP test suite
+
+
+4. Run the suite on previously built JRE:
+
+ ant -Dtest.suites="classlib,drlvm,tptp" run
+
+
+5. To run tests under Cruise Control:
+
+ - set up framework properties in <BT-infrastructure>/framework.local.properties
+
+ - run the suite under Cruise Control:
+
+ ant -Dtest.suites="classlib,drlvm,tptp" run-cc
+
+The results of tests execution are set to the <BT-infrastructure>/build/results/tptp directory
+
Propchange: harmony/enhanced/buildtest/branches/2.0/adaptors/tptp/README_tptp_tests.txt
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/buildtest/branches/2.0/adaptors/tptp/adaptor.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/adaptors/tptp/adaptor.xml?view=auto&rev=548293
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/adaptors/tptp/adaptor.xml (added)
+++ harmony/enhanced/buildtest/branches/2.0/adaptors/tptp/adaptor.xml Mon Jun 18 03:37:24 2007
@@ -0,0 +1,107 @@
+<?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. -->
+
+<!-- ======================================================================
+ BT Adaptor for TPTP profiler tests suite
+ ====================================================================== -->
+<project name="tptp" default="run" basedir=".">
+
+ <!--- Define used properties -->
+ <property environment="env"/>
+ <property name="work.dir" value="${checkouts.dir}/${suite.name}"/>
+ <property name="tests.dir" value="${test.sources.dir}/${suite.name}"/>
+ <property name="tests.module" value="${tptp.parameters.optional.tptp.tests.module}"/>
+ <property name="tptp.results" value="${results.dir}/${suite.name}"/>
+ <property name="tptp.report" value="${tptp.results}/tptp_report"/>
+ <property name="tptp.failed.zip" value="${tptp.results}/FailedTests.zip"/>
+
+ <!-- Setup of the TPTP profiler test suite -->
+ <target name="setup">
+ <log message="============= Adaptor for ${suite.name}. Set Up .."/>
+
+ <!-- update suite resources from SVN -->
+ <svn-update-bt path="${tests.dir}"/>
+
+ <!-- make the dir to store built tests -->
+ <mkdir dir="${work.dir}/${tests.module}"/>
+
+ <!-- Copy tests from build to build/checkouts/tptp -->
+ <copy todir="${work.dir}/${tests.module}" failonerror="true">
+ <fileset dir="${tptp.tests.build.home}/${tests.module}"/>
+ </copy>
+
+ <!-- Copy additional files from tests/tptp to build/checkouts/tptp -->
+ <copy todir="${work.dir}" file="${tests.dir}/build.xml"/>
+ <copy todir="${work.dir}" file="${tests.dir}/testsCount.java"/>
+ <copy todir="${work.dir}" file="${tests.dir}/updateExclude.java"/>
+ <copy todir="${work.dir}" file="${tests.dir}/updateResults.java"/>
+ <copy todir="${work.dir}" file="${tests.dir}/report.xsl"/>
+ <copy todir="${work.dir}" file="${tests.dir}/test.xsl"/>
+
+ <!-- Compile sources -->
+ <javac srcdir="${work.dir}"
+ destdir="${work.dir}"
+ includes="*.java"/>
+ </target>
+
+ <!-- Run the TPTP profiler test suite -->
+ <target name="run" description="Run TPTP profiler tests.">
+ <log message="============= Adaptor for ${suite.name}. Run .."/>
+
+ <!-- Copy exclude list file for updating suite's config -->
+ <copy todir="${tptp.results}" file="${tests.dir}/${tptp.parameters.optional.exclude.list}"/>
+
+ <!-- Remember start time -->
+ <tstamp>
+ <format property="time.stamp" pattern="yyyy-MM-dd_hhmm" />
+ </tstamp>
+
+ <!-- call ant script of the tptp project -->
+ <exec-ant dir="${work.dir}"
+ targets="run"
+ failonerror="false"
+ failproperty="tptp.tests.failed">
+ <sysproperty key="test.home" value="${work.dir}/${tests.module}"/>
+ <sysproperty key="tested.runtime" value="${tested.runtime}"/>
+ <sysproperty key="ac.home" value="${agent.controller.home}"/>
+ <sysproperty key="tptp.test.class" value="${tptp.parameters.optional.tptp.test.class}"/>
+ <sysproperty key="runner.arguments" value="${tptp.parameters.optional.runner.arguments}"/>
+ <sysproperty key="tptp.options" value="${tptp.parameters.optional.runner.vm.options}"/>
+ <sysproperty key="tested.vm.options" value="${tptp.parameters.optional.tested.vm.options}"/>
+ <sysproperty key="test.timeout" value="${tptp.parameters.optional.test.timeout}"/>
+ <sysproperty key="exclude.name" value="${tptp.parameters.optional.exclude.list}"/>
+ <sysproperty key="results.dir" value="${tptp.results}"/>
+ <sysproperty key="report.dir" value="${tptp.report}"/>
+ <sysproperty key="failed.zip" value="${tptp.failed.zip}"/>
+ </exec-ant>
+
+ <!-- Store recent results -->
+ <copy todir="${tptp.report}_${time.stamp}">
+ <fileset dir="${tptp.report}"/>
+ </copy>
+
+ <fail message="Some TPTP tests failed" if="tptp.tests.failed"/>
+ </target>
+
+ <!-- Clean TPTP profiler test suite -->
+ <target name="clean">
+ <log message="============= Adaptor for ${suite.name}. Clean .."/>
+ <delete dir="${work.dir}"/>
+ <delete dir="${tptp.results}"/>
+ </target>
+
+</project>
Propchange: harmony/enhanced/buildtest/branches/2.0/adaptors/tptp/adaptor.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/buildtest/branches/2.0/adaptors/tptp/parameters.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/adaptors/tptp/parameters.xml?view=auto&rev=548293
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/adaptors/tptp/parameters.xml (added)
+++ harmony/enhanced/buildtest/branches/2.0/adaptors/tptp/parameters.xml Mon Jun 18 03:37:24 2007
@@ -0,0 +1,72 @@
+<?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. -->
+
+<parameters depends="drlvm">
+
+ <required>
+ <tested.runtime
+ description="Path to Tested Runtime"
+ value="${drlvm.parameters.shared.jre.dir}"/>
+ <agent.controller.home
+ description="Agent controller runtime location"
+ value=""/>
+ <tptp.tests.build.home
+ description="Location of the TPTP tests build"
+ value=""/>
+ </required>
+
+ <optional>
+ <tested.vm.options
+ description="JVM options for tested runtime"
+ value=""/>
+ <runner.vm.options
+ description="Options for tests runner VM (for example, -Doutput.delete=true)"
+ value=""/>
+ <runner.arguments
+ description="These arguments will be passed to test runner"
+ value=""/>
+
+ <tptp.tests.module
+ description="TPTP tests module name"
+ value="org.eclipse.tptp.ac.testautomation"/>
+ <tptp.test.class
+ description="Package name of TPTP tests or one test which will be run (AllStandaloneProfiling runs all JVMTI tests)"
+ value="org.eclipse.tptp.ac.testautomation.junits.AllStandaloneProfiling"/>
+<!-- value="org.eclipse.tptp.ac.testautomation.junits.ThreadStandaloneProfiling"/-->
+
+ <exclude.list
+ description="Exclude list file name"
+ value="exclude.list"/>
+ <test.timeout
+ description="Time out for one test running"
+ value="600000"/>
+ </optional>
+
+ <external/>
+
+ <shared/>
+
+ <cc>
+ <results
+ description="Merge test results into CC log"
+ value="${tptp.report}/AllTests.xml"/>
+ <attachs
+ description="Attach archive with failed tests results into notification"
+ value="${tptp.failed.zip}"/>
+ </cc>
+
+</parameters>
Propchange: harmony/enhanced/buildtest/branches/2.0/adaptors/tptp/parameters.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/buildtest/branches/2.0/tests/tptp/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/tests/tptp/build.xml?view=auto&rev=548293
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/tests/tptp/build.xml (added)
+++ harmony/enhanced/buildtest/branches/2.0/tests/tptp/build.xml Mon Jun 18 03:37:24 2007
@@ -0,0 +1,157 @@
+<?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="run.tptp.tests" default="run" basedir=".">
+
+ <description>Run TPTP profiler testsuite</description>
+
+<!-- To run TPTP profiler tests use the following command
+
+${JAVA_HOME}/bin/java \
+ -Dtest.param="${EM_OPT}" \
+ -Dtest.timeout=${test.timeout} \
+ -Dconfigfile="$CFGFILE" \
+ -Dtest.output=${OUTPUT} \
+ -Dtest.java=${UT_RUNTIME} \
+ -Dtest.home=${TEST_HOME} \
+ -Dac.home=${AC_HOME} \
+ -Dtest.verbose=false \
+ -Xbootclasspath/p:${BOOTCLASSPATH} \
+ -classpath ${CLASSPATH} \
+ org.eclipse.tptp.ac.testautomation.AllStandaloneProfiling > ${OUTPUT}/log.txt 2>&1
+
+ where:
+
+ JAVA_HOME - reference runtime location
+ EM_OPT - running mode
+ for DRLVM -Xint/-Xem:opt/-Xem:jet or default + -XX:vm.assert_dialog=false
+ for RI it is empty
+ TIME_OUT - time in milliseconds for 1 test
+ CFGFILE - configure file location
+ OUTPUT - output directory location
+ UT_RUNTIME - tested JRE location
+ TEST_HOME - tests directory location
+ AC_HOME - agent directory location
+ BOOTCLASSPATH - used bootclasspath
+ CLASSPATH - used jar files
+
+-->
+
+ <!-- path to the reference runtime -->
+ <property name="jvm.reference" location="${java.home}/bin/java"/>
+
+ <!-- CFGFILE, BOOTCLASSPATH, CLASSPATH arguments -->
+ <property name="config.file" location="${test.home}/automation-files/config/local_config_file.xml"/>
+ <property name="config.file.new" location="${results.dir}/local_config_file.xml"/>
+
+ <property name="test_jars" location="${test.home}/automation-files/required_jars"/>
+ <property name="classpath_jar" location="${test_jars}/hlcore.jar${path.separator}${test_jars}/org.eclipse.emf.common_2.2.0.jar${path.separator}${test_jars}/org.eclipse.emf.ecore_2.2.0.jar${path.separator}${test_jars}/hlcbe101.jar${path.separator}${test_jars}/junit.jar${path.separator}${test_jars}/hexcore.jar${path.separator}${test_jars}/hexl.jar${path.separator}${test.home}/bin"/>
+ <property name="bootclasspath_jar" location="${test_jars}/xml-apis.jar${path.separator}${test_jars}/xercesImpl.jar"/>
+
+ <echo message="CLASSPATH: ${classpath_jar}"/>
+ <echo message="BOOTCLASSPATH: ${bootclasspath_jar}"/>
+
+ <!-- All arguments -->
+ <property name="jvm.args" value="${tptp.options} -Dtest.param='${tested.vm.options}' -Dtest.timeout=${test.timeout} -Dconfigfile=${config.file.new} -Dtest.output=${report.dir} -Dtest.java=${tested.runtime} -Dtest.home=${test.home} -Dac.home=${ac.home} -Dtest.verbose=false -Xbootclasspath/p:${bootclasspath_jar} "/>
+
+ <!-- Tests running -->
+ <target name="run">
+ <!-- Clear previous results -->
+ <delete dir="${report.dir}" failonerror="false"/>
+ <mkdir dir="${report.dir}"/>
+
+ <echo message="=====Used RI: ${jvm.reference}"/>
+ <echo message="=====TPTP profiler tests were set to ${test.home}"/>
+ <echo message="=====Agent was set to ${ac.home}"/>
+ <echo message="=====Used jvm args: ${jvm.args}"/>
+ <echo message="=====Running class: ${tptp.test.class}"/>
+
+ <java classname="updateExclude"
+ classpath="."
+ fork="yes"
+ failonerror="true">
+ <arg value="${config.file}"/>
+ <arg value="${config.file.new}"/>
+ <arg value="${results.dir}/${exclude.name}.txt"/>
+ <arg value="${results.dir}/${exclude.name}"/>
+ </java>
+
+ <java jvm="${jvm.reference}"
+ classname="${tptp.test.class}"
+ output="${report.dir}/AllTests.txt"
+ error="${report.dir}/AllTests_error.txt"
+ failonerror="true"
+ fork="yes">
+ <jvmarg line="${jvm.args}"/>
+ <arg line="${runner.arguments}"/>
+ <classpath>
+ <pathelement path="${classpath_jar}"/>
+ </classpath>
+ </java>
+
+ <!-- Move thr files to xml -->
+ <move todir="${report.dir}" includeemptydirs="false">
+ <fileset dir="${report.dir}">
+ <exclude name="**/*.xml"/>
+ </fileset>
+ <mapper type="glob" from="*.thr" to="*.xml"/>
+ </move>
+
+ <!-- Copy additional files from tptp tests build -->
+ <copy todir="${report.dir}" file="report.xsl"/>
+ <copy todir="${report.dir}" file="test.xsl"/>
+
+ <!-- Migrate txt results file to xml -->
+ <java classname="updateResults"
+ classpath="."
+ fork="yes"
+ failonerror="true">
+ <arg value="${report.dir}/AllTests.txt"/>
+ <arg value="${report.dir}/AllTests.xml"/>
+ </java>
+
+ <!-- Prepere summary report -->
+ <java classname="testsCount"
+ classpath="."
+ fork="yes"
+ resultproperty="test.res.code">
+ <arg value="${report.dir}"/>
+ <arg value="${results.dir}/${exclude.name}.txt"/>
+ <arg value="${test.home}"/>
+ <arg value="${test.home}"/>
+ <arg value="${tested.runtime}"/>
+ <arg value="${os.name}_${os.version}_${os.arch}"/>
+ <arg value="${failed.zip}"/>
+ </java>
+
+ <!-- Delete config files and exclude list file -->
+ <delete file="${config.file.new}"/>
+ <delete file="${results.dir}/${exclude.name}.txt"/>
+ <delete file="${results.dir}/${exclude.name}"/>
+
+ <condition property="tptp.tests.failed">
+ <not>
+ <equals arg1="${test.res.code}" arg2="0"/>
+ </not>
+ </condition>
+
+ <fail message="Some tests failed on ${tested.runtime}" if="tptp.tests.failed"/>
+
+ </target>
+
+</project>
Propchange: harmony/enhanced/buildtest/branches/2.0/tests/tptp/build.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/buildtest/branches/2.0/tests/tptp/exclude.list
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/tests/tptp/exclude.list?view=auto&rev=548293
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/tests/tptp/exclude.list (added)
+++ harmony/enhanced/buildtest/branches/2.0/tests/tptp/exclude.list Mon Jun 18 03:37:24 2007
@@ -0,0 +1,17 @@
+# Excluded tests is defined as package/test comments
+org.eclipse.tptp.scenario.thread.MathWorkload_10/standalone_thread_filter/tp_threadMathWorkload_10_F E180454 All
+org.eclipse.tptp.scenario.thread.MathWorkload_10/standalone_thread_full/tp_threadMathWorkload_10 E180454 All
+org.eclipse.tptp.scenario.thread.MathWorkload_100/standalone_thread_filter/tp_threadMathWorkload_100_F E180454 All
+org.eclipse.tptp.scenario.thread.MathWorkload_100/standalone_thread_full/tp_threadMathWorkload_100 E180454 All
+org.eclipse.tptp.scenario.thread.PipeWorkload_10/standalone_thread_full/tp_threadPipeWorkload_10 E180454 All
+org.eclipse.tptp.scenario.thread.PipeWorkload_100/standalone_thread_full/tp_threadPipeWorkload_100 E180454 All
+org.eclipse.tptp.scenario.thread.PlainWorkload_10/standalone_thread_full/tp_threadPlainWorkload_10 E180454 All
+org.eclipse.tptp.scenario.thread.PlainWorkload_100/standalone_thread_full/tp_threadPlainWorkload_100 E180454 All
+org.eclipse.tptp.scenario.thread.PowerWorkload_10/standalone_thread_full/tp_threadPowerWorkload_10 E180454 All
+org.eclipse.tptp.scenario.thread.PowerWorkload_100/standalone_thread_full/tp_threadPowerWorkload_100 E180454 All
+org.eclipse.tptp.scenario.thread.SequentWorkload_5/standalone_thread_filter/tp_threadSequentWorkload_5_F E180454 All
+org.eclipse.tptp.scenario.thread.SequentWorkload_5/standalone_thread_full/tp_threadSequentWorkload_5 E180454 All
+org.eclipse.tptp.scenario.thread.ThreadGroupTest_3/standalone_thread_filter/tp_threadThreadGroupTest_3_F E180454 All
+org.eclipse.tptp.scenario.thread.ThreadGroupTest_3/standalone_thread_full/tp_threadThreadGroupTest_3 E180454 All
+
+
Added: harmony/enhanced/buildtest/branches/2.0/tests/tptp/report.xsl
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/tests/tptp/report.xsl?view=auto&rev=548293
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/tests/tptp/report.xsl (added)
+++ harmony/enhanced/buildtest/branches/2.0/tests/tptp/report.xsl Mon Jun 18 03:37:24 2007
@@ -0,0 +1,119 @@
+<!--
+ 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.
+-->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:template match="/">
+ <h1>General report</h1>
+ <xsl:apply-templates/>
+ </xsl:template>
+ <xsl:template match="property-list">
+ <p><a name="Total"></a><table>
+ <tr bgcolor="#CCCCCC">
+ <th colspan="2" align="center">General properties</th> </tr>
+ <xsl:for-each select="property-item">
+ <tr>
+ <td>
+ <xsl:if test="@name='date'">
+ <strong><xsl:value-of select="./@name"/></strong>
+ </xsl:if>
+ <xsl:if test="@name!='date'">
+ <a href="#{./@name}"><strong><xsl:value-of select="./@name"/></strong></a>
+ </xsl:if>
+ </td>
+ <td><xsl:value-of select="."/></td>
+ </tr>
+ </xsl:for-each>
+ </table></p>
+ </xsl:template>
+ <xsl:template match="cfg-list">
+ <p><a name="Config"></a><table>
+ <tr bgcolor="#CCCCCC">
+ <th colspan="2" align="center">Configuration</th></tr>
+ <xsl:for-each select="cfg-item">
+ <tr>
+ <td><strong><xsl:value-of select="./@name"/></strong></td>
+ <td><xsl:value-of select="."/></td>
+ </tr>
+ </xsl:for-each>
+ </table></p>
+ </xsl:template>
+ <xsl:template match="passed-list">
+ <p><a name="passed"></a><table>
+ <tr bgcolor="#CCCCCC">
+ <th colspan="2" align="center">Passed tests</th></tr>
+ <xsl:for-each select="list-item">
+ <xsl:sort order="ascending" select="."/>
+ <tr>
+ <td><b><xsl:number value="position()" format="1" /></b></td>
+ <td><a href="{.}"><xsl:value-of select="."/></a></td>
+ </tr>
+ </xsl:for-each>
+ </table></p>
+ </xsl:template>
+ <xsl:template match="failed-list">
+ <p><a name="failed"></a><table>
+ <tr bgcolor="#CCCCCC">
+ <th colspan="2" align="center">Failed tests</th></tr>
+ <xsl:for-each select="list-item">
+ <xsl:sort order="ascending" select="."/>
+ <tr>
+ <td><b><xsl:number value="position()" format="1" /></b></td>
+ <td><a href="{.}"><xsl:value-of select="."/></a></td>
+ </tr>
+ </xsl:for-each>
+ </table></p>
+ </xsl:template>
+ <xsl:template match="error-list">
+ <p><a name="error"></a><table>
+ <tr bgcolor="#CCCCCC">
+ <th colspan="2" align="center">Tests with error</th></tr>
+ <xsl:for-each select="list-item">
+ <xsl:sort order="ascending" select="."/>
+ <tr>
+ <td><b><xsl:number value="position()" format="1" /></b></td>
+ <td><a href="{.}"><xsl:value-of select="."/></a></td>
+ </tr>
+ </xsl:for-each>
+ </table></p>
+ </xsl:template>
+ <xsl:template match="modeError-list">
+ <p><a name="skipped"></a><table>
+ <tr bgcolor="#CCCCCC">
+ <th colspan="2" align="center">Tests were skipped</th></tr>
+ <xsl:for-each select="list-item">
+ <xsl:sort order="ascending" select="."/>
+ <tr>
+ <td><b><xsl:number value="position()" format="1" /></b></td>
+ <td><a href="{.}"><xsl:value-of select="."/></a></td>
+ </tr>
+ </xsl:for-each>
+ </table></p>
+ </xsl:template>
+ <xsl:template match="unknown-list">
+ <p><a name="unknown"></a><table>
+ <tr bgcolor="#CCCCCC">
+ <th colspan="2" align="center">Tests completed with exit code which is not recognized by harness as known test execution code</th></tr>
+ <xsl:for-each select="list-item">
+ <xsl:sort order="ascending" select="."/>
+ <tr>
+ <td><b><xsl:number value="position()" format="1" /></b></td>
+ <td><a href="{.}"><xsl:value-of select="."/></a></td>
+ </tr>
+ </xsl:for-each>
+ </table></p>
+ </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file
Propchange: harmony/enhanced/buildtest/branches/2.0/tests/tptp/report.xsl
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/buildtest/branches/2.0/tests/tptp/test.xsl
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/tests/tptp/test.xsl?view=auto&rev=548293
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/tests/tptp/test.xsl (added)
+++ harmony/enhanced/buildtest/branches/2.0/tests/tptp/test.xsl Mon Jun 18 03:37:24 2007
@@ -0,0 +1,93 @@
+<!--
+ 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.
+-->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:template match="/">
+ <h1>Test report</h1>
+ <xsl:apply-templates/>
+ </xsl:template>
+ <xsl:template match="property-list">
+ <p><table>
+ <tr bgcolor="#CCCCCC">
+ <th colspan="2" align="center">Results</th></tr>
+ <xsl:for-each select="property-item">
+ <tr><td valign="top"><strong><xsl:value-of select="./@name"/></strong></td>
+ <td>
+ <xsl:variable name="htmlBR">
+ <xsl:element name="br"/>
+ <xsl:text>
</xsl:text>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="@name='cmd'">
+ <xsl:variable name="tmp">
+ <xsl:call-template name="replace">
+ <xsl:with-param name="str" select="."/>
+ <xsl:with-param name="from" select="'
'"/>
+ <xsl:with-param name="to" select="$htmlBR"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="replace">
+ <xsl:with-param name="str" select="$tmp"/>
+ <xsl:with-param name="from" select="';'"/>
+ <xsl:with-param name="to" select="'; '"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="replace">
+ <xsl:with-param name="str" select="."/>
+ <xsl:with-param name="from" select="'
'"/>
+ <xsl:with-param name="to" select="$htmlBR"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td></tr>
+ </xsl:for-each>
+ </table></p>
+ </xsl:template>
+ <xsl:template match="info-list">
+ <p><table>
+ <tr bgcolor="#CCCCCC">
+ <th colspan="2" align="center">Additional information</th></tr>
+ <xsl:for-each select="info-item">
+ <tr><td valign="top"><strong><xsl:value-of select="./@name"/></strong></td>
+ <td><a href="{.}"><xsl:value-of select="."/></a></td>
+ </tr>
+ </xsl:for-each>
+ </table></p>
+ </xsl:template>
+
+ <xsl:template name="replace">
+ <xsl:param name="str"/>
+ <xsl:param name="from"/>
+ <xsl:param name="to"/>
+
+ <xsl:choose>
+ <xsl:when test="contains($str, $from)">
+ <xsl:value-of select="substring-before($str, $from)"/>
+ <xsl:copy-of select="$to"/>
+ <xsl:call-template name="replace">
+ <xsl:with-param name="str" select="substring-after($str, $from)"/>
+ <xsl:with-param name="from" select="$from"/>
+ <xsl:with-param name="to" select="$to"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$str"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file
Propchange: harmony/enhanced/buildtest/branches/2.0/tests/tptp/test.xsl
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/buildtest/branches/2.0/tests/tptp/testsCount.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/tests/tptp/testsCount.java?view=auto&rev=548293
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/tests/tptp/testsCount.java (added)
+++ harmony/enhanced/buildtest/branches/2.0/tests/tptp/testsCount.java Mon Jun 18 03:37:24 2007
@@ -0,0 +1,400 @@
+import java.util.*;
+import java.util.zip.*;
+import java.io.*;
+
+public class testsCount {
+
+ public static int totalTests = 0;
+ public static int failedTests = 0;
+ public static int passedTests = 0;
+ public static int errorTests = 0;
+ public static int skippedTests = 0;
+ public static int unknownTests = 0;
+
+ public static int skippedAddTests = 0;
+
+ public static LinkedList lPass = new LinkedList();
+ public static LinkedList lFail = new LinkedList();
+ public static LinkedList lErr = new LinkedList();
+ public static LinkedList lSkip = new LinkedList();
+
+ public static LinkedList lSkipAdd = new LinkedList();
+
+ public static LinkedList lUnknown = new LinkedList();
+
+ public static String dirIn = "";
+
+ public static boolean debugFlag = false;
+
+ public static ZipOutputStream zf;
+
+ public static String zfName = "";
+
+ public static void main(String[] argv) {
+ System.exit(new testsCount().calcCount(argv));
+ }
+ public int calcCount(String[] argv) {
+ String arg0 = "";
+ File f1;
+ File f2;
+ String s = "";
+ String suite_home = "";
+ String suite_version = "";
+ String tested_vm = "";
+ String used_os = "";
+ String skipF = "";
+ if (argv.length > 0) {
+ arg0 = argv[0];
+ dirIn = arg0;
+ } else {
+ System.err.println("There are no arguments");
+ return 105;
+ }
+ if (argv.length > 1) {
+ skipF = argv[1];
+ }
+ if (argv.length > 2) {
+ suite_home = argv[2];
+ }
+ if (argv.length > 3) {
+ suite_version = argv[3];
+ }
+ if (argv.length > 4) {
+ tested_vm = argv[4];
+ }
+ if (argv.length > 5) {
+ used_os = argv[5];
+ }
+ if (argv.length > 6) {
+ zfName = argv[6];
+ }
+
+ if (argv.length > 7) {
+ debugFlag = true;
+ }
+
+
+ if (skipF.length() > 0) {
+ skippedAddTests = createSkipAdd(skipF);
+ if (skippedAddTests <= 0 ) {
+ skippedAddTests = 0;
+ }
+ }
+ try {
+ f1 = new File(arg0);
+ if (!f1.exists()) {
+ System.err.println("There is no file or directory: " + arg0);
+ return 105;
+ }
+ if (f1.isFile()) {
+ System.err.println(arg0 +" is File");
+ return 105;
+ }
+ dirIn = f1.getPath();
+
+ if (zfName.length() == 0) {
+ zfName = dirIn.concat(File.separator).concat("zipFailTests.zip");
+ }
+ zf = new ZipOutputStream(new FileOutputStream(new File(zfName)));
+
+ fromDirectory(f1);
+ totalTests += skippedAddTests;
+ skippedTests +=skippedAddTests;
+ f2 = new File(arg0+File.separator+"report.xml");
+ BufferedWriter bw = new BufferedWriter(new FileWriter(f2));
+
+ try {
+ bw.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
+ bw.newLine();
+ bw.write("<?xml-stylesheet type='text/xsl' href='report.xsl'?>");
+ bw.newLine();
+ bw.write("<Report>");
+ bw.newLine();
+ bw.write("<property-list>");
+ bw.newLine();
+ bw.write("<property-item name=\"date\"></property-item>");
+ bw.newLine();
+ bw.write("<property-item name=\"total\">"+totalTests+"</property-item>");
+ bw.newLine();
+ bw.write("<property-item name=\"passed\">"+passedTests+"</property-item>");
+ bw.newLine();
+ bw.write("<property-item name=\"failed\">"+failedTests+"</property-item>");
+ bw.newLine();
+ bw.write("<property-item name=\"error\">"+errorTests+"</property-item>");
+ bw.newLine();
+ bw.write("<property-item name=\"skipped\">"+skippedTests+"</property-item>");
+ bw.newLine();
+ bw.write("<property-item name=\"unknown\">"+unknownTests+"</property-item>");
+ bw.newLine();
+ bw.write("</property-list>");
+ bw.newLine();
+ bw.write("<cfg-list>");
+ bw.newLine();
+ bw.write("<cfg-item name=\"test suite root\">"+suite_home+"</cfg-item>");
+ bw.write("<cfg-item name=\"test suite version\">"+suite_version+"</cfg-item>");
+ bw.write("<cfg-item name=\"test root\">"+suite_home+"/src </cfg-item>");
+ bw.write("<cfg-item name=\"test class root\">"+suite_home+"/bin </cfg-item>");
+ bw.write("<cfg-item name=\"tested runtime\">"+tested_vm+" </cfg-item>");
+// <cfg-item name="execution mode">other VM </cfg-item>
+ bw.write("<cfg-item name=\"os\">"+used_os+"</cfg-item>");
+// <cfg-item name="path to env_cfg.xml file"> </cfg-item>
+// <cfg-item name="path to system env file"> </cfg-item>
+
+ bw.write("</cfg-list>");
+ bw.newLine();
+ if (debugFlag) {
+ System.err.println("Total tests: " + totalTests);
+ System.err.println("Failed tests: " + failedTests);
+ }
+ putList(bw, lFail,"failed-list", debugFlag);
+ if (debugFlag) {
+ System.err.println("Tests finished with error code: " + errorTests);
+ }
+ putList(bw, lErr,"error-list", debugFlag);
+ if (debugFlag) {
+ System.err.println("Tests finished with unknown code: " + unknownTests);
+ }
+ putList(bw, lUnknown,"unknowm-list", debugFlag);
+ putList(bw, lSkip,lSkipAdd,"modeError-list", false);
+ putList(bw, lPass,"passed-list", false);
+ bw.write("</Report>");
+ bw.newLine();
+ bw.close();
+ } catch (Throwable e) {
+ e.printStackTrace(System.err);
+ return 105;
+ }
+ addToZip(f2);
+ f2 = new File(dirIn.concat(File.separator).concat("test.xsl"));
+ addToZip(f2);
+ f2 = new File(dirIn.concat(File.separator).concat("report.xsl"));
+ addToZip(f2);
+
+ zf.close();
+ if ((errorTests > 0) || (failedTests >0) || (unknownTests >0)) {
+ return 1;
+ } else {
+ return 0;
+ }
+ } catch (Exception e) {
+ e.printStackTrace(System.err);
+ return 105;
+ }
+ }
+
+
+ public static void putList(BufferedWriter bw, LinkedList li, String title,
+ boolean prnt) throws Exception {
+ bw.write("<"+title+">");
+ bw.newLine();
+ for (int i = 0; i < li.size(); i++) {
+ String tt = (String)li.get(i);
+ bw.write("<list-item>" + tt + "</list-item>\n");
+ bw.newLine();
+ if (prnt) {
+ String ttt = tt.substring(2);
+ if ( ttt.endsWith(".thr") || ttt.endsWith(".xml") ){
+ ttt = ttt.substring(0, (ttt.length() - 4));
+ }
+ System.err.println(Integer.toString(i+1)+" "+ttt);
+ }
+ }
+ bw.write("</"+title+">");
+ bw.newLine();
+ }
+
+ public static void putList(BufferedWriter bw, LinkedList li1, LinkedList li2, String title,
+ boolean prnt) throws Exception {
+ bw.write("<"+title+">");
+ bw.newLine();
+ for (int i = 0; i < li1.size(); i++) {
+ String tt = (String)li1.get(i);
+ bw.write("<list-item>" + tt + "</list-item>\n");
+ bw.newLine();
+ if (prnt) {
+ String ttt = tt.substring(2);
+ if ( ttt.endsWith(".thr") || ttt.endsWith(".xml") ){
+ ttt = ttt.substring(0, (ttt.length() - 4));
+ }
+ System.err.println(Integer.toString(i+1)+" "+ttt);
+ }
+ }
+ int n = li1.size();
+ for (int i = 0; i < li2.size(); i++) {
+ String tt = (String)li2.get(i);
+ bw.write("<list-item>" + tt + "</list-item>\n");
+ bw.newLine();
+ if (prnt) {
+ if ( tt.endsWith(".thr") || tt.endsWith(".xml") ){
+ tt = tt.substring(0, (tt.length() - 4));
+ }
+ System.err.println(Integer.toString(i+1+n)+" "+tt);
+ }
+ }
+
+ bw.write("</"+title+">");
+ bw.newLine();
+ }
+
+
+
+ public static void fromDirectory(File f1) {
+ String [] listDir = f1.list();
+ File f2;
+ for (int j = 0; j < listDir.length; j++) {
+ if (listDir[j].indexOf(".xml") != -1) {
+ f2 = new File(f1, listDir[j]);
+ if (f2.isFile()) {
+ if (countResults(f2) != 0) {
+ return;
+ } else {
+ continue;
+ }
+ }
+ } else {
+ f2 = new File(f1, listDir[j]);
+ }
+ if (!f2.isFile()) {
+ fromDirectory(f2);
+ }
+ }
+ }
+
+ public static int countResults(File ff) {
+ BufferedReader br;
+ String relnm = "";
+ String s = "";
+ if (ff.getName().equals("report.xml")) {
+ return 0;
+ }
+ if (ff.getName().equals("AllTests.xml")) {
+ return 0;
+ }
+ try {
+ br = new BufferedReader(new FileReader(ff));
+ if (ff.getPath().startsWith(dirIn)) {
+ relnm = ".".concat(ff.getPath().substring(dirIn.length()));
+ } else {
+ relnm = ff.getPath();
+ }
+ } catch (Exception e) {
+ System.err.println("CreateJavaFile: unexpected exception on creating of BufferedReader"+ e);
+ e.printStackTrace(System.err);
+ return 1;
+ }
+ totalTests ++;
+ try {
+ while (true) {
+ s = br.readLine();
+ if (s == null) {
+ break;
+ }
+ if (s.indexOf("<property-item name=\"Status\">104") != -1) {
+ passedTests++;
+ lPass.add(relnm);
+ break;
+ }
+ if (s.indexOf("<property-item name=\"Status\">105") != -1) {
+ failedTests++;
+ lFail.add(relnm);
+ addToZip(ff);
+ break;
+ }
+ if (s.indexOf("<property-item name=\"Status\">106") != -1) {
+ errorTests++;
+ lErr.add(relnm);
+ addToZip(ff);
+ break;
+ }
+ if (s.indexOf("<property-item name=\"Status\">107") != -1) {
+ skippedTests++;
+ lSkip.add(ff);
+ break;
+ }
+ if (s.indexOf("<property-item name=\"Status\">") != -1) {
+ unknownTests++;
+ lUnknown.add(relnm);
+ addToZip(ff);
+ break;
+ }
+ }
+ br.close();
+ return 0;
+ } catch (IOException e) {
+ System.err.println("createJavaFile: unexpected exception " + e);
+ e.printStackTrace(System.err);
+ return 1;
+ }
+ }
+
+ public static int addToZip(File ff) {
+ ZipEntry ze = null;
+ BufferedInputStream br = null;
+ byte[] buf = new byte[500];
+ int sz = 0;
+ try {
+ String z = "";
+ int tt = ff.getPath().indexOf(dirIn);
+ if (tt != -1) {
+ z = ff.getPath().substring(dirIn.length() + 1);
+ } else {
+ z = ff.getPath();
+ }
+ ze = new ZipEntry(z);//ff.getPath());
+ br = new BufferedInputStream(new FileInputStream(ff));
+ zf.putNextEntry(ze);
+ while (true) {
+ int t = br.read(buf, 0, buf.length);
+ if (t == -1) {
+ break;
+ }
+ zf.write(buf, 0, t);
+ sz+=t;
+ }
+ return sz;
+ } catch (Throwable e) {
+ e.printStackTrace(System.err);
+ return -1;
+ }
+ }
+
+
+ public static int createSkipAdd(String skF) {
+ BufferedReader br = null;
+ String s = "";
+ int ind = -1;
+ int ind1 = -1;
+ File f;
+ try {
+ f = new File(skF);
+ if (!f.exists()) {
+ return 0;
+ }
+ br = new BufferedReader(new FileReader(f));
+ while (true) {
+ s = br.readLine();
+ if (s == null) {
+ break;
+ }
+ if (s.length() == 0) {
+ continue;
+ }
+ lSkipAdd.add(s);
+ }
+ br.close();
+ return lSkipAdd.size();
+ } catch (IOException e) {
+ System.err.println("Unexpected exception during creating list of excluded tests: " + e);
+ e.printStackTrace(System.err);
+ if (br != null) {
+ try {
+ br.close();
+ } catch (IOException e1) {
+ System.err.println("Unexpected exception during closing file: " + e1);
+ }
+ }
+ return -1;
+ }
+ }
+}
+
Propchange: harmony/enhanced/buildtest/branches/2.0/tests/tptp/testsCount.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/buildtest/branches/2.0/tests/tptp/updateExclude.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/tests/tptp/updateExclude.java?view=auto&rev=548293
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/tests/tptp/updateExclude.java (added)
+++ harmony/enhanced/buildtest/branches/2.0/tests/tptp/updateExclude.java Mon Jun 18 03:37:24 2007
@@ -0,0 +1,232 @@
+import java.util.*;
+import java.io.*;
+
+public class updateExclude {
+
+ public static LinkedList excL = new LinkedList();
+ public static LinkedList excFull = new LinkedList();
+
+ public static boolean debugFlag = false;
+ public static boolean exclFlag = true;
+ public static int cntUpdate = 0;
+
+ public static void main(String[] argv) {
+ System.exit(new updateExclude().mdfConfig(argv));
+ }
+ public int mdfConfig(String[] argv) {
+ BufferedReader br = null;
+ BufferedWriter bw = null;
+ BufferedWriter bw1 = null;
+ String cfgF = "";
+ String cfgFN = "";
+ String exclF = "";
+ String exclS = "";
+ File f1;
+ String s = "";
+ if (argv.length > 0) {
+ cfgF = argv[0];
+ } else {
+ System.out.println("There are no arguments: configuration files and exclude list file should be defined");
+ return 105;
+ }
+ if (argv.length > 1) {
+ cfgFN = argv[1];
+ } else {
+ System.out.println("New configuration file and exclude list file should be defined");
+ return 105;
+ }
+ if (argv.length > 2) {
+ exclS = argv[2];
+ } else {
+ System.out.println("File for skipped tests should be defined");
+ return 105;
+ }
+
+ if (argv.length > 3) {
+ exclF = argv[3];
+ } else {
+ System.out.println("Exclude list was not defined");
+ exclFlag = false;
+ }
+ if (argv.length > 4) {
+ debugFlag = true;
+ }
+ if (exclF.length() == 0 && exclFlag) {
+ System.out.println("Exclude list was defined by empty string");
+ exclFlag = false;
+ }
+ if (exclFlag) {
+ try {
+ f1 = new File(exclF);
+ if (!f1.exists()) {
+ System.out.println("There is no file " + exclF);
+ exclFlag = false;
+ }
+ if (!f1.isFile()) {
+ System.out.println(exclF +" is not file");
+ exclFlag = false;
+ }
+ } catch (Exception e) {
+ System.out.println("Unexcpected error. Exclude list was not updated: "+e);
+ e.printStackTrace(System.err);
+ return 105;
+ }
+ if (exclFlag) {
+ if (createExcludeList(f1, debugFlag) != 0) {
+ return 105;
+ }
+ }
+ }
+ try {
+//System.err.println(excL.size()+" "+excFull.size());
+
+ bw = new BufferedWriter(new FileWriter(new File(cfgFN)));
+ br = new BufferedReader(new FileReader(new File(cfgF)));
+ bw1 = new BufferedWriter(new FileWriter(new File(exclS)));
+
+ int t;
+ int cntF = 0;
+ while (true) {
+ t = -1;
+ s = br.readLine();
+ if (s == null) {
+ break;
+ }
+ if (!exclFlag) {
+ bw.write(s);
+ bw.newLine();
+ continue;
+ }
+ if (s.indexOf("<test_case name") < 0) {
+ bw.write(s);
+ bw.newLine();
+ continue;
+ }
+ int ind = s.indexOf("\"");
+ if ((ind <= 0) || (ind == s.length() - 1) ){
+ bw.write(s);
+ bw.newLine();
+ continue;
+ }
+ String s1 = s.substring(ind +1);
+ int ind2 = s1.indexOf("\"");
+ if ((ind2 <= 0) || (ind2 == s1.length() -1)) {
+ bw.write(s);
+ bw.newLine();
+ continue;
+ }
+ s1 = s1.substring(0, ind2);
+
+
+ for (int i = 0; i < excL.size(); i++) {
+ if (s1.equals((String)excL.get(i))) {
+ t = i;
+ break;
+ }
+ }
+ if (t == -1) {
+ bw.write(s);
+ bw.newLine();
+ continue;
+ }
+ s1 = s.replaceFirst("execute=\"yes\"","execute=\"no\"");
+ if (!s1.equals(s)) {
+ cntUpdate++;
+ bw1.write((String)excFull.get(t));
+ bw1.newLine();
+ cntF++;
+ }
+ if (debugFlag) {
+ System.out.println(cntUpdate+"--"+s);
+ System.out.println(cntUpdate+"++"+s1);
+ }
+ bw.write(s1);
+ bw.newLine();
+ }
+ bw.close();
+ br.close();
+ bw1.close();
+ if (debugFlag) {
+ System.out.println("==Number of updated tests: "+cntUpdate);
+ }
+
+ return 0;
+ } catch (Throwable e) {
+ e.printStackTrace(System.err);
+ return 105;
+ }
+ }
+
+
+ public static int createExcludeList(File ff, boolean debug) {
+ BufferedReader br = null;
+ String s = "";
+ int ind = -1;
+ int ind1 = -1;
+ try {
+ br = new BufferedReader(new FileReader(ff));
+ while (true) {
+ s = br.readLine();
+ if (s == null) {
+ break;
+ }
+ s = s.trim();
+ if (s.indexOf("#") == 0) {
+ continue;
+ }
+ if (s.indexOf("//") == 0) {
+ continue;
+ }
+ s = s.trim();
+ if (s.length() == 0) {
+ continue;
+ }
+ excFull.add(s);
+ ind = s.indexOf(" ");
+ ind1 = s.indexOf("\t");
+ if (ind > 0 ) {
+ if ( ind1 > 0) {
+ s = s.substring(0, (ind < ind1 ? ind : ind1));
+ } else {
+ s = s.substring(0, ind);
+ }
+ } else {
+ if ( ind1 > 0) {
+ s = s.substring(0, ind1);
+ }
+ }
+ ind = s.indexOf(".xml");
+ if (ind > 0) {
+ s = s.substring(0, ind);
+ }
+ s = s.replaceAll("/",".");
+ ind = s.lastIndexOf(".");
+
+ s = s.substring(ind + 1);
+ excL.add(s);
+ }
+ if (debug) {
+ for (int i = 0; i < excL.size(); i++) {
+ System.out.println((String)excL.get(i));
+ }
+ }
+ if (excL.size() == 0) {
+ exclFlag = false;
+ }
+ br.close();
+ return 0;
+ } catch (IOException e) {
+ System.out.println("Unexpected exception during creating exclude list: " + e);
+ e.printStackTrace(System.err);
+ if (br != null) {
+ try {
+ br.close();
+ } catch (IOException e1) {
+ System.out.println("Unexpected exception during closing exclude file: " + e1);
+ }
+ }
+ return 1;
+ }
+ }
+}
+
Propchange: harmony/enhanced/buildtest/branches/2.0/tests/tptp/updateExclude.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/buildtest/branches/2.0/tests/tptp/updateResults.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/tests/tptp/updateResults.java?view=auto&rev=548293
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/tests/tptp/updateResults.java (added)
+++ harmony/enhanced/buildtest/branches/2.0/tests/tptp/updateResults.java Mon Jun 18 03:37:24 2007
@@ -0,0 +1,220 @@
+import java.util.*;
+import java.io.*;
+
+public class updateResults {
+
+ public static LinkedList failedL = new LinkedList();
+ public static LinkedList failedL1 = new LinkedList();
+ public static LinkedList commL = new LinkedList();
+ public static LinkedList passedL = new LinkedList();
+ public static int totalTests = 0;
+ public static int failedTests = 0;
+ public static int errorTests = 0;
+ public static int passedTests = 0;
+ public static String allTime = "";
+
+ public static void main(String[] argv) {
+ System.exit(new updateResults().test(argv));
+ }
+ public int test(String[] argv) {
+ BufferedReader br = null;
+ BufferedWriter bw = null;
+ String resF = "";
+ String resR = "";
+ File f1;
+ String s = "";
+ if (argv.length > 0) {
+ resF = argv[0];
+ } else {
+ System.out.println("Results file was not defined");
+ return 105;
+ }
+ if (argv.length > 1) {
+ resR = argv[1];
+ } else {
+ System.out.println("Updated file was not defined");
+ return 105;
+ }
+ try {
+
+ f1 = new File(resF);
+ if (!f1.exists()) {
+ System.out.println("There is no results file");
+ }
+ if (cntResults(f1) <= 0) {
+ return 105;
+ }
+//System.out.println(cntResults(f1));
+
+ bw = new BufferedWriter(new FileWriter(new File(resR)));
+ bw.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
+ bw.newLine();
+ s = "<testsuite errors=\""
+ .concat(Integer.toString(errorTests)).concat("\" failures=\"")
+ .concat(Integer.toString(failedTests)).concat("\" name=\" \" tests=\"")
+ .concat(Integer.toString(totalTests)).concat("\" time=\"").concat(allTime)
+ .concat("\">");
+ bw.write(s);
+ bw.newLine();
+ bw.write("<properties>");
+ bw.newLine();
+ bw.write("</properties>");
+ bw.newLine();
+ for (int i = 0; i < passedL.size(); i++) {
+ bw.write((String)passedL.get(i));
+ bw.newLine();
+ }
+ for (int i = 0; i < failedL.size(); i++) {
+ bw.write((String)failedL.get(i));
+ bw.newLine();
+ s = "<failure message=\"\" type=\"\">";
+ bw.write(s.concat((String)commL.get(i)).concat(" </failure>"));
+ bw.newLine();
+ bw.write("</testcase>");
+ bw.newLine();
+ }
+
+ bw.write(" <system-out><![CDATA[]]>");
+ bw.newLine();
+ bw.write(" </system-out>");
+ bw.newLine();
+ bw.write(" <system-err><![CDATA[]]>");
+ bw.newLine();
+ bw.write(" </system-err>");
+ bw.newLine();
+ bw.write(" </testsuite>");
+ bw.newLine();
+
+ bw.close();
+ return 0;
+ } catch (Throwable e) {
+ e.printStackTrace(System.err);
+ return 105;
+ }
+ }
+
+
+ public static int cntResults(File ff) {
+ BufferedReader br = null;
+ String s = "";
+ String s1 = "";
+ String s2 = "";
+ StringBuffer sb = new StringBuffer();
+ StringTokenizer st = null;
+ StringTokenizer st1 = null;
+
+ try {
+ br = new BufferedReader(new FileReader(ff));
+ while (true) {
+ s = br.readLine();
+ if (s == null) {
+ break;
+ }
+ if (s.indexOf("There were no test cases") != -1) {
+ continue;
+ }
+ if (s.indexOf("Check the local configuration") != -1) {
+ continue;
+ }
+ if (s.startsWith("Time:"))
+ {
+ int ind = s.indexOf(" ");
+ allTime = s.substring(ind+1);
+ break;
+ }
+ sb.append(s);
+ }
+ st = new StringTokenizer(sb.toString(), ".");
+
+ while (st.hasMoreTokens()) {
+ s = st.nextToken();
+ s = s.trim();
+ if (s.length() == 0) {
+ continue;
+ }
+
+ st1 = new StringTokenizer(s, " ");
+ totalTests ++;
+ String nm = st1.nextToken();
+ String tm = st1.nextToken();
+ s = "<testcase name=\"".concat(nm).concat("\" classname=\" \" time=\"").concat(tm).concat("\">");
+ if (st1.countTokens() == 1) {
+ failedL.add(s);
+ failedL1.add(nm);
+ failedTests ++;
+ } else {
+ passedTests ++;
+ passedL.add(s.concat("</testcase>"));
+ }
+ }
+ if (failedTests == 0) {
+ br.close();
+ return totalTests;
+ }
+
+ int nmb = 0;
+ String comm = "";
+ boolean isTest = false;
+ while (true) {
+ s = br.readLine();
+ if (s == null) {
+ break;
+ }
+ if (s.startsWith("FAILURES!")) {
+ commL.add(comm);
+ break;
+ }
+ if (!isTest) {
+ s1 = Integer.toString(nmb+1).concat(") ").concat((String)failedL1.get(nmb));
+ if (s.startsWith(s1)) {
+ int p = s.indexOf(" ");
+ comm = comm.concat(s.substring(p)).concat("\n");
+ isTest = true;
+ nmb++;
+ if (nmb < failedL1.size()) {
+ s1 = Integer.toString(nmb+1).concat(") ").concat((String)failedL1.get(nmb));
+ } else {
+ s1 = "";
+ }
+ }
+ } else {
+ if (s1.length() == 0) {
+ comm = comm.concat(s).concat("\n");
+ continue;
+ }
+ if (s.startsWith(s1)) {
+ commL.add(comm);
+ comm = "";
+ int p = s.indexOf(" ");
+ comm = comm.concat(s.substring(p)).concat("\n");
+ s1 = Integer.toString(nmb+1).concat(") ").concat((String)failedL1.get(nmb));
+ nmb++;
+ if (nmb < failedL1.size()) {
+ s1 = Integer.toString(nmb+1).concat(") ").concat((String)failedL1.get(nmb));
+ } else {
+ s1 = "";
+ }
+ } else {
+ comm = comm.concat(s).concat("\n");
+ }
+ }
+
+ }
+
+ br.close();
+ return totalTests;
+ } catch (IOException e) {
+ System.out.println("Unexpected exception during creating exclude list: " + e);
+ e.printStackTrace(System.err);
+ if (br != null) {
+ try {
+ br.close();
+ } catch (IOException e1) {
+ System.out.println("Unexpected exception during closing exclude file: " + e1);
+ }
+ }
+ return -1;
+ }
+ }
+}
+
Propchange: harmony/enhanced/buildtest/branches/2.0/tests/tptp/updateResults.java
------------------------------------------------------------------------------
svn:eol-style = native