Bug#615863: c3p0: Test suite enablement/tuning of gcj javac warning output
James Page
james.page at canonical.com
Mon Feb 28 14:06:14 UTC 2011
Package: c3p0
Version: 0.9.1.2-5
Severity: normal
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu natty ubuntu-patch
*** /tmp/tmpdkx862
In Ubuntu, the attached patch was applied to achieve the following:
1) Tuning of gcj javac warning to be like openjdk javac.
The source code for c3p0 is not Java 1.6 compatible so we can't use OpenJDK6
for compilation; gcj is used instead which is very verbose with warnings.
The first part of this patch makes gcj behave more like openjdk with regards
to generation of warning messages during the build process.
2) Unit Test suite enablement
Uses the Java based hsqldb database against a temporary file based database;
one test failed due to a missing feature in the driver (test disabled) and
another failed becauce gcj is quite good at dealing with weak object
references (also disabled).
* Patched ant build files to make gcj behave more like openjdk (LP: #452926).
* Enabled junit test suite for operation using gcj and hsqldb (LP: #452919).
* Updated Standards-Version: 3.9.1, no changes.
Thanks for considering the patch.
-- System Information:
Debian Release: squeeze/sid
APT prefers natty-updates
APT policy: (500, 'natty-updates'), (500, 'natty-security'), (500, 'natty')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.35-25-generic (SMP w/8 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash
-------------- next part --------------
=== modified file 'debian/ant.properties'
--- debian/ant.properties 2007-07-10 23:27:20 +0000
+++ debian/ant.properties 2011-02-28 14:02:20 +0000
@@ -1,4 +1,4 @@
-# >> BASICS <<
+
#
# You'll need to supply at least one of j2ee.classpath
@@ -55,17 +55,22 @@
# the various tests. very optional
#
-#test.jdbc.driver.jar.file=
-#test.jdbc.drivers=
-#test.jdbc.url=
-#test.jdbc.user=
-#test.jdbc.password=
+test.jdbc.driver.jar.file=/usr/share/java/hsqldb.jar
+test.jdbc.drivers=org.hsqldb.jdbcDriver
+test.jdbc.url=jdbc:hsqldb:file:/tmp/testdb
+test.jdbc.user=SA
+test.jdbc.password=
+
+c3p0.jdbcUrl=jdbc:hsqldb:file:/tmp/testdb
+c3p0.driverClass=org.hsqldb.jdbcDriver
+c3p0.user=SA
+c3p0.password=
#
# required if you want to run junit tests
#
-#junit.jar.file
+junit.jar.file=/usr/share/java/junit.jar
# >> VERY VERY OPTIONAL DOCS-TO-WEB SUPPORT
=== modified file 'debian/changelog'
=== modified file 'debian/control'
--- debian/control 2010-05-21 22:56:13 +0000
+++ debian/control 2011-02-28 14:02:36 +0000
@@ -4,8 +4,9 @@
Maintainer: Debian Java Maintainers <pkg-java-maintainers at lists.alioth.debian.org>
Uploaders: Michael Koch <konqueror at gmx.de>, Varun Hiremath <varun at debian.org>
Build-Depends: debhelper (>= 7), cdbs, maven-repo-helper
-Build-Depends-Indep: ant, gcj-jdk, liblog4j1.2-java, libmx4j-java
-Standards-Version: 3.8.4
+Build-Depends-Indep: ant, gcj-jdk, liblog4j1.2-java, libmx4j-java, ant-optional,
+ junit, libhsqldb-java
+Standards-Version: 3.9.1
Vcs-Svn: svn://svn.debian.org/svn/pkg-java/trunk/c3p0
Vcs-Browser: http://svn.debian.org/wsvn/pkg-java/trunk/c3p0
Homepage: http://sourceforge.net/projects/c3p0
=== added directory 'debian/patches'
=== added file 'debian/patches/build.patch'
--- debian/patches/build.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/build.patch 2011-02-28 14:02:20 +0000
@@ -0,0 +1,66 @@
+Description: Configures build (using gcj) to behave more like sun-jdk-5
+ in terms of error messages.
+Author: james.page at canonical.com
+Forwarded: not-required
+Index: c3p0/build.xml
+===================================================================
+--- c3p0.orig/build.xml 2011-02-25 11:52:44.775376257 +0000
++++ c3p0/build.xml 2011-02-25 12:02:54.804996643 +0000
+@@ -208,7 +208,7 @@
+ source="${c3p0.target.version}"
+ target="${c3p0.target.version}"
+ classpathref="codegen-classpath"
+- debug="true">
++ debug="true" nowarn="on" deprecation="off">
+ <src>
+ <pathelement location="${build.codegen.dir}" />
+ <pathelement location="${java.src.dir}" />
+@@ -253,7 +253,7 @@
+ source="${c3p0.target.version}"
+ target="${c3p0.target.version}"
+ classpathref="build-classpath"
+- debug="on">
++ debug="on" nowarn="on" deprecation="off">
+ <sourcepath>
+ <pathelement location="${build.codegen.dir}" />
+ <pathelement location="${java.src.dir}" />
+@@ -275,7 +275,7 @@
+ source="${c3p0.target.version}"
+ target="${c3p0.target.version}"
+ classpathref="build-classpath"
+- debug="on">
++ debug="on" nowarn="on" deprecation="off">
+ <sourcepath>
+ <pathelement location="${build.codegen.dir}" />
+ </sourcepath>
+@@ -290,7 +290,7 @@
+ <javac destdir="${build.classes.dir}"
+ source="${c3p0.target.version}"
+ target="${c3p0.target.version}"
+- debug="on">
++ debug="on" nowarn="on" deprecation="off">
+ <classpath>
+ <path refid="build-classpath" />
+ <pathelement location="${log4j.jar.file}" />
+@@ -311,7 +311,7 @@
+ <javac destdir="${build.classes.dir}"
+ source="${c3p0.target.version}"
+ target="${c3p0.target.version}"
+- debug="on">
++ debug="on" nowarn="on" deprecation="off">
+ <classpath>
+ <path refid="build-classpath" />
+ <pathelement path="${junit.jar.file}" />
+Index: c3p0/relproj/debuggen/build.xml
+===================================================================
+--- c3p0.orig/relproj/debuggen/build.xml 2011-02-25 12:04:02.992661915 +0000
++++ c3p0/relproj/debuggen/build.xml 2011-02-25 12:04:30.047767796 +0000
+@@ -32,7 +32,7 @@
+ <mkdir dir="${build.classes.dir}" />
+ <javac srcdir="${java.src.dir}"
+ destdir="${build.classes.dir}"
+- debug="on" />
++ debug="on" nowarn="on" deprecation="off"/>
+ </target>
+
+ <target name="jar" depends="compile">
=== added file 'debian/patches/series'
--- debian/patches/series 1970-01-01 00:00:00 +0000
+++ debian/patches/series 2011-02-28 14:02:20 +0000
@@ -0,0 +1,2 @@
+build.patch
+testing.patch
=== added file 'debian/patches/testing.patch'
--- debian/patches/testing.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/testing.patch 2011-02-28 14:02:20 +0000
@@ -0,0 +1,73 @@
+Description: Patch to enable testing in build process using hsqldb & gcj
+ Functions that are either not supported by hsqldb and tests that behave
+ differently under gcj are disabled.
+Author: james.page at canonical.com
+Forwarded: not-required
+Index: c3p0/src/classes/com/mchange/v2/c3p0/test/junit/ConnectionPropertiesResetJUnitTestCase.java
+===================================================================
+--- c3p0.orig/src/classes/com/mchange/v2/c3p0/test/junit/ConnectionPropertiesResetJUnitTestCase.java 2011-02-28 11:20:48.137932772 +0000
++++ c3p0/src/classes/com/mchange/v2/c3p0/test/junit/ConnectionPropertiesResetJUnitTestCase.java 2011-02-28 11:23:12.471753607 +0000
+@@ -88,10 +88,6 @@
+ cons[i] = cpds.getConnection();
+ assertFalse( "Connection from pool should not be readOnly!", cons[i].isReadOnly() );
+
+- // some drivers return null rather than an empty type map
+- Map typeMap = cons[i].getTypeMap();
+- assertTrue( "Connection from pool should have an empty type map!", (typeMap == null ? true : typeMap.isEmpty() ) );
+-
+ assertEquals( "Connection from pool should have default catalog set!", dfltCat, cons[i].getCatalog() );
+ assertEquals( "Connection from pool should have default txn isolation set!", dflt_txn_isolation, cons[i].getTransactionIsolation() );
+ cons[i].close();
+@@ -103,4 +99,4 @@
+ fail( e.getMessage() );
+ }
+ }
+-}
+\ No newline at end of file
++}
+Index: c3p0/src/classes/com/mchange/v2/util/junit/DoubleWeakHashMapJUnitTestCase.java
+===================================================================
+--- c3p0.orig/src/classes/com/mchange/v2/util/junit/DoubleWeakHashMapJUnitTestCase.java 2011-02-28 11:20:48.167927333 +0000
++++ c3p0/src/classes/com/mchange/v2/util/junit/DoubleWeakHashMapJUnitTestCase.java 2011-02-28 11:22:55.204885364 +0000
+@@ -68,41 +68,4 @@
+ m.values().remove(poop);
+ assertEquals("After removing a doubled value, size should be 2", m.size(), 2);
+ }
+-
+- public void testWeakness()
+- {
+- Integer a = new Integer(1);
+- Integer b = new Integer(2);
+- Integer c = new Integer(3);
+-
+- String poop = new String("poop");
+-
+- Map m = new DoubleWeakHashMap();
+- m.put(a, poop);
+- m.put(b, new Object());
+- m.put(c, new Object());
+-
+- //race condition... b & c might already have been removed... but i doubt it
+- assertEquals("1) Weak values should not yet have been removed (but not guaranteed! sometimes fails without a defect!)", m.size(), 3);
+-
+- // we are relying that a full, synchronous GC occurs,
+- // which is not guaranteed in all VMs
+- System.gc();
+-
+- // let's see if we can force a deeper gc via a big array creation
+- byte[] bArray = new byte[1024 * 1024];
+-
+- assertEquals("2) Weak values should have been automatically removed (but not guaranteed! sometimes fails without a defect!)", m.size(), 1);
+-
+- m.put( new Object(), b);
+-
+- //race condition... b & c might already have been removed... but i doubt it
+- assertEquals("3) Weak key should not yet have been removed (but not guaranteed! sometimes fails without a defect!)", m.size(), 2);
+-
+- System.gc();
+- // let's see if we can force a deeper gc via a big array creation
+- bArray = new byte[1024 * 1024];
+-
+- assertEquals("4) Weak key should have been automatically removed (but not guaranteed! sometimes fails without a defect!)", m.size(), 1);
+- }
+ }
=== modified file 'debian/rules'
--- debian/rules 2010-05-21 22:56:13 +0000
+++ debian/rules 2011-02-28 14:02:20 +0000
@@ -6,8 +6,8 @@
JAVA_HOME := /usr/lib/jvm/java-gcj
ANT_HOME := /usr/share/ant
-DEB_JARS := log4j1.2 mx4j
-DEB_ANT_BUILD_TARGET := jar javadocs
+DEB_JARS := log4j1.2 mx4j junit ant-junit hsql
+DEB_ANT_BUILD_TARGET := jar javadocs junit-tests
clean::
( cd relproj ; ant clean )
More information about the pkg-java-maintainers
mailing list