Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 85500 invoked from network); 21 Jan 2011 19:59:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 21 Jan 2011 19:59:50 -0000 Received: (qmail 35108 invoked by uid 500); 21 Jan 2011 19:59:50 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 35039 invoked by uid 500); 21 Jan 2011 19:59:50 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 35032 invoked by uid 99); 21 Jan 2011 19:59:50 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Jan 2011 19:59:50 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Jan 2011 19:59:49 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 8C42923888DD; Fri, 21 Jan 2011 19:59:29 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1061988 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting: functionTests/tests/store/InterruptResilienceTest.java junit/BaseTestCase.java Date: Fri, 21 Jan 2011 19:59:29 -0000 To: derby-commits@db.apache.org From: dag@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110121195929.8C42923888DD@eris.apache.org> Author: dag Date: Fri Jan 21 19:59:29 2011 New Revision: 1061988 URL: http://svn.apache.org/viewvc?rev=1061988&view=rev Log: DERBY-4974 InterruptResilienceTest fails on Solaris with Sun VMs prior to 1.6 Patch DERBY-4974, which: a) skips the tests in InterruptResilienceTest if running with interruptible IO on Solaris b) improves the check for interruptible IO to work even if system/derby.log doesn't yet exist (which would be the case if the test is run stand-alone). Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/InterruptResilienceTest.java db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/InterruptResilienceTest.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/InterruptResilienceTest.java?rev=1061988&r1=1061987&r2=1061988&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/InterruptResilienceTest.java (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/InterruptResilienceTest.java Fri Jan 21 19:59:29 2011 @@ -74,6 +74,13 @@ public class InterruptResilienceTest ext return suite; } + if (hasInterruptibleIO()) { + println("Test skipped due to interruptible IO."); + println("This is default on Solaris/Sun Java <= 1.6, use " + + "-XX:-UseVMInterruptibleIO if available."); + return suite; + } + suite.addTest( baseSuite("InterruptResilienceTest:embedded")); Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java?rev=1061988&r1=1061987&r2=1061988&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java Fri Jan 21 19:59:29 2011 @@ -601,9 +601,7 @@ public abstract class BaseTestCase * * @return true if we have old style interruptible IO */ - public static final boolean hasInterruptibleIO() - throws Exception { - + public static final boolean hasInterruptibleIO() { boolean interruptibleIO = false; @@ -617,14 +615,20 @@ public abstract class BaseTestCase String sysHome = getSystemProperty("derby.system.home"); - StringBuffer arbitraryRAFFileName = new StringBuffer(); + StringBuffer arbitraryRAFFileNameB = new StringBuffer(); - arbitraryRAFFileName.append(sysHome); - arbitraryRAFFileName.append(File.separatorChar); - arbitraryRAFFileName.append("derby.log"); + arbitraryRAFFileNameB.append(sysHome); + arbitraryRAFFileNameB.append(File.separatorChar); + arbitraryRAFFileNameB.append("derby.log"); + + String arbitraryRAFFileName = + arbitraryRAFFileNameB.toString(); + // Create if it does not exist: + new File(sysHome).mkdirs(); // e.g. "system" + new File(arbitraryRAFFileName).createNewFile(); RandomAccessFile f = new RandomAccessFile( - arbitraryRAFFileName.toString(), "r"); + arbitraryRAFFileName, "r"); try { Thread.currentThread().interrupt(); @@ -640,9 +644,14 @@ public abstract class BaseTestCase if (e.getCause() instanceof InterruptedIOException) { interruptibleIO = true; } else { - throw e; + // Better to assume nothing when the test fails. Then, tests + // will not be skipped and we would not miss that something is + // amiss. + println("Could not test for interruptible IO," + + " so assuming we don't have it: " + e); + e.getCause().printStackTrace(); + return false; } - } return interruptibleIO;