RFR: 8313206: PKCS11 tests silently skip execution [v3]

Rajan Halade rhalade at openjdk.org
Thu Aug 3 17:12:38 UTC 2023


On Thu, 3 Aug 2023 06:40:27 GMT, Sibabrata Sahoo <ssahoo at openjdk.org> wrote:

>> Rajan Halade has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8313206: revert skipTest update to address with new bug
>
> test/jdk/sun/security/pkcs11/KeyStore/SecretKeysBasic.java line 70:
> 
>> 68:             main(new SecretKeysBasic());
>> 69:         } catch (SkippedException se) {
>> 70:             throw new SkipException("One or more tests are skipped");
> 
> SkipException is only thrown when all cases skipped in PKCS11Test.main() Line: 215-218.
> Individual test case skip process are handled with print and flag set in PKCS11Test.main() Line:191-213. So it is not thrown.
> If it is handled in base class PKCS11Test.main() then these changes in each Test not required.

These changes are needed to individual tests as they are TestNG tests. If test doesn't mask SkippedException to TestNG SkipException then test will be marked as failed than skipped by TestNG.

> test/jdk/sun/security/pkcs11/PKCS11Test.java line 277:
> 
>> 275:         Provider[] providers = Security.getProviders();
>> 276:         for (Provider p : providers) {
>> 277:             if (p.getName().startsWith("SunPKCS11-")) {
> 
> Please correct me, if i am wrong. But as per my understanding there can be many PKCS11 provider instance exist in same time based on different token configuration and the order can be different too. They all have name similarity which starts with "SunPKCS11-" followed by a vendor specific name. In that case specifying the default PKCS11 provider name could be better which is 'p.getName().equals("SunPKCS11")'. Also the loop should break immediately after finding the default provider.

As is currently, test is run for all found providers. I am avoiding to update existing test logic with this change. I will consider this update while working on [JDK-8313575](https://bugs.openjdk.org/browse/JDK-8313575). More TBD

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/15125#discussion_r1283491635
PR Review Comment: https://git.openjdk.org/jdk/pull/15125#discussion_r1283491422



More information about the security-dev mailing list