Merge tests into main build.xml as an optional target.
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 15 Jun 2009 18:58:55 +0000 (18:58 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 15 Jun 2009 18:58:55 +0000 (18:58 +0000)
Hopefully start to use Tomcat class as basis for test cases for bugs.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@784919 13f79535-47bb-0310-9956-ffa450edef68

build.xml
test.xml [deleted file]

index add98b6..1b13e7c 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -51,8 +51,7 @@
   <property name="tomcat.classes"    value="${basedir}/output/classes"/>
   <property name="tomcat.dist"       value="${basedir}/output/dist"/>
   <property name="tomcat.embed"      value="${basedir}/output/embed"/>
-  <property name="test.failonerror"  value="true"/>
-  <property name="test.runner"       value="junit.textui.TestRunner"/>
+  <property name="test.classes"      value="${basedir}/output/testclasses"/>
 
   <property name="compile.source" value="1.6"/>
   <property name="compile.target" value="1.6"/>
     <pathelement location="${jdt.jar}"/>
   </path>
 
+  <path id="tomcat.test.classpath">
+    <pathelement location="${test.classes}"/>
+    <pathelement location="${tomcat.classes}"/>
+    <pathelement location="${junit.jar}"/>
+  </path>
+
   <!-- Version info filter set -->
   <tstamp>
     <format property="TODAY" pattern="MMM d yyyy" locale="en"/>
 
   </target>
 
+  <target name="test-compile" depends="compile" >
+    <mkdir dir="${test.classes}"/>
+    <!-- Compile -->
+    <javac srcdir="test" destdir="${test.classes}"
+           debug="${compile.debug}"
+           deprecation="${compile.deprecation}"
+           source="${compile.source}"
+           optimize="${compile.optimize}">
+      <classpath refid="tomcat.test.classpath" />
+      <include name="org/apache/**" />
+    </javac>
+  </target>
+
+  <target name="test" description="JUnit test cases"
+    depends="compile,test-compile" >
+       
+       <junit printsummary="yes" fork="yes">
+         <classpath refid="tomcat.test.classpath" />
+
+      <formatter type="plain" usefile="false" />
+
+      <batchtest>
+        <fileset dir="test" >
+          <!-- Include all by default -->
+         <include name="**/Test*.java" />
+          <!-- Exclude TestAll ortherwise there will be duplicated -->
+          <exclude name="**/TestAll.java" />
+          <!-- Exclude helper classes -->
+          <exclude name="**/Tester*.java" />
+          <!-- Exclude the tests known to fail -->
+          <exclude name="org/apache/catalina/tribes/**" />
+        </fileset>
+         </batchtest>
+       </junit>
+  </target>
+
   <target name="clean-depend"
          description="Clean depend src components">
      <delete dir="${tomcat-dbcp.home}"/>
       <param name="destdir" value="${json-lib.home}"/>
     </antcall>
 
+    <target name="download" >
+      <antcall target="downloadzip">
+        <param name="sourcefile" value="${junit.loc}"/>
+        <param name="destfile" value="${junit.jar}"/>
+        <param name="destdir" value="${base.path}"/>
+      </antcall>
+    </target>
+
   </target>
 
   <target name="build-tomcat-dbcp">
diff --git a/test.xml b/test.xml
deleted file mode 100644 (file)
index 6c9bb0f..0000000
--- a/test.xml
+++ /dev/null
@@ -1,98 +0,0 @@
-<?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="Tomcat 6.0" default="all" basedir=".">
-
-  <!-- See "build.properties.sample" in the top level directory for all     -->
-  <!-- property values you must customize for successful building!!!        -->
-  <property file="${user.home}/build.properties"/>
-  <property file="build.properties"/>
-
-  <property file="build.properties.default"/>
-
-  <property name="test.classes" value="${basedir}/output/testclasses"/>
-  <property name="tomcat.classes" value="${basedir}/output/classes"/>
-
-  <property name="compile.source" value="1.5"/>
-  <property name="compile.debug" value="true"/>
-
-  <property name="test.runner" value="junit.textui.TestRunner"/>
-
-  <path id="tomcat.test.classpath">
-    <pathelement location="${test.classes}"/>
-    <pathelement location="${tomcat.classes}"/>
-    <pathelement location="${junit.jar}"/>
-  </path>
-
-  <target name="compile" depends="download" >
-    <mkdir dir="${test.classes}"/>
-    <!-- Compile -->
-    <javac srcdir="test" destdir="${test.classes}"
-           debug="${compile.debug}"
-           deprecation="${compile.deprecation}"
-           source="${compile.source}"
-           optimize="${compile.optimize}">
-      <classpath refid="tomcat.test.classpath" />
-      <include name="org/apache/**" />
-    </javac>
-  </target>
-
-  <target name="all" depends="compile">
-    <java dir="${test.classes}" classname="${test.runner}" fork="yes"
-          failonerror="${test.failonerror}">
-      <arg value="org.apache.TestAll"/>
-      <classpath refid="tomcat.test.classpath"/>
-    </java>
-  </target>
-       
-  <target name="download" >
-       <antcall target="downloadzip">
-      <param name="sourcefile" value="${junit.loc}"/>
-      <param name="destfile" value="${junit.jar}"/>
-      <param name="destdir" value="${base.path}"/>
-       </antcall>
-  </target>
-       
-  <target name="downloadzip" unless="exist" depends="setproxy,testexist">
-    <!-- Download and extract the package -->
-    <get src="${sourcefile}" dest="${base.path}/file.zip" />
-    <mkdir dir="${destdir}" />
-    <unzip src="${base.path}/file.zip" dest="${destdir}"/>
-    <delete file="${base.path}/file.zip"/>
-  </target>
-       
-  <target name="proxyflags">
-    <!-- check proxy parameters. -->
-    <condition property="useproxy">
-      <equals arg1="${proxy.use}" arg2="on" />
-    </condition>
-  </target>
-
-  <target name="setproxy" depends="proxyflags" if="useproxy">
-    <taskdef name="setproxy"
-            classname="org.apache.tools.ant.taskdefs.optional.net.SetProxy" />
-    <setproxy proxyhost="${proxy.host}" proxyport="${proxy.port}"
-              proxyuser="${proxy.user}" proxypassword="${proxy.password}" />
-    <echo message="Using ${proxy.host}:${proxy.port} to download ${sourcefile}"/>
-  </target>
-
-  <target name="testexist">
-    <echo message="Testing  for ${destfile}"/>
-    <available file="${destfile}" property="exist"/>
-  </target>
-
-</project>