Platform specific notes for Derby's JUnit tests

Mac , Oracle and HP JVM's MaxPermSize

On Mac, Oracle and HP JVM's it is necessary to set -XX:MaxPermSize=512m (or possibly as low as 128m in some contexts) in order for the upgrade tests to complete. This option increases the class loading space so that the upgrade tests can load the various versions. It may be that this is a bug with upgrade tests or even Derby that class loaders are leaking DERBY-4740. The IBM JVM's do not have a separate option for the class definition loading. It is combined with the heap so this option is not needed.

IBM WEME 6.1 and 6.2 Foundation (windows with -jcl:foun11)

newer versions of WCTME 5.7.

A bug exists where if a system property is used in a security policy file but not set the parsing of the policy file fails with found unexpected: permission. The work-around is to set the properties to dummy values on the command line using -D.

These properties need to be set on the command line:

Property

Value

derbyTesting.serverhost

host (fixed value will be ignored)

derbyTesting.clienthost

host (fixed value will be ignored)

emma.active

"" (empty string) (on trunk since ~ revision 632125 for DERBY-3445)

jacoco.active

"" (empty string) (on trunk since ~ revision 1447388 for DERBY-6067)

IBM WCTME 5.7 Foundation (windows with -jcl:foun10)

<!> Requires the 3.8.1 version of junit.jar. The 3.8.2 version introduces a dependency on methods not in J2ME/CDC/Foundation 1.0.

See DERBY-1785

A bug in the WCTME 5.7 JVM stops running the JUnit tests as the security manager does not pick up the policy file unless the java.security.policy property is set on the command line (using -D). This can be worked around by setting a number of properties on the command line when running WCTME 5.7.

These properties are for when the tests are being run against the classes folder. Investigation is needed for the correct set to run with jar files.

Property

Value

derbyTesting.serverhost

host (fixed value will be ignored)

derbyTesting.clienthost

host (fixed value will be ignored)

derbyTesting.codeclasses

URL to classes folder

java.security.policy

URL to derby_tests.policy in the classes folder

derby.system.home

Full path to the system folder in the current folder ($PWD/system). The system folder need not exist, it will be created by Derby.

Example

/cygdrive/c/_work/wctme5.7/ive/bin/j9 -jcl:foun10
   '-Dderby.system.home=c:\_work\derby\trunk\systest\out7\system'
   -DderbyTesting.serverhost=host -DderbyTesting.clienthost=host
   -DderbyTesting.codeclasses=file:/C:/_work/derby/trunk/classes/
   -Djava.security.policy=file:/C:/_work/derby/trunk/classes/org/apache/derbyTesting/functionTests/util/derby_tests.policy
   '-Xbootclasspath/a:c:\_work\wctme5.7\ive\lib\jdbc.jar'
   -cp 'c:\_work\derby\trunk\classes;c:\_work\derby\trunk\tools\java\junit.jar'
   junit.textui.TestRunner org.apache.derbyTesting.functionTests.suites.All

IBM WCTME 5.7 Foundation (windows with -jcl:foun10) Alternative method

<!> Requires the 3.8.1 version of junit.jar. The 3.8.2 version introduces a dependency on methods not in J2ME/CDC/Foundation 1.0.

The tests can be run with a security manager with a simple policy file that avoids the issues seen when running with the standard policy file for the function tests. The simple policy file looks like:

grant codebase "file:/c:/_work/-" {
  permission java.security.AllPermission;
};
grant {
  permission java.util.PropertyPermission "derbyRoutineSecurityTest.yes", "read";
};

The code base for the grant can be a URL to any folder that is above the classes or jar files used in the test. Note it must be terminated with /-.

Here is an example command line, assuming that the policy file is in the current folder and called simple.policy.

/cygdrive/c/_work/wctme5.7/ive/bin/j9 -jcl:foun10
   -Djava.security.manager=
   -Djava.security.policy=simple.policy
   '-Xbootclasspath/a:c:\_work\wctme5.7\ive\lib\jdbc.jar'
   -cp 'c:\derby\lib\derbyTesting.jar;c:\_work\derby\lib\derby.jar;c:\_work\junit.jar'
   junit.textui.TestRunner org.apache.derbyTesting.functionTests.suites.All

IBM z/OS Unix

To avoid spawned processes sharing an address space with the parent process and running out of memory, set the following in your local shell, /etc/profile, or $HOME/.profile. (see DERBY-4173)

export _BPX_SHAREAS="NO" 

If you have installed the jdk yourself, you may see a warning: JVMJ9VM082E Unable to switch to IFA processor - issue "extattr +a libj9ifa24.so", which will cause the canon based tests to fail. You can suppress this warning with:

export IBM_JAVA_OPTIONS="-Xifa:off"

For JDK 1.5 on z/OS, the default heap size appears to be 71MB. Run JUnit tests with -Xmx512M to ensure there is enough heap to run the tests.

Java 1.4.2, 1.5 and 1.6: unlimited cryptography policies

By default, in Java run-times, due to import control restrictions, the version of JCE policy files that are bundled in the JDK(TM) 6 environment, allow "strong", but limited cryptography to be used. Some Derby tests, as of writing, only "EncryptionAESTest", will skip some test cases unless the unlimited cryptography policy files have been installed. To determine whether your JRE have the limited policy files, you can run that test in this way:

     java -Dderby.tests.trace=true  junit.textui.TestRunner org.apache.derbyTesting.functionTests.tests.store.EncryptionAESTest

If you see something like this:

    :
    testEncryptionKeyLengths no unrestricted policy jars; cannot test AES encryption with encryptionKeyLengths 192 nor 256
    no unrestricted policy jars; cannot test AES encryption with encryptionKeyLengths 192 nor 256

then you lack the unlimited policy files. You can download and install these files if you are in territories where there are no restrictions. For Sun JVMS you can do this by heading to the following URL and follow the instructions in the bundle (this link currently gives Java 1.6 version; you can also find such bundles for Java 1.4.2 and Java 1.5 if you want to run tests with those versions):

http://java.sun.com/javase/downloads/index.jsp

Once there, click the "Download" button in the section labelled: "Other Downloads Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 6".

For other jvms, please contact your vendor.

JunitVmIssues (last edited 2013-02-21 22:14:11 by MyrnavanLunteren)