harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r644172 - in /harmony/enhanced/buildtest/trunk/infra: build.xml scripts/run.xml
Date Thu, 03 Apr 2008 05:33:38 GMT
Author: smishura
Date: Wed Apr  2 22:33:38 2008
New Revision: 644172

URL: http://svn.apache.org/viewvc?rev=644172&view=rev
Log:
* Add new 'run' module
* Switch run target to using props generated by 'config.xml'

Added:
    harmony/enhanced/buildtest/trunk/infra/scripts/run.xml   (with props)
Modified:
    harmony/enhanced/buildtest/trunk/infra/build.xml

Modified: harmony/enhanced/buildtest/trunk/infra/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/trunk/infra/build.xml?rev=644172&r1=644171&r2=644172&view=diff
==============================================================================
--- harmony/enhanced/buildtest/trunk/infra/build.xml (original)
+++ harmony/enhanced/buildtest/trunk/infra/build.xml Wed Apr  2 22:33:38 2008
@@ -62,6 +62,7 @@
         <propertyref name="adaptors.dir" />
         <propertyref name="scripts.dir" />
         <propertyref name="config.dir" />
+        <propertyref name="results.dir" />
         <propertyref name="checkouts.dir" />
         <propertyref name="framework.properties.file" />
         <propertyref name="framework.implementation.file" />
@@ -279,8 +280,59 @@
     <!-- ================================================================== 
                           Test Execution Functionality
          ================================================================== -->
-    <target name="run"
-            depends="check-setup, init-framework, init-suites, run-suites" />
+    <target name="run" depends="load-suites-configuration">
+
+        <!-- verify that all required params are set -->
+        <check-required-parameters />
+
+        <!-- get the list of set up suites -->
+        <pathconvert pathsep="," property="suites.run.list">
+            <path>
+                <fileset dir="${config.dir}">
+                    <include name="*.properties" />
+                </fileset>
+            </path>
+            <chainedmapper>
+                <flattenmapper />
+                <globmapper from="*.properties" to="*" />
+            </chainedmapper>
+        </pathconvert>
+
+        <!-- temporary file to store intermediate results of iteration -->
+        <property name="tmp.file" location="${scripts.dir}/tmp.txt" />
+        <echo message="" file="${tmp.file}" />
+        <subant genericantfile="${scripts.dir}/run.xml"
+                target="-run-suite"
+                inheritall="true"
+                inheritrefs="true">
+            <dirset dir="${adaptors.dir}" includes="${suites.run.list}" />
+            <property name="failonerror" value="false" />
+        </subant>
+
+        <!-- check status: get the list of failed suites -->
+        <loadfile property="failed.list" srcfile="${tmp.file}">
+            <filterchain>
+                <linecontains>
+                    <contains value="=true" />
+                </linecontains>
+                <tokenfilter>
+                    <replaceregex pattern="([^=])=true" replace="\1" />
+                </tokenfilter>
+                <tokenfilter>
+                    <filetokenizer />
+                    <replaceregex pattern="\n" replace="," flags="gs" />
+                </tokenfilter>
+            </filterchain>
+        </loadfile>
+        <delete file="${tmp.file}" />
+
+        <fail>
+            <condition>
+                <isset property="failed.list" />
+            </condition>
+            The following suites failed: ${failed.list}
+        </fail>
+    </target>
 
     <target name="run-cc"
             description="run-cc"

Added: harmony/enhanced/buildtest/trunk/infra/scripts/run.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/trunk/infra/scripts/run.xml?rev=644172&view=auto
==============================================================================
--- harmony/enhanced/buildtest/trunk/infra/scripts/run.xml (added)
+++ harmony/enhanced/buildtest/trunk/infra/scripts/run.xml Wed Apr  2 22:33:38 2008
@@ -0,0 +1,113 @@
+<?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" basedir=".">
+
+    <import file="framework.xml" />
+
+    <target name="-run-suite" if="not.yet.run" depends="-check-if-was-run">
+
+        <!-- mark a suite as running -->
+        <echo message="#${suite.name}#${line.separator}"
+              file="${tmp.file}"
+              append="true" />
+
+        <!-- dependencies go first -->
+        <run-dependencies suite="${suite.name}" />
+
+        <!-- fork suite's run as a separate process. This lets the build:
+             * to import framework.xml as several adaptors use it
+             * to complete even some suites failed
+               (but fail if dependency failed. see target '-run-dependencies')
+        -->
+        <exec-ant dir="${scripts.dir}"
+                  file="run.xml"
+                  targets="run"
+                  failonerror="${failonerror}"
+                  failproperty="suite.failed">
+            <sysproperty key="suite.name" value="${suite.name}" />
+            <sysproperty key="config.dir" value="${config.dir}" />
+        </exec-ant>
+
+        <!-- store suite's execution status -->
+        <echo file="${tmp.file}" append="true">
+${suite.name}=${suite.failed}
+        </echo>
+    </target>
+
+    <target name="-check-if-was-run">
+
+        <basename file="${basedir}" property="suite.name" />
+        <condition property="not.yet.run">
+            <isfileselected file="${tmp.file}">
+                <not>
+                    <!-- find the marker to see if a suite was run or not -->
+                    <contains text="#${suite.name}#" casesensitive="yes" />
+                </not>
+            </isfileselected>
+        </condition>
+    </target>
+
+    <macrodef name="run-dependencies">
+        <attribute name="suite" />
+        <sequential>
+
+            <property name="dependencies.list"
+                      value="${@{suite}.parameters.depends}" />
+
+            <condition property="@{suite}.has.dependency">
+                <length string="${dependencies.list}"
+                        trim="true"
+                        length="0"
+                        when="greater" />
+            </condition>
+
+            <subant genericantfile="${scripts.dir}/run.xml"
+                    target="-run-dependencies"
+                    inheritall="true"
+                    buildpath="${scripts.dir}" />
+        </sequential>
+    </macrodef>
+
+    <target name="-run-dependencies" if="${suite.name}.has.dependency">
+
+        <subant genericantfile="${scripts.dir}/run.xml"
+                target="-run-suite"
+                inheritall="false">
+            <dirset dir="${adaptors.dir}" includes="${dependencies.list}" />
+            <property name="adaptors.dir" value="${adaptors.dir}" />
+            <property name="config.dir" value="${config.dir}" />
+            <property name="scripts.dir" value="${scripts.dir}" />
+            <property name="tmp.file" value="${tmp.file}" />
+
+            <!-- fail if dependency failed -->
+            <property name="failonerror" value="true" />
+        </subant>
+    </target>
+
+    <target name="run">
+        <property file="${config.dir}/${suite.name}.properties" />
+
+        <ant dir="${adaptors.dir}/${suite.name}"
+             antfile="adaptor.xml"
+             target="run"
+             inheritall="true">
+            <property name="suite.adaptor.dir"
+                      location="${adaptors.dir}/${suite.name}" />
+        </ant>
+    </target>
+</project>

Propchange: harmony/enhanced/buildtest/trunk/infra/scripts/run.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message