RFR(S): 8165689: Fix module dependencies for sun/security/pkcs11/* tests

Sergei Kovalev sergei.kovalev at oracle.com
Wed Sep 14 15:26:07 UTC 2016


Hi Sean,

I'm working for testing minimal JRE image. If I create custom JRE with 
java.base only - the tests fail. To emulate such behavior we can use 
"--limit-modules java.base" option. In case if we have no module 
declaration in tests header the test fails with, e.g. ClassNotFound 
exception (see example in attached log). In case we declare appropriate 
modules in jtreg header then jtreg suite skip the test and mark it "not 
run" in final report. This help me to clean out all "false positive" 
error during testing and reduce time that I spend to failures analysis.


14.09.16 18:20, Sean Mullan wrote:
> Looks fine to me, but can you explain in more detail why the extra 
> dependencies are needed, or an example using --limit-modules? These 
> tests are not failing regularly now, so when do the missing 
> dependencies cause failures?
>
> Thanks,
> Sean
>
> On 09/13/2016 08:34 AM, Sergei Kovalev wrote:
>> Hello team,
>>
>> This is re-request for review of very small changes. Could somebody take
>> a look?
>>
>>
>> 08.09.16 17:03, Sergei Kovalev wrote:
>>> Hello team,
>>>
>>> Could you please review the fix for below CR:
>>>
>>> Bug ID: https://bugs.openjdk.java.net/browse/JDK-8165689
>>> WebRev: http://cr.openjdk.java.net/~skovalev/8165689/webrev.00/
>>>
>>> Goal: make test possible to run with "--limit-modules" flag.
>>> Summary: added @modules tag into jtreg header if applicable.
>>>
>>

-- 
With best regards,
Sergei

-------------- next part --------------
#Test Results (version 2)
#Fri Sep 09 04:42:50 MSK 2016
#-----testdescription-----
$file=/var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/sun/security/pkcs11/Cipher/ReinitCipher.java
$root=/var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test
author=Andreas Sterbenz
keywords=bug4856966 randomness othervm
library=..
run=USER_SPECIFIED main/othervm ReinitCipher\nUSER_SPECIFIED main/othervm ReinitCipher sm\n
source=ReinitCipher.java
title=

#-----environment-----

#-----testresult-----
description=file\:/var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/sun/security/pkcs11/Cipher/ReinitCipher.java
elapsed=1878 0\:00\:01.878
end=Fri Sep 09 04\:42\:50 MSK 2016
environment=regtest
execStatus=Failed. Execution failed\: `main' threw exception\: java.security.NoSuchProviderException\: No PKCS11 provider available
harnessLoaderMode=Classpath Loader
harnessVariety=Full Bundle
hostname=slowpoke.ru.oracle.com
javatestOS=Linux 3.2.0-38-generic (amd64)
javatestVersion=4.6
jtregVersion=jtreg 4.2 fcs b03
script=com.sun.javatest.regtest.RegressionScript
sections=script_messages build compile main
start=Fri Sep 09 04\:42\:48 MSK 2016
test=sun/security/pkcs11/Cipher/ReinitCipher.java
testJDK=/var/www/hudson/ws/workspace/MinimalDepsRun/jake/build/linux-x64/images/jdk
totalTime=1882
user.name=hudson
work=/var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/JTwork-sun-security-pkcs11-Cipher-ReinitCipher-java_0/sun/security/pkcs11/Cipher

#section:script_messages
----------messages:(8/585)----------
JDK under test: /var/www/hudson/ws/workspace/MinimalDepsRun/jake/build/linux-x64/images/jdk
java version "9-internal"
Java(TM) SE Runtime Environment (build 9-internal+0-2016-09-08-021245.hudson.jake)
Java HotSpot(TM) 64-Bit Server VM (build 9-internal+0-2016-09-08-021245.hudson.jake, mixed mode)

Library ..; kind: packages
   source directory: /var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/sun/security/pkcs11
   class directory: /var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/JTwork-sun-security-pkcs11-Cipher-ReinitCipher-java_0/classes/sun/security/pkcs11

#section:build
----------messages:(5/137)----------
command: build ReinitCipher
reason: Named class compiled on demand
Test directory:
  compile: ReinitCipher
elapsed time (seconds): 1.299
result: Passed. Build successful

#section:compile
----------messages:(4/214)----------
command: compile /var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/sun/security/pkcs11/Cipher/ReinitCipher.java
reason: .class file out of date or does not exist
Mode: othervm
elapsed time (seconds): 1.291
----------configuration:(6/485)----------
javac compilation environment
  limit modules: java.base 
  class path:    /var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/sun/security/pkcs11/Cipher 
                 /var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/JTwork-sun-security-pkcs11-Cipher-ReinitCipher-java_0/classes/sun/security/pkcs11/Cipher 
                 /var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/JTwork-sun-security-pkcs11-Cipher-ReinitCipher-java_0/classes/sun/security/pkcs11 

----------rerun:(20/2314)*----------
HOME=/var/lib/hudson \\
JTREG_HOME=/var/www/hudson/ws/workspace/MinimalDepsRun/jtreg \\
LANG=en_US.UTF-8 \\
PATH=/bin:/usr/bin \\
    /var/www/hudson/ws/workspace/MinimalDepsRun/jake/build/linux-x64/images/jdk/bin/javac \\
        -J-Dtest.src=/var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/sun/security/pkcs11/Cipher \\
        -J-Dtest.src.path=/var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/sun/security/pkcs11/Cipher:/var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/sun/security/pkcs11 \\
        -J-Dtest.classes=/var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/JTwork-sun-security-pkcs11-Cipher-ReinitCipher-java_0/classes/sun/security/pkcs11/Cipher \\
        -J-Dtest.class.path=/var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/JTwork-sun-security-pkcs11-Cipher-ReinitCipher-java_0/classes/sun/security/pkcs11/Cipher:/var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/JTwork-sun-security-pkcs11-Cipher-ReinitCipher-java_0/classes/sun/security/pkcs11 \\
        -J-Dtest.vm.opts= \\
        -J-Dtest.tool.vm.opts= \\
        -J-Dtest.compiler.opts='-limitmods java.base' \\
        -J-Dtest.java.opts='-limitmods java.base' \\
        -J-Dtest.jdk=/var/www/hudson/ws/workspace/MinimalDepsRun/jake/build/linux-x64/images/jdk \\
        -J-Dcompile.jdk=/var/www/hudson/ws/workspace/MinimalDepsRun/jake/build/linux-x64/images/jdk \\
        -J-Dtest.timeout.factor=1.0 \\
        --limit-modules java.base \\
        -d /var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/JTwork-sun-security-pkcs11-Cipher-ReinitCipher-java_0/classes/sun/security/pkcs11/Cipher \\
        --source-path /var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/sun/security/pkcs11/Cipher:/var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/sun/security/pkcs11 \\
        --class-path /var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/sun/security/pkcs11/Cipher:/var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/JTwork-sun-security-pkcs11-Cipher-ReinitCipher-java_0/classes/sun/security/pkcs11/Cipher:/var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/JTwork-sun-security-pkcs11-Cipher-ReinitCipher-java_0/classes/sun/security/pkcs11 /var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/sun/security/pkcs11/Cipher/ReinitCipher.java
----------System.out:(0/0)----------
----------System.err:(4/377)----------
Note: /var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/sun/security/pkcs11/PKCS11Test.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/sun/security/pkcs11/PKCS11Test.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
result: Passed. Compilation successful

#section:main
----------messages:(4/154)----------
command: main ReinitCipher
reason: User specified action: run main/othervm ReinitCipher 
Mode: othervm [/othervm specified]
elapsed time (seconds): 0.444
----------configuration:(3/40)----------
Boot Layer
  limit modules: java.base 

----------System.out:(2/75)----------
libsoftokn3 version = 3.21.  ECC Basic.
Beginning test run ReinitCipher...
----------System.err:(29/2120)----------
java.lang.ClassNotFoundException: sun.security.pkcs11.SunPKCS11
	at jdk.internal.loader.BuiltinClassLoader.loadClass(java.base at 9-internal/BuiltinClassLoader.java:481)
	at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(java.base at 9-internal/ClassLoaders.java:185)
	at java.lang.ClassLoader.loadClass(java.base at 9-internal/ClassLoader.java:419)
	at java.lang.Class.forName0(java.base at 9-internal/Native Method)
	at java.lang.Class.forName(java.base at 9-internal/Class.java:291)
	at PKCS11Test.<clinit>(PKCS11Test.java:124)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(java.base at 9-internal/Native Method)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(java.base at 9-internal/NativeMethodAccessorImpl.java:62)
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base at 9-internal/DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(java.base at 9-internal/Method.java:535)
	at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:110)
	at java.lang.Thread.run(java.base at 9-internal/Thread.java:843)
java.security.NoSuchProviderException: No PKCS11 provider available
	at PKCS11Test.getSunPKCS11(PKCS11Test.java:149)
	at PKCS11Test.testNSS(PKCS11Test.java:518)
	at PKCS11Test.main(PKCS11Test.java:203)
	at ReinitCipher.main(ReinitCipher.java:43)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(java.base at 9-internal/Native Method)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(java.base at 9-internal/NativeMethodAccessorImpl.java:62)
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base at 9-internal/DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(java.base at 9-internal/Method.java:535)
	at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:110)
	at java.lang.Thread.run(java.base at 9-internal/Thread.java:843)

JavaTest Message: Test threw exception: java.security.NoSuchProviderException: No PKCS11 provider available
JavaTest Message: shutting down test

STATUS:Failed.`main' threw exception: java.security.NoSuchProviderException: No PKCS11 provider available
----------rerun:(19/2256)*----------
HOME=/var/lib/hudson \\
JTREG_HOME=/var/www/hudson/ws/workspace/MinimalDepsRun/jtreg \\
LANG=en_US.UTF-8 \\
PATH=/bin:/usr/bin \\
CLASSPATH=/var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/JTwork-sun-security-pkcs11-Cipher-ReinitCipher-java_0/classes/sun/security/pkcs11/Cipher:/var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/sun/security/pkcs11/Cipher:/var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/JTwork-sun-security-pkcs11-Cipher-ReinitCipher-java_0/classes/sun/security/pkcs11:/var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/sun/security/pkcs11:/var/www/hudson/ws/workspace/MinimalDepsRun/jtreg/lib/javatest.jar:/var/www/hudson/ws/workspace/MinimalDepsRun/jtreg/lib/jtreg.jar \\
    /var/www/hudson/ws/workspace/MinimalDepsRun/jake/build/linux-x64/images/jdk/bin/java \\
        -Dtest.src=/var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/sun/security/pkcs11/Cipher \\
        -Dtest.src.path=/var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/sun/security/pkcs11/Cipher:/var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/sun/security/pkcs11 \\
        -Dtest.classes=/var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/JTwork-sun-security-pkcs11-Cipher-ReinitCipher-java_0/classes/sun/security/pkcs11/Cipher \\
        -Dtest.class.path=/var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/JTwork-sun-security-pkcs11-Cipher-ReinitCipher-java_0/classes/sun/security/pkcs11/Cipher:/var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/JTwork-sun-security-pkcs11-Cipher-ReinitCipher-java_0/classes/sun/security/pkcs11 \\
        -Dtest.vm.opts= \\
        -Dtest.tool.vm.opts= \\
        -Dtest.compiler.opts='-limitmods java.base' \\
        -Dtest.java.opts='-limitmods java.base' \\
        -Dtest.jdk=/var/www/hudson/ws/workspace/MinimalDepsRun/jake/build/linux-x64/images/jdk \\
        -Dcompile.jdk=/var/www/hudson/ws/workspace/MinimalDepsRun/jake/build/linux-x64/images/jdk \\
        -Dtest.timeout.factor=1.0 \\
        --limit-modules java.base \\
        com.sun.javatest.regtest.agent.MainWrapper /var/www/hudson/ws/workspace/MinimalDepsRun/jake/jdk/test/JTwork-sun-security-pkcs11-Cipher-ReinitCipher-java_0/sun/security/pkcs11/Cipher/ReinitCipher.d/main.0.jta
result: Failed. Execution failed: `main' threw exception: java.security.NoSuchProviderException: No PKCS11 provider available


test result: Failed. Execution failed: `main' threw exception: java.security.NoSuchProviderException: No PKCS11 provider available


More information about the security-dev mailing list