You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sk...@apache.org on 2005/07/06 14:41:31 UTC

svn commit: r209453 - /jakarta/commons/proper/logging/trunk/build.xml

Author: skitching
Date: Wed Jul  6 05:41:30 2005
New Revision: 209453

URL: http://svn.apache.org/viewcvs?rev=209453&view=rev
Log:
Massive removal of custom test targets now most tests support the PathableTestSuite stuff.

Modified:
    jakarta/commons/proper/logging/trunk/build.xml

Modified: jakarta/commons/proper/logging/trunk/build.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/build.xml?rev=209453&r1=209452&r2=209453&view=diff
==============================================================================
--- jakarta/commons/proper/logging/trunk/build.xml (original)
+++ jakarta/commons/proper/logging/trunk/build.xml Wed Jul  6 05:41:30 2005
@@ -49,6 +49,17 @@
   <property name="junit.home"              value="/usr/local/junit3.5"/>
   <property name="jakarta.home"            value="../.."/>
 
+  <!--
+    - The names of the unit tests to run. By default all tests are run, but
+    - this can be overridden from the command line by something like:
+    -   ant -Dtestmatch=**/FooTestCase.java test
+    -
+    - Currently, the default is to run only the "pathable" test cases as
+    - the others still need to be converted over to specifying their
+    - custom classpaths.
+    -->
+  <property name="testmatch" value="**/pathable/*TestCase"/>
+
 
 <!-- ========== Derived Values ============================================ -->
 
@@ -101,6 +112,7 @@
   <property name="core.jar.name" value="commons-${component.name}-${component.version}.jar"/>
   <property name="api.jar.name" value="commons-${component.name}-api-${component.version}.jar"/>
   <property name="adapters.jar.name" value="commons-${component.name}-adapters-${component.version}.jar"/>
+  <property name="optional.jar.name" value="commons-${component.name}-optional-${component.version}.jar"/>
   
 <!-- ========== Compiler Defaults ========================================= -->
 
@@ -143,13 +155,6 @@
     <pathelement location="${servletapi.jar}"/>
   </path>
 
-  <!-- Construct unit test classpath (JDK 1.4 tests) -->
-  <path id="test.classpath.jdk14">
-    <pathelement location="${build.home}/classes"/>
-    <pathelement location="${build.home}/tests"/>
-    <pathelement location="${junit.jar}"/>
-  </path>
-
   <!-- Construct unit test classpath (Log4J tests) -->
   <path id="test.classpath.log4j13">
     <pathelement location="${build.home}/classes"/>
@@ -180,6 +185,7 @@
   <property name="test.sysprops.commons-logging" value="${build.home}/${core.jar.name}"/>
   <property name="test.sysprops.commons-logging-api" value="${build.home}/${api.jar.name}"/>
   <property name="test.sysprops.commons-logging-adapters" value="${build.home}/${adapters.jar.name}"/>
+  <property name="test.sysprops.commons-logging-optional" value="${dist.home}/${optional.jar.name}"/>
   <propertyset id="test-lib-props">
     <propertyref prefix="test.sysprops."/>
     <mapper type="glob" from="test.sysprops.*" to="*"/>
@@ -580,7 +586,7 @@
 
 
   <target name="test"
-       depends="test.alt-hashtable, log4j12-test-warning, compile.tests,test.jdk14,test.simple,test.avalon,test.log4j"
+       depends="log4j12-test-warning, compile.tests, testall, test.log4j"
             if="test.entry"
    description="Run all unit test cases">
       <java    classname="${test.runner}" fork="yes"
@@ -592,7 +598,7 @@
 
 
   <!--
-    - Target to run all unit tests under the "pathable" directory.
+    - Target to run all unit tests (except log4j tests for now).
     -
     - The batchtest task auto-detects what tests are available without
     - any need to define TestSuite objects in the code to compose
@@ -605,17 +611,17 @@
     - If you're having problems running this target due to the use of
     - the "junit" task below, see the comments at the head of this file.
     - 
-    - TODO: implement something like the "testmatchpattern" feature
-    - of maven's test task. This would allow people to do something like
-    -   ant -Dtestmatchpattern=**/FooTestCase.java test.pathable
-    - in order to run specific test cases, or subsets of test cases.
+    - Individual tests (or subsets of tests) can be run by doing
+    -   ant -Dtestmatch=**/FooTestCase testall
     -->
-  <target name="test.pathable" depends="compile.tests"
+
+  <target name="testall" depends="compile.tests"
    description="Run unit tests specific to Pathable support classes">
     <echo message="Test output can be found in directory ${build.home}/test-reports."/>
     <delete dir="${build.home}/test-reports"/>
     <mkdir dir="${build.home}/test-reports"/>
 
+      <echo message="executing tests [${testmatch}.java]"/>
     <!--
       - Note that the fork/forkmode settings define default behaviour for tests. 
       - The <test> and <batchtest> tags can override these settings if needed.
@@ -632,144 +638,37 @@
         - the use of the PathableClassLoader class used by some unit tests.
 	-->
       <syspropertyset refid="test-lib-props"/>
-      <classpath>
-        <pathelement location="${build.home}/tests"/>
-        <pathelement location="${junit.jar}"/>
-      </classpath>
+      <classpath refid="test.classpath"/>
 
       <!--
-        - Auto-detect the tests to run. Checking the source directory
-	- for java files rather than the ${build.home}/tests directory
-	- for .class files is deliberate; that will pick up any problems
-	- where we haven't correctly compiled all the available unit test
-	- source files.
+        - Auto-detect the tests to run. Checking the ${build.home}/tests
+	- directory for .class files rather than the src/test directory
+	- for .java files means that when we run the tests on platforms
+	- where some components (eg jdk14 logging) is not available, 
+	- just ensuring the tests are skipped from the compile will
+	- also cause them to be skipped from the testing.
+	-
+	- This does introduce the danger that if tests accidentally
+	- fail to compile then we won't notice it here. However that
+	- should have been reported earlier anyway.
 	-->
       <batchtest todir="${build.home}/test-reports">
-        <fileset dir="${test.home}">
-          <include name="**/pathable/*TestCase.java"/>
+        <fileset dir="${build.home}/tests">
+          <include name="${testmatch}.class"/>
+
+	  <!--
+	    - Because we have two possible log4j jar files we
+	    - can't include them in the system classpath, and
+	    - so can't run the log4j tests here until after
+	    - those TestCase classes have been converted over
+	    - to using the PathableTestSuite approach.
+	    -->
+          <exclude name="**/log4j/*"/>
         </fileset>
       </batchtest>
     </junit>
   </target>
 
-  <target name="test.jdk14" depends="compile.tests" if="jdk.1.4.present"
-   description="Run unit tests specific to JDK 1.4 logging">
-
-    <echo message="Default Configuration (JDK 1.4 Auto-Recognized)"/>
-    <java classname="${test.runner}" fork="yes" failonerror="${test.failonerror}">
-      <arg value="org.apache.commons.logging.jdk14.DefaultConfigTestCase"/>
-      <classpath refid="test.classpath.jdk14"/>
-      <syspropertyset refid="test-lib-props"/>
-    </java>
-
-    <echo message="Default Configuration (JDK 1.4 LogFactoryImpl Selected)"/>
-    <java classname="${test.runner}" fork="yes" failonerror="${test.failonerror}">
-      <sysproperty key="org.apache.commons.logging.LogFactory"
-                 value="org.apache.commons.logging.impl.LogFactoryImpl"/>
-      <arg value="org.apache.commons.logging.jdk14.DefaultConfigTestCase"/>
-      <classpath refid="test.classpath.jdk14"/>
-      <syspropertyset refid="test-lib-props"/>
-    </java>
-
-    <echo message="Default Configuration (JDK 1.4 Jdk14Logger Selected)"/>
-    <java classname="${test.runner}" fork="yes" failonerror="${test.failonerror}">
-      <sysproperty key="org.apache.commons.logging.Log"
-                 value="org.apache.commons.logging.impl.Jdk14Logger"/>
-      <arg value="org.apache.commons.logging.jdk14.DefaultConfigTestCase"/>
-      <classpath refid="test.classpath.jdk14"/>
-      <syspropertyset refid="test-lib-props"/>
-    </java>
-
-    <echo message="Custom Configuration (JDK 1.4 Auto-Recognized)"/>
-    <java classname="${test.runner}" fork="yes" failonerror="${test.failonerror}">
-      <arg value="org.apache.commons.logging.jdk14.CustomConfigTestCase"/>
-      <classpath refid="test.classpath.jdk14"/>
-      <syspropertyset refid="test-lib-props"/>
-    </java>
-
-    <echo message="Custom Configuration (JDK 1.4 LogFactoryImpl Selected)"/>
-    <java classname="${test.runner}" fork="yes" failonerror="${test.failonerror}">
-      <sysproperty key="org.apache.commons.logging.LogFactory"
-                 value="org.apache.commons.logging.impl.LogFactoryImpl"/>
-      <arg value="org.apache.commons.logging.jdk14.CustomConfigTestCase"/>
-      <classpath refid="test.classpath.jdk14"/>
-      <syspropertyset refid="test-lib-props"/>
-    </java>
-
-    <echo message="Custom Configuration (JDK 1.4 Jdk14Logger Selected)"/>
-    <java classname="${test.runner}" fork="yes" failonerror="${test.failonerror}">
-      <sysproperty key="org.apache.commons.logging.Log"
-                 value="org.apache.commons.logging.impl.Jdk14Logger"/>
-      <arg value="org.apache.commons.logging.jdk14.CustomConfigTestCase"/>
-      <classpath refid="test.classpath.jdk14"/>
-    </java>
-    
-    <echo message="Basic Operations"/>
-    <java classname="${test.runner}" fork="yes" failonerror="${test.failonerror}">
-      <sysproperty key="org.apache.commons.logging.Log"
-                 value="org.apache.commons.logging.impl.Jdk14Logger"/>
-      <arg value="org.apache.commons.logging.BasicOperationsTest"/>
-      <classpath refid="test.classpath.log4j12"/>
-    </java>
-
-
-    <echo message="Hierarchy Configuration API (JDK 1.4 Auto-Recognized)"/>
-    <java classname="${test.runner}" fork="yes" failonerror="${test.failonerror}">
-      <arg value="org.apache.commons.logging.jdk14.CustomConfigAPITestCase"/>
-      <classpath refid="test.classpath.jdk14"/>
-      <syspropertyset refid="test-lib-props"/>
-    </java>
-
-    <echo message="Hierarchy Configuration API (JDK 1.4 LogFactoryImpl Selected)"/>
-    <java classname="${test.runner}" fork="yes" failonerror="${test.failonerror}">
-      <arg value="org.apache.commons.logging.jdk14.CustomConfigAPITestCase"/>
-      <classpath refid="test.classpath.jdk14"/>
-      <syspropertyset refid="test-lib-props"/>
-
-      <sysproperty key="org.apache.commons.logging.LogFactory"
-                 value="org.apache.commons.logging.impl.LogFactoryImpl"/>
-    </java>
-
-    <echo message="Hierarchy Configuration API (JDK 1.4 Jdk14Logger Selected)"/>
-    <java classname="${test.runner}" fork="yes" failonerror="${test.failonerror}">
-      <arg value="org.apache.commons.logging.jdk14.CustomConfigAPITestCase"/>
-      <classpath refid="test.classpath.jdk14"/>
-      <syspropertyset refid="test-lib-props"/>
-
-      <sysproperty key="org.apache.commons.logging.Log"
-                 value="org.apache.commons.logging.impl.Jdk14Logger"/>
-    </java>
-
-    <echo message="Hierarchy Configuration FULL (JDK 1.4 Auto-Recognized)"/>
-    <java classname="${test.runner}" fork="yes" failonerror="${test.failonerror}">
-      <arg value="org.apache.commons.logging.jdk14.CustomConfigFullTestCase"/>
-      <classpath refid="test.classpath.jdk14"/>
-      <syspropertyset refid="test-lib-props"/>
-    </java>
-
-    <echo message="Hierarchy Configuration FULL (JDK 1.4 LogFactoryImpl Selected)"/>
-    <java classname="${test.runner}" fork="yes" failonerror="${test.failonerror}">
-      <arg value="org.apache.commons.logging.jdk14.CustomConfigFullTestCase"/>
-      <classpath refid="test.classpath.jdk14"/>
-      <syspropertyset refid="test-lib-props"/>
-
-      <sysproperty key="org.apache.commons.logging.LogFactory"
-                 value="org.apache.commons.logging.impl.LogFactoryImpl"/>
-    </java>
-
-    <echo message="Hierarchy Configuration FULL (JDK 1.4 Jdk14Logger Selected)"/>
-    <java classname="${test.runner}" fork="yes" failonerror="${test.failonerror}">
-      <arg value="org.apache.commons.logging.jdk14.CustomConfigFullTestCase"/>
-      <classpath refid="test.classpath.jdk14"/>
-      <syspropertyset refid="test-lib-props"/>
-
-      <sysproperty key="org.apache.commons.logging.Log"
-                 value="org.apache.commons.logging.impl.Jdk14Logger"/>
-    </java>
-
-  </target>
-
-
   <target name="test.log4j" depends="compile.tests" if="log4j12.present"
    description="Run unit tests specific to Log4J logging">
 
@@ -887,85 +786,6 @@
                  value="org.apache.commons.logging.impl.Log4J12Logger"/>
     </java>
 
-  </target>
-
-
-  <target name="test.simple" depends="compile.tests"
-   description="Run unit tests specific to SimpleLog logging">
-
-    <echo message="Default Configuration (SimpleLog Selected)"/>
-    <java classname="${test.runner}" fork="yes" failonerror="${test.failonerror}">
-      <sysproperty key="org.apache.commons.logging.Log"
-                 value="org.apache.commons.logging.impl.SimpleLog"/>
-      <arg value="org.apache.commons.logging.simple.DefaultConfigTestCase"/>
-      <classpath refid="test.classpath"/>
-    </java>
-
-    <echo message="Custom Configuration (SimpleLog Selected)"/>
-    <java classname="${test.runner}" fork="yes" failonerror="${test.failonerror}">
-      <sysproperty key="org.apache.commons.logging.Log"
-                 value="org.apache.commons.logging.simple.DecoratedSimpleLog"/>
-      <sysproperty key="org.apache.commons.logging.simplelog.defaultlog"
-                 value="debug"/>
-      <arg value="org.apache.commons.logging.simple.CustomConfigTestCase"/>
-      <classpath refid="test.classpath"/>
-    </java>
-    
-    <echo message="Custom Configuration With DateTime (SimpleLog Selected)"/>
-    <java classname="${test.runner}" fork="yes" failonerror="${test.failonerror}">
-      <sysproperty key="org.apache.commons.logging.Log"
-                 value="org.apache.commons.logging.simple.DecoratedSimpleLog"/>
-      <sysproperty key="org.apache.commons.logging.simplelog.defaultlog"
-                 value="debug"/>
-      <sysproperty key="org.apache.commons.logging.simplelog.dateTimeFormat"
-                 value="dd.mm.yyyy"/>
-      <sysproperty key="org.apache.commons.logging.simplelog.showdatetime"
-                 value="true"/>                 
-      <arg value="org.apache.commons.logging.simple.DateTimeCustomConfigTestCase"/>
-      <classpath refid="test.classpath"/>
-    </java>
-    
-    <echo message="Basic Operations"/>
-    <java classname="${test.runner}" fork="yes" failonerror="${test.failonerror}">
-      <sysproperty key="org.apache.commons.logging.Log"
-                 value="org.apache.commons.logging.impl.SimpleLog"/>
-      <arg value="org.apache.commons.logging.BasicOperationsTest"/>
-      <classpath refid="test.classpath"/>
-    </java>
-
-  </target>
-
-
-  <target name="test.avalon" depends="compile.tests" if="avalon-framework.present"
-   description="Run unit tests specific to Avalon (Framework) logging">
-
-    <echo message="Avalon Tests"/>
-    <java classname="${test.runner}" fork="yes" failonerror="${test.failonerror}">
-      <arg value="org.apache.commons.logging.avalon.AvalonLoggerTest"/>
-      <classpath refid="test.classpath"/>
-    </java>
-    
-  </target>
-
-  <target name="test.alt-hashtable" depends="compile.tests"
-   description="Tests for hashtable substitution">
-
-    <echo message="Hashtable substitution Tests"/>
-    <java classname="${test.runner}" fork="yes" failonerror="${test.failonerror}">
-      <arg value="org.apache.commons.logging.AltHashtableTest"/>
-      <classpath refid="test.classpath"/>
-      <sysproperty key="org.apache.commons.logging.LogFactory.HashtableImpl"
-                 value="org.apache.commons.logging.AltHashtable"/>
-    </java>
-    
-    <echo message="Bad property test"/>
-    <java classname="${test.runner}" fork="yes" failonerror="${test.failonerror}">
-      <arg value="org.apache.commons.logging.BadHashtablePropertyTest"/>
-      <classpath refid="test.classpath"/>
-      <sysproperty key="org.apache.commons.logging.LogFactory.HashtableImpl"
-                 value="org.apache.commons.logging.bad.BogusHashTable"/>
-    </java>
-    
   </target>
 
 </project>



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org