8173135: compiler/aot/fingerprint/SelfChangedCDS.java fails with: Unrecognized VM option 'UnlockCommercialFeatures'
authorkvn
Sat, 21 Jan 2017 15:08:53 -0800
changeset 43472 657435e2b052
parent 43471 bfb383279a16
child 43473 3beee3e324cf
8173135: compiler/aot/fingerprint/SelfChangedCDS.java fails with: Unrecognized VM option 'UnlockCommercialFeatures' Summary: Move aot/fingerprint tests to closed since they use commercial feature. Reviewed-by: iveresov
hotspot/test/compiler/aot/fingerprint/CDSDumper.java
hotspot/test/compiler/aot/fingerprint/CDSRunner.java
hotspot/test/compiler/aot/fingerprint/SelfChanged.java
hotspot/test/compiler/aot/fingerprint/SelfChangedCDS.java
hotspot/test/compiler/aot/fingerprint/SuperChanged.java
--- a/hotspot/test/compiler/aot/fingerprint/CDSDumper.java	Fri Jan 20 16:09:56 2017 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2016, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package compiler.aot.fingerprint;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.PrintStream;
-
-import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.process.ProcessTools;
-
-// Usage:
-// java CDSDumper <classpath> <classlist> <archive> <class1> <class2> ...
-public class CDSDumper {
-    public static void main(String[] args) throws Exception {
-        String classpath = args[0];
-        String classlist = args[1];
-        String archive = args[2];
-
-        // Prepare the classlist
-        FileOutputStream fos = new FileOutputStream(classlist);
-        PrintStream ps = new PrintStream(fos);
-
-        for (int i=3; i<args.length; i++) {
-            ps.println(args[i].replace('.', '/'));
-        }
-        ps.close();
-        fos.close();
-
-        // Dump the archive
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-            "-XX:+UnlockCommercialFeatures",
-            "-XX:+UseAppCDS",
-            "-XX:+UnlockDiagnosticVMOptions",
-            "-cp", classpath,
-            "-XX:ExtraSharedClassListFile=" + classlist,
-            "-XX:SharedArchiveFile=" + archive,
-            "-Xshare:dump",
-            "-XX:+PrintSharedSpaces");
-
-        OutputAnalyzer output = new OutputAnalyzer(pb.start());
-        output.shouldContain("Loading classes to share");
-        output.shouldHaveExitValue(0);
-    }
-}
--- a/hotspot/test/compiler/aot/fingerprint/CDSRunner.java	Fri Jan 20 16:09:56 2017 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2016, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package compiler.aot.fingerprint;
-
-import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.process.ProcessTools;
-
-// Usage:
-// java CDSRunner <vmargs> <class> <args> ...
-public class CDSRunner {
-    public static void main(String[] args) throws Exception {
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args);
-        OutputAnalyzer output = new OutputAnalyzer(pb.start());
-
-        System.out.println("[stdout = " + output.getStdout() + "]");
-        System.out.println("[stderr = " + output.getStderr() + "]");
-
-        output.shouldContain("PASSED");
-        output.shouldHaveExitValue(0);
-    }
-}
--- a/hotspot/test/compiler/aot/fingerprint/SelfChanged.java	Fri Jan 20 16:09:56 2017 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 2016, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary AOT methods should be swept if a super class has changed.
- * @library /test/lib /
- * @modules java.base/jdk.internal.misc
- *          java.management
- * @requires vm.bits == "64" & os.arch == "amd64" & os.family == "linux"
- * @build compiler.aot.fingerprint.SelfChanged
- *        compiler.aot.AotCompiler
- *
- * @run main
- *      compiler.aot.fingerprint.SelfChanged WRITE-UNMODIFIED-CLASS
- * @run main/othervm compiler.aot.AotCompiler -libname libSelfChanged.so
- *      -class compiler.aot.fingerprint.Blah
- *
- * @run main/othervm
- *      compiler.aot.fingerprint.SelfChanged TEST-UNMODIFIED
- * @run main/othervm -XX:+UseAOT -XX:+PrintAOT -XX:AOTLibrary=./libSelfChanged.so
- *      -Xlog:aot+class+fingerprint=trace -Xlog:aot+class+load=trace
- *      compiler.aot.fingerprint.SelfChanged TEST-UNMODIFIED
- *
- * @run main
- *      compiler.aot.fingerprint.SelfChanged WRITE-MODIFIED-CLASS
- * @run main
- *      compiler.aot.fingerprint.SelfChanged TEST-MODIFIED
- * @run main/othervm -XX:+UseAOT -XX:+PrintAOT -XX:AOTLibrary=./libSelfChanged.so
- *      -Xlog:aot+class+fingerprint=trace -Xlog:aot+class+load=trace
- *      compiler.aot.fingerprint.SelfChanged TEST-MODIFIED
- */
-
-package compiler.aot.fingerprint;
-
-import jdk.test.lib.Asserts;
-import jdk.test.lib.InMemoryJavaCompiler;
-
-import java.io.*;
-
-class Blah {
-    volatile int z;
-    int getX() {
-        for (z = 0; z < 10000; z++) {
-            if (z % 7 == 1) {
-                z += 2;
-            }
-        }
-        return 0;
-    }
-}
-
-public class SelfChanged {
-    public static void main(String args[]) throws Throwable {
-        Blah f = new Blah();
-        System.out.println("f.getX = " + f.getX());
-        switch (args[0]) {
-        case "WRITE-UNMODIFIED-CLASS":
-            compileClass(false);
-            break;
-        case "WRITE-MODIFIED-CLASS":
-            compileClass(true);
-            break;
-        case "TEST-UNMODIFIED":
-            Asserts.assertTrue(f.getX() == 0, "getX from unmodified Blah class should return 0");
-            break;
-        case "TEST-MODIFIED":
-            Asserts.assertTrue(f.getX() == 1, "getX from modified Blah class should return 1");
-            break;
-        default:
-            throw new RuntimeException("unexpected option: " + args[0]);
-        }
-    }
-
-    static void compileClass(boolean isModified) throws Throwable {
-        String src =
-               "package compiler.aot.fingerprint;"
-             + "public class Blah {"
-             + "    volatile int z;"
-             + "    int getX() {"
-             + "        for (z = 0; z < 10000; z++) {"
-             + "            if (z % 7 == 1) {"
-             + "                z += 2;"
-             + "            }"
-             + "        }"
-             + "        return " + ((isModified) ? "1" : "0") + ";"
-             + "    }"
-             + "    int getY() {return 255;}"
-
-            // The following is for the SelfChangedCDS.java test case. We always load an unmodified
-            // version of Blah from the CDS archive. However, we would load an AOT library that
-            // was compiled using a modified version of Blah. The getX method in this AOT library should
-            // not be used.
-
-            + "    public static void main(String args[]) {"
-             + "        Blah b = new Blah();"
-             + "        int n = b.getX();"
-             + "        if (n != 0) {"
-             + "            throw new RuntimeException(args[0] +  \" : \" + n);"
-             + "        }"
-             + "        System.out.println(\"PASSED\");"
-             + "    }"
-             + "}";
-
-        String filename = System.getProperty("test.classes") + "/compiler/aot/fingerprint/Blah.class";
-        FileOutputStream fos = new FileOutputStream(filename);
-        fos.write(InMemoryJavaCompiler.compile("compiler.aot.fingerprint.Blah", src));
-        fos.close();
-    }
-}
--- a/hotspot/test/compiler/aot/fingerprint/SelfChangedCDS.java	Fri Jan 20 16:09:56 2017 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2016, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary AOT methods should be swept if a super class has changed (with CDS).
- * @library /test/lib /
- * @modules java.base/jdk.internal.misc
- *          java.management
- * @requires vm.bits == "64" & os.arch == "amd64" & os.family == "linux"
- * @build compiler.aot.fingerprint.SelfChanged
- *        compiler.aot.AotCompiler
- *
- * @run main compiler.aot.fingerprint.SelfChanged WRITE-UNMODIFIED-CLASS
- * @run main/othervm compiler.aot.AotCompiler -libname libSelfChanged.so
- *      -class compiler.aot.fingerprint.Blah
- *
- * @run main ClassFileInstaller -jar SelfChangedCDS.jar compiler.aot.fingerprint.Blah
- * @run main compiler.aot.fingerprint.CDSDumper SelfChangedCDS.jar SelfChangedCDS.classlist SelfChangedCDS.jsa
- *      compiler.aot.fingerprint.Blah
- *
- * @run main compiler.aot.fingerprint.CDSRunner -cp SelfChangedCDS.jar
- *      compiler.aot.fingerprint.Blah TEST-UNMODIFIED
- * @run main compiler.aot.fingerprint.CDSRunner -cp SelfChangedCDS.jar
- *      -XX:+UseAOT -XX:+PrintAOT -XX:AOTLibrary=./libSelfChanged.so
- *      -XX:+UnlockDiagnosticVMOptions -XX:SharedArchiveFile=SelfChangedCDS.jsa
- *      -Xshare:auto -XX:+UnlockCommercialFeatures -XX:+UseAppCDS -showversion
- *      -Xlog:aot+class+fingerprint=trace -Xlog:aot+class+load=trace
- *      compiler.aot.fingerprint.Blah TEST-UNMODIFIED
- *
- * @run main
- *      compiler.aot.fingerprint.SelfChanged WRITE-MODIFIED-CLASS
- * @run main/othervm compiler.aot.AotCompiler -libname libSelfChanged.so
- *      -class compiler.aot.fingerprint.Blah
- *
- * @run main compiler.aot.fingerprint.CDSRunner -cp SelfChangedCDS.jar
- *      compiler.aot.fingerprint.Blah TEST-MODIFIED
- * @run main compiler.aot.fingerprint.CDSRunner -cp SelfChangedCDS.jar
- *      -XX:+UseAOT -XX:+PrintAOT -XX:AOTLibrary=./libSelfChanged.so
- *      -XX:+UnlockDiagnosticVMOptions -XX:SharedArchiveFile=SelfChangedCDS.jsa
- *      -Xshare:auto -XX:+UnlockCommercialFeatures -XX:+UseAppCDS -showversion
- *      -Xlog:aot+class+fingerprint=trace -Xlog:aot+class+load=trace
- *      compiler.aot.fingerprint.Blah TEST-MODIFIED
- */
--- a/hotspot/test/compiler/aot/fingerprint/SuperChanged.java	Fri Jan 20 16:09:56 2017 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 2016, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary AOT methods should be swept if a super class has changed.
- * @library /test/lib /
- * @modules java.base/jdk.internal.misc
- *          java.management
- * @requires vm.bits == "64" & os.arch == "amd64" & os.family == "linux"
- * @build compiler.aot.fingerprint.SuperChanged
- *        compiler.aot.AotCompiler
- *
- * @run main
- *      compiler.aot.fingerprint.SuperChanged WRITE-UNMODIFIED-CLASS
- * @run main/othervm compiler.aot.AotCompiler -libname libSuperChanged.so
- *      -class compiler.aot.fingerprint.Foo
- *
- * @run main
- *      compiler.aot.fingerprint.SuperChanged TEST-UNMODIFIED
- * @run main/othervm -XX:+UseAOT -XX:+PrintAOT -XX:AOTLibrary=./libSuperChanged.so
- *      -Xlog:aot+class+fingerprint=trace -Xlog:aot+class+load=trace
- *      compiler.aot.fingerprint.SuperChanged TEST-UNMODIFIED
-  *
- * @run main
- *      compiler.aot.fingerprint.SuperChanged WRITE-MODIFIED-CLASS
- * @run main
- *      compiler.aot.fingerprint.SuperChanged TEST-MODIFIED
- * @run main/othervm -XX:+UseAOT -XX:+PrintAOT -XX:AOTLibrary=./libSuperChanged.so
- *      -Xlog:aot+class+fingerprint=trace -Xlog:aot+class+load=trace
- *      compiler.aot.fingerprint.SuperChanged TEST-MODIFIED
- */
-
-package compiler.aot.fingerprint;
-
-import jdk.test.lib.Asserts;
-import jdk.test.lib.InMemoryJavaCompiler;
-
-import java.io.*;
-
-class Bar {
-    volatile int x = 0;
-    volatile int y = 1;
-}
-
-class Foo extends Bar {
-
-    volatile int z;
-    int getX() {
-        for (z = 0; z < 10000; z++) {
-            if (z % 7 == 1) {
-                z += 2;
-            }
-        }
-        return x;
-    }
-}
-
-public class SuperChanged {
-    public static void main(String args[]) throws Throwable {
-        Foo f = new Foo();
-        System.out.println("f.getX = " + f.getX());
-        switch (args[0]) {
-        case "WRITE-UNMODIFIED-CLASS":
-            compileClass(false);
-            break;
-        case "WRITE-MODIFIED-CLASS":
-            compileClass(true);
-            break;
-        case "TEST-UNMODIFIED":
-            Asserts.assertTrue(f.getX() == 0, "getX from unmodified Foo class should return 0");
-            break;
-        case "TEST-MODIFIED":
-            Asserts.assertTrue(f.getX() == 1, "getX from modified Foo class should return 1");
-            break;
-        default:
-            throw new RuntimeException("unexpected option: " + args[0]);
-        }
-    }
-
-    static void compileClass(boolean isModified) throws Throwable {
-        String class_src_0 = "package compiler.aot.fingerprint; class Bar {volatile int x = 0;  volatile int y = 1;}";
-        String class_src_1 = "package compiler.aot.fingerprint; class Bar {volatile int y = 0;  volatile int x = 1;}";
-        String src = (isModified) ? class_src_1 : class_src_0;
-
-        String filename = System.getProperty("test.classes") + "/compiler/aot/fingerprint/Bar.class";
-        FileOutputStream fos = new FileOutputStream(filename);
-        fos.write(InMemoryJavaCompiler.compile("compiler.aot.fingerprint.Bar", src));
-        fos.close();
-    }
-}