You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by go...@apache.org on 2012/09/28 22:58:27 UTC

svn commit: r1391655 - in /incubator/flex/falcon/trunk: build.xml compiler.tests/build.xml compiler.tests/downloads.xml

Author: gordonsmith
Date: Fri Sep 28 20:58:27 2012
New Revision: 1391655

URL: http://svn.apache.org/viewvc?rev=1391655&view=rev
Log:
Falcon: 'ant tests' now downloads the JUnit JAR and runs the Junit tests.

Added:
    incubator/flex/falcon/trunk/compiler.tests/downloads.xml   (with props)
Modified:
    incubator/flex/falcon/trunk/build.xml
    incubator/flex/falcon/trunk/compiler.tests/build.xml

Modified: incubator/flex/falcon/trunk/build.xml
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/build.xml?rev=1391655&r1=1391654&r2=1391655&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/build.xml (original)
+++ incubator/flex/falcon/trunk/build.xml Fri Sep 28 20:58:27 2012
@@ -41,10 +41,12 @@
 
     <target name="clean" description="Cleans the build output but leaves any downloaded JARs.">
         <ant dir="compiler" target="clean"/>
+        <ant dir="compiler.tests" target="clean"/>
     </target>
 
     <target name="wipe" description="Wipes out everything that didn't come from Subversion.">
         <ant dir="compiler" target="wipe"/>
+        <ant dir="compiler.tests" target="wipe"/>
 		<delete dir="sdk/generated"/>
     </target>
 

Modified: incubator/flex/falcon/trunk/compiler.tests/build.xml
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/build.xml?rev=1391655&r1=1391654&r2=1391655&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/build.xml (original)
+++ incubator/flex/falcon/trunk/compiler.tests/build.xml Fri Sep 28 20:58:27 2012
@@ -25,9 +25,15 @@
         <path location="${basedir}"/>
     </pathconvert>
 
-    <property name="sdk" value="${compiler.tests}/../compiler/generated/dist/sdk"/>
+    <property name="compiler" value="${compiler.tests}/../compiler"/>
+    <property name="sdk" value="${compiler}/generated/dist/sdk"/>
 
-    <target name="jars">
+    <target name="download" description="Downloads third-party JARs">
+        <ant antfile="${compiler.tests}/downloads.xml" dir="${compiler.tests}"/>
+    	<delete dir="${compiler.tests}/in"/>
+    </target>
+
+    <target name="jar.tests">
         <java jar="${sdk}/lib/falcon-mxmlc.jar" fork="true"/>
         <java jar="${sdk}/lib/falcon-compc.jar" fork="true"/>
         <java jar="${sdk}/lib/falcon-asc.jar" fork="true"/>
@@ -35,7 +41,7 @@
         <java jar="${sdk}/lib/falcon-swfdump.jar" fork="true"/>
     </target>
 
-    <target name="ant.tasks">
+    <target name="ant.tests">
         <property name="FLEX_HOME" value="${sdk}"/>
         <taskdef resource="flexTasks.tasks" classpath="${sdk}/lib/flexTasks.jar"/>
         <mxmlc file="${compiler.tests}/Hello.as"/>
@@ -46,6 +52,51 @@
         <delete file="${compiler.tests}/Hello.swc"/>
     </target>
 
-    <target name="main" depends="jars, ant.tasks"/>
+    <target name="compile.unit.tests">
+        <mkdir dir="${compiler.tests}/classes"/>
+        <javac debug="${javac.debug}" deprecation="${javac.deprecation}" destdir="${compiler.tests}/classes">
+            <src path="${compiler.tests}/unit-tests"/>
+            <compilerarg value="-Xlint:all,-path"/>
+            <classpath>
+                <fileset dir="${compiler}/lib" includes="**/*.jar"/>
+                <fileset dir="${compiler.tests}/lib" includes="**/*.jar"/>
+                <pathelement location="${sdk}/lib/compiler.jar"/>
+            </classpath>
+        </javac>
+    </target>
+
+    <target name="unit.tests" depends="download, compile.unit.tests">
+        <mkdir dir="${compiler.tests}/results"/>
+        <junit dir="${compiler.tests}"
+               fork="yes" forkMode="perBatch" maxmemory="256m" timeout="300000"
+               printsummary="true" showoutput="true"
+               haltonerror="false" haltonfailure="false"
+               failureproperty="tests.unit.failed">
+            <classpath>
+                <pathelement location="${compiler.tests}/classes"/>
+                <fileset dir="${compiler}/lib" includes="**/*.jar"/>
+                <fileset dir="${compiler.tests}/lib" includes="**/*.jar"/>
+                <pathelement location="${sdk}/lib/compiler.jar"/>
+            </classpath>
+            <batchtest todir="${compiler.tests}/results">
+                <fileset dir="${compiler.tests}/classes">
+                    <include name="**/*Tests.class"/>
+                </fileset>
+            </batchtest>
+            <formatter type="xml"/>
+        </junit>
+    </target>
+
+    <target name="main" depends="unit.tests, jar.tests, ant.tests"/>
+
+    <target name="clean">
+        <delete dir="${compiler.tests}/bin"/>
+        <delete dir="${compiler.tests}/classes"/>
+        <delete dir="${compiler.tests}/results"/>
+    </target>
+
+    <target name="wipe" depends="clean">
+        <delete dir="${compiler.tests}/lib"/>
+    </target>
 
 </project>

Added: incubator/flex/falcon/trunk/compiler.tests/downloads.xml
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/downloads.xml?rev=1391655&view=auto
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/downloads.xml (added)
+++ incubator/flex/falcon/trunk/compiler.tests/downloads.xml Fri Sep 28 20:58:27 2012
@@ -0,0 +1,119 @@
+<?xml version="1.0"?>
+<!--
+
+  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="downloads" default="main" basedir=".">
+	
+    <pathconvert property="compiler.tests" dirsep="/">
+        <path location="${basedir}"/>
+    </pathconvert>
+
+    <property name="lib.dir" value="${compiler.tests}/lib"/>
+    
+	<property name="download.dir" value="${compiler.tests}/in"/>
+    
+	<!-- 
+	   Notes:
+	       For Apache, the JARS must be removed from the repository.
+	       
+	       Licenses:
+            JUnit (4.10) - CPL 1.0        
+	-->
+		     
+    <!-- 
+        Because the downloads requires a network connection and the JARs don't change very often, 
+        they are each downloaded only if they don't already exist. 
+    -->
+    
+	<target name="main" depends="prepare, junit-jar"
+		    description="Downloads all the required thirdparty JARs"/>
+
+    <target name="prepare" >
+        <mkdir dir="${lib.dir}" />
+    </target>
+    
+    <!--
+		Cleanup
+	-->
+	
+    <target name="clean" 
+            description="Removes thirdparty downloads.">
+        <delete includeEmptyDirs="true" failonerror="false">
+            <fileset dir="${download.dir}">
+                <include name="junit*/**"/>
+            </fileset>
+        </delete>
+    </target>
+    
+    <!--
+	    Download thirdparty JARs    
+	-->
+
+    <!--
+        Download a jar file and optionally verify the checksum.
+        If the checksum fails, this script fails.
+        
+        Params are:
+            srcUrl
+            srcJarFile
+            destJarFile
+            [md5]
+    -->
+    <target name="download-jar" 
+            description="Downloads jar, and optionally verifies checksum.">                    
+        <get src="${srcUrl}/${srcJarFile}" dest="${destJarFile}"/>
+        <checksum file="${destJarFile}" algorithm="MD5" property="${we.failed}"/>
+        <antcall target="fail-with-message">
+            <param name="message" value="Checksum mismatch for ${destJarFile}"/>
+        </antcall>
+    </target>
+
+    <target name="fail-with-message" if="we.failed" 
+            description="Conditionally fails with the specified message">                
+        <fail message="${message}"/>
+    </target>
+        
+    <!--
+        junit
+    -->
+    
+    <target name="junit-jar-check" description="Checks if JUnit JAR exists.">
+    	<condition property="junit.jar.exists">
+    	    <and>
+    	        <available file="${lib.dir}/junit-4.10.jar"/>
+    	    </and>
+        </condition>
+    </target>
+    
+    <target name="junit-jar" depends="junit-jar-check" unless="junit.jar.exists"
+            description="Copies the JUnit JAR to the lib directory.">
+        <echo message="Obtaining lib/junit-4.10.jar"/>
+        <antcall target="junit-download-jar"/>
+    </target>
+    
+    <target name="junit-download-jar" depends="junit-jar-check" unless="junit.jar.exists"
+            description="Downloads the JUnit jar.">
+        <antcall target="download-jar">
+            <param name="srcUrl" value="http://cloud.github.com/downloads/KentBeck/junit"/>
+            <param name="srcJarFile" value="junit-4.10.jar"/>
+            <param name="destJarFile" value="${lib.dir}/junit-4.10.jar"/>
+        </antcall>
+    </target>
+    
+</project>

Propchange: incubator/flex/falcon/trunk/compiler.tests/downloads.xml
------------------------------------------------------------------------------
    svn:eol-style = native