JDK 10 RFR of JDK-8173903: Update various tests to pass under JDK 10
Paul Sandoz
paul.sandoz at oracle.com
Fri Feb 3 20:28:50 UTC 2017
+1
Paul.
> On 3 Feb 2017, at 11:21, joe darcy <joe.darcy at oracle.com> wrote:
>
> Hello,
>
> After the version update to "10" in JDK 10 ( JDK-8029942 ), various libraries tests failed including:
>
> java/lang/module/MultiReleaseJarTest.java
> java/security/Provider/ProviderVersionCheck.java
> sun/security/tools/jarsigner/multiRelease/MVJarSigningTest.java
>
> These tests need to be updated for the new JDK. When it is clear how to do so, I've updated the tests in a way so that they don't need to be updated again for JDK 11.
>
> Webrev:
>
> http://cr.openjdk.java.net/~darcy/8173903.0/
>
> and patch below. I'll update the other copyrights before pushing.
>
> Thanks,
>
> -Joe
>
>
> diff -r 72f33dbfcf3b test/java/lang/module/MultiReleaseJarTest.java
> --- a/test/java/lang/module/MultiReleaseJarTest.java Tue Jan 31 19:26:10 2017 -0500
> +++ b/test/java/lang/module/MultiReleaseJarTest.java Fri Feb 03 11:18:23 2017 -0800
> @@ -1,5 +1,5 @@
> /*
> - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
> + * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
> * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
> *
> * This code is free software; you can redistribute it and/or modify it
> @@ -65,7 +65,7 @@
>
> private static final String MODULE_INFO = "module-info.class";
>
> - private static final int RELEASE = Runtime.version().major();
> + private static final String RELEASE = "" + Runtime.version().major();
>
> // are multi-release JARs enabled?
> private static final boolean MULTI_RELEASE;
> @@ -88,8 +88,8 @@
> .moduleInfo("module-info.class", descriptor)
> .resource("p/Main.class")
> .resource("p/Helper.class")
> - .resource("META-INF/versions/9/p/Helper.class")
> - .resource("META-INF/versions/9/p/internal/Helper9.class")
> + .resource("META-INF/versions/" + RELEASE + "/p/Helper.class")
> + .resource("META-INF/versions/" + RELEASE + "/p/internal/HelperNew.class")
> .build();
>
> // find the module
> @@ -131,9 +131,9 @@
> .moduleInfo(MODULE_INFO, descriptor1)
> .resource("p/Main.class")
> .resource("p/Helper.class")
> - .moduleInfo("META-INF/versions/9/" + MODULE_INFO, descriptor2)
> - .resource("META-INF/versions/9/p/Helper.class")
> - .resource("META-INF/versions/9/p/internal/Helper9.class")
> + .moduleInfo("META-INF/versions/" + RELEASE + "/" + MODULE_INFO, descriptor2)
> + .resource("META-INF/versions/" + RELEASE + "/p/Helper.class")
> + .resource("META-INF/versions/" + RELEASE + "/p/internal/HelperNew.class")
> .build();
>
> // find the module
> @@ -161,8 +161,8 @@
> Path jar = new JarBuilder(name)
> .resource("p/Main.class")
> .resource("p/Helper.class")
> - .resource("META-INF/versions/9/p/Helper.class")
> - .resource("META-INF/versions/9/p/internal/Helper9.class")
> + .resource("META-INF/versions/" + RELEASE + "/p/Helper.class")
> + .resource("META-INF/versions/" + RELEASE + "/p/internal/HelperNew.class")
> .build();
>
> // find the module
> @@ -200,7 +200,7 @@
>
> Path jar = new JarBuilder(name)
> .moduleInfo(MODULE_INFO, descriptor1)
> - .moduleInfo("META-INF/versions/9/" + MODULE_INFO, descriptor2)
> + .moduleInfo("META-INF/versions/" + RELEASE + "/" + MODULE_INFO, descriptor2)
> .build();
>
> // find the module
> diff -r 72f33dbfcf3b test/java/security/Provider/ProviderVersionCheck.java
> --- a/test/java/security/Provider/ProviderVersionCheck.java Tue Jan 31 19:26:10 2017 -0500
> +++ b/test/java/security/Provider/ProviderVersionCheck.java Fri Feb 03 11:18:23 2017 -0800
> @@ -42,7 +42,7 @@
>
> for (Provider p: Security.getProviders()) {
> System.out.print(p.getName() + " ");
> - if (p.getVersion() != 9.0d) {
> + if (p.getVersion() != 10.0d) {
> System.out.println("failed. " + "Version received was " +
> p.getVersion());
> failure = true;
> diff -r 72f33dbfcf3b test/sun/security/tools/jarsigner/multiRelease/MVJarSigningTest.java
> --- a/test/sun/security/tools/jarsigner/multiRelease/MVJarSigningTest.java Tue Jan 31 19:26:10 2017 -0500
> +++ b/test/sun/security/tools/jarsigner/multiRelease/MVJarSigningTest.java Fri Feb 03 11:18:23 2017 -0800
> @@ -74,7 +74,8 @@
> private static final String KEYPASS = "changeit";
> private static final String SIGNED_JAR = "Signed.jar";
> private static final String POLICY_FILE = "SignedJar.policy";
> - private static final String VERSION_MESSAGE = "I am running on version 9";
> + private static final String VERSION = "" + Runtime.version().major();
> + private static final String VERSION_MESSAGE = "I am running on version " + VERSION;
>
> public static void main(String[] args) throws Throwable {
> // compile java files in jarContent directory
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://mail.openjdk.org/pipermail/security-dev/attachments/20170203/6387fff9/signature.asc>
More information about the security-dev
mailing list