You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by sj...@apache.org on 2008/10/30 16:01:42 UTC

svn commit: r709179 - in /harmony/enhanced/classlib/trunk/modules/archive: ./ make/ src/test/java-internal/ src/test/java-internal/org/ src/test/java-internal/org/apache/ src/test/java-internal/org/apache/harmony/ src/test/java-internal/org/apache/harm...

Author: sjanuary
Date: Thu Oct 30 08:01:41 2008
New Revision: 709179

URL: http://svn.apache.org/viewvc?rev=709179&view=rev
Log:
Fix failing archive tests to run on the bootclasspath

Added:
    harmony/enhanced/classlib/trunk/modules/archive/src/test/java-internal/
    harmony/enhanced/classlib/trunk/modules/archive/src/test/java-internal/org/
    harmony/enhanced/classlib/trunk/modules/archive/src/test/java-internal/org/apache/
    harmony/enhanced/classlib/trunk/modules/archive/src/test/java-internal/org/apache/harmony/
    harmony/enhanced/classlib/trunk/modules/archive/src/test/java-internal/org/apache/harmony/archive/
    harmony/enhanced/classlib/trunk/modules/archive/src/test/java-internal/org/apache/harmony/archive/util/
    harmony/enhanced/classlib/trunk/modules/archive/src/test/java-internal/org/apache/harmony/archive/util/UtilTest.java   (with props)
Removed:
    harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/util/
Modified:
    harmony/enhanced/classlib/trunk/modules/archive/.classpath
    harmony/enhanced/classlib/trunk/modules/archive/build.xml
    harmony/enhanced/classlib/trunk/modules/archive/make/hyproperties.xml

Modified: harmony/enhanced/classlib/trunk/modules/archive/.classpath
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/.classpath?rev=709179&r1=709178&r2=709179&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/.classpath (original)
+++ harmony/enhanced/classlib/trunk/modules/archive/.classpath Thu Oct 30 08:01:41 2008
@@ -3,6 +3,7 @@
 	<classpathentry output="bin/main" kind="src" path="src/main/java"/>
 	<classpathentry output="bin/main" kind="src" path="src/main/resources"/>
 	<classpathentry output="bin/test" kind="src" path="src/test/java"/>
+	<classpathentry output="bin/test-internal" kind="src" path="src/test/java-internal"/>
 	<classpathentry output="bin/test" kind="src" path="src/test/resources"/>	
 	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>

Modified: harmony/enhanced/classlib/trunk/modules/archive/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/build.xml?rev=709179&r1=709178&r2=709179&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/build.xml (original)
+++ harmony/enhanced/classlib/trunk/modules/archive/build.xml Thu Oct 30 08:01:41 2008
@@ -37,6 +37,8 @@
         </or>
     </fileset>
 
+    <property file="../../make/depends.properties" />
+
     <property name="zlib.zip" location="${depends.oss}/zlib_1.2.3.zip" />
 
     <property name="archive.exclude.file" location="${hy.hdk}/build/archive.exclude" />
@@ -241,10 +243,30 @@
     </target>
 
     <target name="compile-tests" depends="copy-test-resources">
-        <echo message="Compiling ARCHIVE tests" />
-
+        <mkdir dir="${hy.archive.bin.internal}" />
         <mkdir dir="${hy.archive.bin.test}" />
 
+        <echo message="Compiling internal ARCHIVE tests" />
+        <javac srcdir="${hy.archive.src.test.internal}"
+               destdir="${hy.archive.bin.internal}"
+               sourcepath=""
+               compiler="${hy.javac.compiler}"
+               memoryMaximumSize="${hy.javac.maxmem}"
+               source="${hy.javac.source}" 
+               target="${hy.javac.target}"
+               debug="${hy.javac.debug}">
+
+            <compilerarg line="${build.compilerarg}" />
+
+            <bootclasspath>
+                <fileset dir="${hy.jdk}/jre/lib/boot">
+                    <include name="**/*.jar" />
+                </fileset>
+            </bootclasspath>
+            <classpath location="${hy.hdk}/build/test/support.jar" />
+        </javac>
+
+        <echo message="Compiling ARCHIVE tests" />
         <javac srcdir="${hy.archive.src.test.java}"
                destdir="${hy.archive.bin.test}"
                sourcepath=""
@@ -276,6 +298,48 @@
 
         <property name="test.jre.home" value="${hy.jdk}/jre" />
 
+        <!-- internal tests that need to run on the bootclasspath -->
+        <echo message="Running internal ARCHIVE tests" />
+        <junit fork="yes"
+               forkmode="${hy.test.forkmode}"
+               timeout="${hy.test.timeout}"
+               printsummary="withOutAndErr"
+               errorproperty="test.errors"
+               failureproperty="test.failures"
+               showoutput="on"
+               dir="${basedir}"
+               jvm="${test.jre.home}/bin/java">
+
+            <assertions enableSystemAssertions="true">
+                <enable />
+            </assertions>
+
+            <jvmarg line="${hy.test.vmargs}" />
+
+            <jvmarg value="-Xbootclasspath/a:${hy.archive.bin.internal}${path.separator}../../${junit.jar}"/>         
+            
+            <classpath>
+                <pathelement path="${hy.archive.bin.test}"/>
+            </classpath>
+            <classpath location="../../build/tests" />
+			<classpath location="${hy.hdk}/build/test/support.jar" />
+
+            <formatter type="xml" />
+
+            <batchtest todir="${hy.tests.reports}" haltonfailure="no" >
+
+                <fileset dir="${hy.archive.src.test.internal}">
+                    <!-- if ${test.case}     -->
+                    <include name="${converted.tc}" if="test.case" />
+                    <!-- unless ${test.case} -->
+                    <include name="**/*Test.java" unless="test.case" />
+                    <excludesfile name="${archive.exclude.file}" unless="test.case" />
+                </fileset>
+            </batchtest>
+        </junit>
+        
+        <!-- API tests -->
+        <echo message="Running ARCHIVE tests" />
         <junit fork="yes"
                forkmode="${hy.test.forkmode}"
                timeout="${hy.test.timeout}"

Modified: harmony/enhanced/classlib/trunk/modules/archive/make/hyproperties.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/make/hyproperties.xml?rev=709179&r1=709178&r2=709179&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/make/hyproperties.xml (original)
+++ harmony/enhanced/classlib/trunk/modules/archive/make/hyproperties.xml Thu Oct 30 08:01:41 2008
@@ -27,12 +27,14 @@
          <test>
             <java location="src/test/java" />
             <resources location="src/test/resources" />
+            <internal location="src/test/java-internal" />
          </test>
          <natives location="src/natives" />
       </src>
       <bin>
         <main location="bin/main" />
         <test location="bin/test" />
+        <internal location="bin/test-internal" />
       </bin>
       <packaging>
       </packaging>

Added: harmony/enhanced/classlib/trunk/modules/archive/src/test/java-internal/org/apache/harmony/archive/util/UtilTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/test/java-internal/org/apache/harmony/archive/util/UtilTest.java?rev=709179&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/test/java-internal/org/apache/harmony/archive/util/UtilTest.java (added)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/test/java-internal/org/apache/harmony/archive/util/UtilTest.java Thu Oct 30 08:01:41 2008
@@ -0,0 +1,87 @@
+/*
+ *  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.
+ */
+
+package org.apache.harmony.archive.util;
+
+import junit.framework.TestCase;
+
+public class UtilTest extends TestCase {
+    private static final String ASCII_ALPHABET_LC = "abcdefghijklmnopqrstuvwxyz";
+    private static final String ASCII_ALPHABET_UC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+    private static final byte[] ASCII_ALPHABET_LC_BYTES;
+    private static final byte[] ASCII_ALPHABET_UC_BYTES;
+
+    static {
+        ASCII_ALPHABET_LC_BYTES = new byte[ASCII_ALPHABET_LC.length()];
+        for (int i = 0; i < ASCII_ALPHABET_LC_BYTES.length; i++) {
+            final char c = ASCII_ALPHABET_LC.charAt(i);
+            final byte b = (byte) c;
+            assert ((char) b) == c;
+            ASCII_ALPHABET_LC_BYTES[i] = b;
+        }
+
+        ASCII_ALPHABET_UC_BYTES = new byte[ASCII_ALPHABET_UC.length()];
+        for (int i = 0; i < ASCII_ALPHABET_UC_BYTES.length; i++) {
+            final char c = ASCII_ALPHABET_UC.charAt(i);
+            final byte b = (byte) c;
+            assert ((char) b) == c;
+            ASCII_ALPHABET_UC_BYTES[i] = b;
+        }
+    }
+
+    public void testASCIIIgnoreCaseRegionMatches() {
+        final String s1 = ASCII_ALPHABET_LC;
+        final String s2 = ASCII_ALPHABET_UC;
+        for (int i = 0; i < s1.length(); i++) {
+            assertTrue(Util.ASCIIIgnoreCaseRegionMatches(s1, i, s2, i, s1
+                    .length()
+                    - i));
+        }
+    }
+
+    public void testToASCIIUpperCaseByte() {
+        for (int i = 0; i < ASCII_ALPHABET_LC_BYTES.length; i++) {
+            assertEquals(ASCII_ALPHABET_UC_BYTES[i], Util
+                    .toASCIIUpperCase(ASCII_ALPHABET_LC_BYTES[i]));
+        }
+        for (int i = 0; i < ASCII_ALPHABET_UC_BYTES.length; i++) {
+            assertEquals(ASCII_ALPHABET_UC_BYTES[i], Util
+                    .toASCIIUpperCase(ASCII_ALPHABET_UC_BYTES[i]));
+        }
+    }
+
+    public void testToASCIIUpperCaseChar() {
+        for (int i = 0; i < ASCII_ALPHABET_LC.length(); i++) {
+            assertEquals(ASCII_ALPHABET_UC.charAt(i), Util
+                    .toASCIIUpperCase(ASCII_ALPHABET_LC.charAt(i)));
+        }
+        for (int i = 0; i < ASCII_ALPHABET_UC.length(); i++) {
+            assertEquals(ASCII_ALPHABET_UC.charAt(i), Util
+                    .toASCIIUpperCase(ASCII_ALPHABET_UC.charAt(i)));
+        }
+    }
+
+    public void testEqualsIgnoreCaseByteArrayByteArray() {
+        assertTrue(Util.equalsIgnoreCase(ASCII_ALPHABET_LC_BYTES,
+                ASCII_ALPHABET_LC_BYTES));
+        assertTrue(Util.equalsIgnoreCase(ASCII_ALPHABET_LC_BYTES,
+                ASCII_ALPHABET_UC_BYTES));
+        assertTrue(Util.equalsIgnoreCase(ASCII_ALPHABET_UC_BYTES,
+                ASCII_ALPHABET_UC_BYTES));
+    }
+
+}

Propchange: harmony/enhanced/classlib/trunk/modules/archive/src/test/java-internal/org/apache/harmony/archive/util/UtilTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: harmony/enhanced/classlib/trunk/modules/archive/src/test/java-internal/org/apache/harmony/archive/util/UtilTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain