8353325: Rewrite appcds/methodHandles test cases to use CDSAppTester
Reviewed-by: ccheung
This commit is contained in:
parent
e2e1598ecc
commit
b01026abaa
@ -547,6 +547,7 @@ hotspot_aot_classlinking = \
|
||||
-runtime/cds/appcds/jvmti \
|
||||
-runtime/cds/appcds/LambdaProxyClasslist.java \
|
||||
-runtime/cds/appcds/loaderConstraints/LoaderConstraintsTest.java \
|
||||
-runtime/cds/appcds/methodHandles \
|
||||
-runtime/cds/appcds/NestHostOldInf.java \
|
||||
-runtime/cds/appcds/OldClassTest.java \
|
||||
-runtime/cds/appcds/OldClassWithjsr.java \
|
||||
|
@ -1,136 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2020, 2024, 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.
|
||||
#
|
||||
|
||||
echo "// --- start auto-generated"
|
||||
|
||||
testnames=( MethodHandlesGeneralTest MethodHandlesAsCollectorTest MethodHandlesCastFailureTest MethodHandlesInvokersTest MethodHandlesPermuteArgumentsTest MethodHandlesSpreadArgumentsTest )
|
||||
name_suffix='.java'
|
||||
|
||||
for i in "${testnames[@]}"
|
||||
do
|
||||
fname="$i$name_suffix"
|
||||
cat << EOF > $fname
|
||||
/*
|
||||
* Copyright (c) 2020, 2024, 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.
|
||||
*
|
||||
*/
|
||||
// this file is auto-generated by $0. Do not edit manually.
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary Run the $fname test in dynamic CDS archive mode.
|
||||
* @requires vm.cds & vm.compMode != "Xcomp"
|
||||
* @comment Some of the tests run excessively slowly with -Xcomp. The original
|
||||
* tests aren't executed with -Xcomp in the CI pipeline, so let's exclude
|
||||
* the generated tests from -Xcomp execution as well.
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
|
||||
* /test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive
|
||||
* /test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/test-classes
|
||||
* @compile ../../../../../../../jdk/java/lang/invoke/MethodHandlesTest.java
|
||||
* ../../../../../../../lib/jdk/test/lib/Utils.java
|
||||
* ../../../../../../../jdk/java/lang/invoke/$fname
|
||||
* ../../../../../../../jdk/java/lang/invoke/remote/RemoteExample.java
|
||||
* ../../../../../../../jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java
|
||||
* ../test-classes/TestMHApp.java
|
||||
* @build jdk.test.whitebox.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
|
||||
* @run junit/othervm/timeout=480 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. $i
|
||||
*/
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import jdk.test.lib.Platform;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class $i extends DynamicArchiveTestBase {
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
runTest($i::testImpl);
|
||||
}
|
||||
|
||||
private static final String classDir = System.getProperty("test.classes");
|
||||
private static final String mainClass = "TestMHApp";
|
||||
private static final String javaClassPath = System.getProperty("java.class.path");
|
||||
private static final String ps = System.getProperty("path.separator");
|
||||
private static final String testPackageName = "test.java.lang.invoke";
|
||||
private static final String testClassName = "$i";
|
||||
private static final String loggingOpts = "-Xlog:cds,cds+dynamic=debug,class+load=trace";
|
||||
private static final String lambdaLoadedFromArchive =
|
||||
".class.load. test.java.lang.invoke.$i[$][$]Lambda.*/0x.*source:.*shared.*objects.*file.*(top)";
|
||||
|
||||
static void checkError(OutputAnalyzer output) throws Exception {
|
||||
if (testClassName.equals("MethodHandlesInvokersTest")) {
|
||||
output.shouldNotContain("Failed to generate LambdaForm holder classes. Was the base archive generated with an outdated classlist?");
|
||||
}
|
||||
}
|
||||
|
||||
static void testImpl() throws Exception {
|
||||
String topArchiveName = getNewArchiveName();
|
||||
String appJar = JarBuilder.build("MH", new File(classDir), null);
|
||||
// Disable VerifyDpendencies when running with debug build because
|
||||
// the test requires a lot more time to execute with the option enabled.
|
||||
String verifyOpt =
|
||||
Platform.isDebugBuild() ? "-XX:-VerifyDependencies" : "-showversion";
|
||||
|
||||
String junitJar = Path.of(Test.class.getProtectionDomain().getCodeSource().getLocation().toURI()).toString();
|
||||
String jars = appJar + ps + junitJar;
|
||||
String className = testPackageName + "." + testClassName;
|
||||
|
||||
dump(topArchiveName, loggingOpts, "-cp", jars, verifyOpt, mainClass, className)
|
||||
.assertNormalExit(output -> checkError(output))
|
||||
.assertNormalExit(output -> {
|
||||
output.shouldContain("Written dynamic archive 0x");
|
||||
});
|
||||
|
||||
run(topArchiveName, loggingOpts, "-cp", jars, verifyOpt, mainClass, className)
|
||||
.assertNormalExit(output -> {
|
||||
output.shouldMatch(lambdaLoadedFromArchive)
|
||||
.shouldHaveExitValue(0);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
EOF
|
||||
done
|
||||
echo "// --- end auto-generated"
|
@ -1,101 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 2024, 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.
|
||||
*
|
||||
*/
|
||||
// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually.
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary Run the MethodHandlesAsCollectorTest.java test in dynamic CDS archive mode.
|
||||
* @requires vm.cds & vm.compMode != "Xcomp"
|
||||
* @comment Some of the tests run excessively slowly with -Xcomp. The original
|
||||
* tests aren't executed with -Xcomp in the CI pipeline, so let's exclude
|
||||
* the generated tests from -Xcomp execution as well.
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
|
||||
* /test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive
|
||||
* /test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/test-classes
|
||||
* @compile ../../../../../../../jdk/java/lang/invoke/MethodHandlesTest.java
|
||||
* ../../../../../../../lib/jdk/test/lib/Utils.java
|
||||
* ../../../../../../../jdk/java/lang/invoke/MethodHandlesAsCollectorTest.java
|
||||
* ../../../../../../../jdk/java/lang/invoke/remote/RemoteExample.java
|
||||
* ../../../../../../../jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java
|
||||
* ../test-classes/TestMHApp.java
|
||||
* @build jdk.test.whitebox.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
|
||||
* @run junit/othervm/timeout=480 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. MethodHandlesAsCollectorTest
|
||||
*/
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import jdk.test.lib.Platform;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class MethodHandlesAsCollectorTest extends DynamicArchiveTestBase {
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
runTest(MethodHandlesAsCollectorTest::testImpl);
|
||||
}
|
||||
|
||||
private static final String classDir = System.getProperty("test.classes");
|
||||
private static final String mainClass = "TestMHApp";
|
||||
private static final String javaClassPath = System.getProperty("java.class.path");
|
||||
private static final String ps = System.getProperty("path.separator");
|
||||
private static final String testPackageName = "test.java.lang.invoke";
|
||||
private static final String testClassName = "MethodHandlesAsCollectorTest";
|
||||
private static final String loggingOpts = "-Xlog:cds,cds+dynamic=debug,class+load=trace";
|
||||
private static final String lambdaLoadedFromArchive =
|
||||
".class.load. test.java.lang.invoke.MethodHandlesAsCollectorTest[$][$]Lambda.*/0x.*source:.*shared.*objects.*file.*(top)";
|
||||
|
||||
static void checkError(OutputAnalyzer output) throws Exception {
|
||||
if (testClassName.equals("MethodHandlesInvokersTest")) {
|
||||
output.shouldNotContain("Failed to generate LambdaForm holder classes. Was the base archive generated with an outdated classlist?");
|
||||
}
|
||||
}
|
||||
|
||||
static void testImpl() throws Exception {
|
||||
String topArchiveName = getNewArchiveName();
|
||||
String appJar = JarBuilder.build("MH", new File(classDir), null);
|
||||
// Disable VerifyDpendencies when running with debug build because
|
||||
// the test requires a lot more time to execute with the option enabled.
|
||||
String verifyOpt =
|
||||
Platform.isDebugBuild() ? "-XX:-VerifyDependencies" : "-showversion";
|
||||
|
||||
String junitJar = Path.of(Test.class.getProtectionDomain().getCodeSource().getLocation().toURI()).toString();
|
||||
String jars = appJar + ps + junitJar;
|
||||
String className = testPackageName + "." + testClassName;
|
||||
|
||||
dump(topArchiveName, loggingOpts, "-cp", jars, verifyOpt, mainClass, className)
|
||||
.assertNormalExit(output -> checkError(output))
|
||||
.assertNormalExit(output -> {
|
||||
output.shouldContain("Written dynamic archive 0x");
|
||||
});
|
||||
|
||||
run(topArchiveName, loggingOpts, "-cp", jars, verifyOpt, mainClass, className)
|
||||
.assertNormalExit(output -> {
|
||||
output.shouldMatch(lambdaLoadedFromArchive)
|
||||
.shouldHaveExitValue(0);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
@ -1,101 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 2024, 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.
|
||||
*
|
||||
*/
|
||||
// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually.
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary Run the MethodHandlesCastFailureTest.java test in dynamic CDS archive mode.
|
||||
* @requires vm.cds & vm.compMode != "Xcomp"
|
||||
* @comment Some of the tests run excessively slowly with -Xcomp. The original
|
||||
* tests aren't executed with -Xcomp in the CI pipeline, so let's exclude
|
||||
* the generated tests from -Xcomp execution as well.
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
|
||||
* /test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive
|
||||
* /test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/test-classes
|
||||
* @compile ../../../../../../../jdk/java/lang/invoke/MethodHandlesTest.java
|
||||
* ../../../../../../../lib/jdk/test/lib/Utils.java
|
||||
* ../../../../../../../jdk/java/lang/invoke/MethodHandlesCastFailureTest.java
|
||||
* ../../../../../../../jdk/java/lang/invoke/remote/RemoteExample.java
|
||||
* ../../../../../../../jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java
|
||||
* ../test-classes/TestMHApp.java
|
||||
* @build jdk.test.whitebox.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
|
||||
* @run junit/othervm/timeout=480 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. MethodHandlesCastFailureTest
|
||||
*/
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import jdk.test.lib.Platform;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class MethodHandlesCastFailureTest extends DynamicArchiveTestBase {
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
runTest(MethodHandlesCastFailureTest::testImpl);
|
||||
}
|
||||
|
||||
private static final String classDir = System.getProperty("test.classes");
|
||||
private static final String mainClass = "TestMHApp";
|
||||
private static final String javaClassPath = System.getProperty("java.class.path");
|
||||
private static final String ps = System.getProperty("path.separator");
|
||||
private static final String testPackageName = "test.java.lang.invoke";
|
||||
private static final String testClassName = "MethodHandlesCastFailureTest";
|
||||
private static final String loggingOpts = "-Xlog:cds,cds+dynamic=debug,class+load=trace";
|
||||
private static final String lambdaLoadedFromArchive =
|
||||
".class.load. test.java.lang.invoke.MethodHandlesCastFailureTest[$][$]Lambda.*/0x.*source:.*shared.*objects.*file.*(top)";
|
||||
|
||||
static void checkError(OutputAnalyzer output) throws Exception {
|
||||
if (testClassName.equals("MethodHandlesInvokersTest")) {
|
||||
output.shouldNotContain("Failed to generate LambdaForm holder classes. Was the base archive generated with an outdated classlist?");
|
||||
}
|
||||
}
|
||||
|
||||
static void testImpl() throws Exception {
|
||||
String topArchiveName = getNewArchiveName();
|
||||
String appJar = JarBuilder.build("MH", new File(classDir), null);
|
||||
// Disable VerifyDpendencies when running with debug build because
|
||||
// the test requires a lot more time to execute with the option enabled.
|
||||
String verifyOpt =
|
||||
Platform.isDebugBuild() ? "-XX:-VerifyDependencies" : "-showversion";
|
||||
|
||||
String junitJar = Path.of(Test.class.getProtectionDomain().getCodeSource().getLocation().toURI()).toString();
|
||||
String jars = appJar + ps + junitJar;
|
||||
String className = testPackageName + "." + testClassName;
|
||||
|
||||
dump(topArchiveName, loggingOpts, "-cp", jars, verifyOpt, mainClass, className)
|
||||
.assertNormalExit(output -> checkError(output))
|
||||
.assertNormalExit(output -> {
|
||||
output.shouldContain("Written dynamic archive 0x");
|
||||
});
|
||||
|
||||
run(topArchiveName, loggingOpts, "-cp", jars, verifyOpt, mainClass, className)
|
||||
.assertNormalExit(output -> {
|
||||
output.shouldMatch(lambdaLoadedFromArchive)
|
||||
.shouldHaveExitValue(0);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
@ -1,101 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 2024, 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.
|
||||
*
|
||||
*/
|
||||
// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually.
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary Run the MethodHandlesGeneralTest.java test in dynamic CDS archive mode.
|
||||
* @requires vm.cds & vm.compMode != "Xcomp"
|
||||
* @comment Some of the tests run excessively slowly with -Xcomp. The original
|
||||
* tests aren't executed with -Xcomp in the CI pipeline, so let's exclude
|
||||
* the generated tests from -Xcomp execution as well.
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
|
||||
* /test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive
|
||||
* /test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/test-classes
|
||||
* @compile ../../../../../../../jdk/java/lang/invoke/MethodHandlesTest.java
|
||||
* ../../../../../../../lib/jdk/test/lib/Utils.java
|
||||
* ../../../../../../../jdk/java/lang/invoke/MethodHandlesGeneralTest.java
|
||||
* ../../../../../../../jdk/java/lang/invoke/remote/RemoteExample.java
|
||||
* ../../../../../../../jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java
|
||||
* ../test-classes/TestMHApp.java
|
||||
* @build jdk.test.whitebox.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
|
||||
* @run junit/othervm/timeout=480 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. MethodHandlesGeneralTest
|
||||
*/
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import jdk.test.lib.Platform;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class MethodHandlesGeneralTest extends DynamicArchiveTestBase {
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
runTest(MethodHandlesGeneralTest::testImpl);
|
||||
}
|
||||
|
||||
private static final String classDir = System.getProperty("test.classes");
|
||||
private static final String mainClass = "TestMHApp";
|
||||
private static final String javaClassPath = System.getProperty("java.class.path");
|
||||
private static final String ps = System.getProperty("path.separator");
|
||||
private static final String testPackageName = "test.java.lang.invoke";
|
||||
private static final String testClassName = "MethodHandlesGeneralTest";
|
||||
private static final String loggingOpts = "-Xlog:cds,cds+dynamic=debug,class+load=trace";
|
||||
private static final String lambdaLoadedFromArchive =
|
||||
".class.load. test.java.lang.invoke.MethodHandlesGeneralTest[$][$]Lambda.*/0x.*source:.*shared.*objects.*file.*(top)";
|
||||
|
||||
static void checkError(OutputAnalyzer output) throws Exception {
|
||||
if (testClassName.equals("MethodHandlesInvokersTest")) {
|
||||
output.shouldNotContain("Failed to generate LambdaForm holder classes. Was the base archive generated with an outdated classlist?");
|
||||
}
|
||||
}
|
||||
|
||||
static void testImpl() throws Exception {
|
||||
String topArchiveName = getNewArchiveName();
|
||||
String appJar = JarBuilder.build("MH", new File(classDir), null);
|
||||
// Disable VerifyDpendencies when running with debug build because
|
||||
// the test requires a lot more time to execute with the option enabled.
|
||||
String verifyOpt =
|
||||
Platform.isDebugBuild() ? "-XX:-VerifyDependencies" : "-showversion";
|
||||
|
||||
String junitJar = Path.of(Test.class.getProtectionDomain().getCodeSource().getLocation().toURI()).toString();
|
||||
String jars = appJar + ps + junitJar;
|
||||
String className = testPackageName + "." + testClassName;
|
||||
|
||||
dump(topArchiveName, loggingOpts, "-cp", jars, verifyOpt, mainClass, className)
|
||||
.assertNormalExit(output -> checkError(output))
|
||||
.assertNormalExit(output -> {
|
||||
output.shouldContain("Written dynamic archive 0x");
|
||||
});
|
||||
|
||||
run(topArchiveName, loggingOpts, "-cp", jars, verifyOpt, mainClass, className)
|
||||
.assertNormalExit(output -> {
|
||||
output.shouldMatch(lambdaLoadedFromArchive)
|
||||
.shouldHaveExitValue(0);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
@ -1,101 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 2024, 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.
|
||||
*
|
||||
*/
|
||||
// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually.
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary Run the MethodHandlesInvokersTest.java test in dynamic CDS archive mode.
|
||||
* @requires vm.cds & vm.compMode != "Xcomp"
|
||||
* @comment Some of the tests run excessively slowly with -Xcomp. The original
|
||||
* tests aren't executed with -Xcomp in the CI pipeline, so let's exclude
|
||||
* the generated tests from -Xcomp execution as well.
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
|
||||
* /test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive
|
||||
* /test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/test-classes
|
||||
* @compile ../../../../../../../jdk/java/lang/invoke/MethodHandlesTest.java
|
||||
* ../../../../../../../lib/jdk/test/lib/Utils.java
|
||||
* ../../../../../../../jdk/java/lang/invoke/MethodHandlesInvokersTest.java
|
||||
* ../../../../../../../jdk/java/lang/invoke/remote/RemoteExample.java
|
||||
* ../../../../../../../jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java
|
||||
* ../test-classes/TestMHApp.java
|
||||
* @build jdk.test.whitebox.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
|
||||
* @run junit/othervm/timeout=480 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. MethodHandlesInvokersTest
|
||||
*/
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import jdk.test.lib.Platform;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class MethodHandlesInvokersTest extends DynamicArchiveTestBase {
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
runTest(MethodHandlesInvokersTest::testImpl);
|
||||
}
|
||||
|
||||
private static final String classDir = System.getProperty("test.classes");
|
||||
private static final String mainClass = "TestMHApp";
|
||||
private static final String javaClassPath = System.getProperty("java.class.path");
|
||||
private static final String ps = System.getProperty("path.separator");
|
||||
private static final String testPackageName = "test.java.lang.invoke";
|
||||
private static final String testClassName = "MethodHandlesInvokersTest";
|
||||
private static final String loggingOpts = "-Xlog:cds,cds+dynamic=debug,class+load=trace";
|
||||
private static final String lambdaLoadedFromArchive =
|
||||
".class.load. test.java.lang.invoke.MethodHandlesInvokersTest[$][$]Lambda.*/0x.*source:.*shared.*objects.*file.*(top)";
|
||||
|
||||
static void checkError(OutputAnalyzer output) throws Exception {
|
||||
if (testClassName.equals("MethodHandlesInvokersTest")) {
|
||||
output.shouldNotContain("Failed to generate LambdaForm holder classes. Was the base archive generated with an outdated classlist?");
|
||||
}
|
||||
}
|
||||
|
||||
static void testImpl() throws Exception {
|
||||
String topArchiveName = getNewArchiveName();
|
||||
String appJar = JarBuilder.build("MH", new File(classDir), null);
|
||||
// Disable VerifyDpendencies when running with debug build because
|
||||
// the test requires a lot more time to execute with the option enabled.
|
||||
String verifyOpt =
|
||||
Platform.isDebugBuild() ? "-XX:-VerifyDependencies" : "-showversion";
|
||||
|
||||
String junitJar = Path.of(Test.class.getProtectionDomain().getCodeSource().getLocation().toURI()).toString();
|
||||
String jars = appJar + ps + junitJar;
|
||||
String className = testPackageName + "." + testClassName;
|
||||
|
||||
dump(topArchiveName, loggingOpts, "-cp", jars, verifyOpt, mainClass, className)
|
||||
.assertNormalExit(output -> checkError(output))
|
||||
.assertNormalExit(output -> {
|
||||
output.shouldContain("Written dynamic archive 0x");
|
||||
});
|
||||
|
||||
run(topArchiveName, loggingOpts, "-cp", jars, verifyOpt, mainClass, className)
|
||||
.assertNormalExit(output -> {
|
||||
output.shouldMatch(lambdaLoadedFromArchive)
|
||||
.shouldHaveExitValue(0);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
@ -1,101 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 2024, 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.
|
||||
*
|
||||
*/
|
||||
// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually.
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary Run the MethodHandlesPermuteArgumentsTest.java test in dynamic CDS archive mode.
|
||||
* @requires vm.cds & vm.compMode != "Xcomp"
|
||||
* @comment Some of the tests run excessively slowly with -Xcomp. The original
|
||||
* tests aren't executed with -Xcomp in the CI pipeline, so let's exclude
|
||||
* the generated tests from -Xcomp execution as well.
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
|
||||
* /test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive
|
||||
* /test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/test-classes
|
||||
* @compile ../../../../../../../jdk/java/lang/invoke/MethodHandlesTest.java
|
||||
* ../../../../../../../lib/jdk/test/lib/Utils.java
|
||||
* ../../../../../../../jdk/java/lang/invoke/MethodHandlesPermuteArgumentsTest.java
|
||||
* ../../../../../../../jdk/java/lang/invoke/remote/RemoteExample.java
|
||||
* ../../../../../../../jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java
|
||||
* ../test-classes/TestMHApp.java
|
||||
* @build jdk.test.whitebox.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
|
||||
* @run junit/othervm/timeout=480 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. MethodHandlesPermuteArgumentsTest
|
||||
*/
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import jdk.test.lib.Platform;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class MethodHandlesPermuteArgumentsTest extends DynamicArchiveTestBase {
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
runTest(MethodHandlesPermuteArgumentsTest::testImpl);
|
||||
}
|
||||
|
||||
private static final String classDir = System.getProperty("test.classes");
|
||||
private static final String mainClass = "TestMHApp";
|
||||
private static final String javaClassPath = System.getProperty("java.class.path");
|
||||
private static final String ps = System.getProperty("path.separator");
|
||||
private static final String testPackageName = "test.java.lang.invoke";
|
||||
private static final String testClassName = "MethodHandlesPermuteArgumentsTest";
|
||||
private static final String loggingOpts = "-Xlog:cds,cds+dynamic=debug,class+load=trace";
|
||||
private static final String lambdaLoadedFromArchive =
|
||||
".class.load. test.java.lang.invoke.MethodHandlesPermuteArgumentsTest[$][$]Lambda.*/0x.*source:.*shared.*objects.*file.*(top)";
|
||||
|
||||
static void checkError(OutputAnalyzer output) throws Exception {
|
||||
if (testClassName.equals("MethodHandlesInvokersTest")) {
|
||||
output.shouldNotContain("Failed to generate LambdaForm holder classes. Was the base archive generated with an outdated classlist?");
|
||||
}
|
||||
}
|
||||
|
||||
static void testImpl() throws Exception {
|
||||
String topArchiveName = getNewArchiveName();
|
||||
String appJar = JarBuilder.build("MH", new File(classDir), null);
|
||||
// Disable VerifyDpendencies when running with debug build because
|
||||
// the test requires a lot more time to execute with the option enabled.
|
||||
String verifyOpt =
|
||||
Platform.isDebugBuild() ? "-XX:-VerifyDependencies" : "-showversion";
|
||||
|
||||
String junitJar = Path.of(Test.class.getProtectionDomain().getCodeSource().getLocation().toURI()).toString();
|
||||
String jars = appJar + ps + junitJar;
|
||||
String className = testPackageName + "." + testClassName;
|
||||
|
||||
dump(topArchiveName, loggingOpts, "-cp", jars, verifyOpt, mainClass, className)
|
||||
.assertNormalExit(output -> checkError(output))
|
||||
.assertNormalExit(output -> {
|
||||
output.shouldContain("Written dynamic archive 0x");
|
||||
});
|
||||
|
||||
run(topArchiveName, loggingOpts, "-cp", jars, verifyOpt, mainClass, className)
|
||||
.assertNormalExit(output -> {
|
||||
output.shouldMatch(lambdaLoadedFromArchive)
|
||||
.shouldHaveExitValue(0);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
@ -1,101 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 2024, 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.
|
||||
*
|
||||
*/
|
||||
// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually.
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary Run the MethodHandlesSpreadArgumentsTest.java test in dynamic CDS archive mode.
|
||||
* @requires vm.cds & vm.compMode != "Xcomp"
|
||||
* @comment Some of the tests run excessively slowly with -Xcomp. The original
|
||||
* tests aren't executed with -Xcomp in the CI pipeline, so let's exclude
|
||||
* the generated tests from -Xcomp execution as well.
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
|
||||
* /test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive
|
||||
* /test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/test-classes
|
||||
* @compile ../../../../../../../jdk/java/lang/invoke/MethodHandlesTest.java
|
||||
* ../../../../../../../lib/jdk/test/lib/Utils.java
|
||||
* ../../../../../../../jdk/java/lang/invoke/MethodHandlesSpreadArgumentsTest.java
|
||||
* ../../../../../../../jdk/java/lang/invoke/remote/RemoteExample.java
|
||||
* ../../../../../../../jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java
|
||||
* ../test-classes/TestMHApp.java
|
||||
* @build jdk.test.whitebox.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
|
||||
* @run junit/othervm/timeout=480 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. MethodHandlesSpreadArgumentsTest
|
||||
*/
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import jdk.test.lib.Platform;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class MethodHandlesSpreadArgumentsTest extends DynamicArchiveTestBase {
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
runTest(MethodHandlesSpreadArgumentsTest::testImpl);
|
||||
}
|
||||
|
||||
private static final String classDir = System.getProperty("test.classes");
|
||||
private static final String mainClass = "TestMHApp";
|
||||
private static final String javaClassPath = System.getProperty("java.class.path");
|
||||
private static final String ps = System.getProperty("path.separator");
|
||||
private static final String testPackageName = "test.java.lang.invoke";
|
||||
private static final String testClassName = "MethodHandlesSpreadArgumentsTest";
|
||||
private static final String loggingOpts = "-Xlog:cds,cds+dynamic=debug,class+load=trace";
|
||||
private static final String lambdaLoadedFromArchive =
|
||||
".class.load. test.java.lang.invoke.MethodHandlesSpreadArgumentsTest[$][$]Lambda.*/0x.*source:.*shared.*objects.*file.*(top)";
|
||||
|
||||
static void checkError(OutputAnalyzer output) throws Exception {
|
||||
if (testClassName.equals("MethodHandlesInvokersTest")) {
|
||||
output.shouldNotContain("Failed to generate LambdaForm holder classes. Was the base archive generated with an outdated classlist?");
|
||||
}
|
||||
}
|
||||
|
||||
static void testImpl() throws Exception {
|
||||
String topArchiveName = getNewArchiveName();
|
||||
String appJar = JarBuilder.build("MH", new File(classDir), null);
|
||||
// Disable VerifyDpendencies when running with debug build because
|
||||
// the test requires a lot more time to execute with the option enabled.
|
||||
String verifyOpt =
|
||||
Platform.isDebugBuild() ? "-XX:-VerifyDependencies" : "-showversion";
|
||||
|
||||
String junitJar = Path.of(Test.class.getProtectionDomain().getCodeSource().getLocation().toURI()).toString();
|
||||
String jars = appJar + ps + junitJar;
|
||||
String className = testPackageName + "." + testClassName;
|
||||
|
||||
dump(topArchiveName, loggingOpts, "-cp", jars, verifyOpt, mainClass, className)
|
||||
.assertNormalExit(output -> checkError(output))
|
||||
.assertNormalExit(output -> {
|
||||
output.shouldContain("Written dynamic archive 0x");
|
||||
});
|
||||
|
||||
run(topArchiveName, loggingOpts, "-cp", jars, verifyOpt, mainClass, className)
|
||||
.assertNormalExit(output -> {
|
||||
output.shouldMatch(lambdaLoadedFromArchive)
|
||||
.shouldHaveExitValue(0);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2020, 2025, 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
|
||||
@ -21,17 +21,23 @@
|
||||
# questions.
|
||||
#
|
||||
|
||||
echo "// --- start auto-generated"
|
||||
testnames=
|
||||
|
||||
testnames="$testnames MethodHandlesAsCollectorTest"
|
||||
testnames="$testnames MethodHandlesCastFailureTest"
|
||||
testnames="$testnames MethodHandlesGeneralTest"
|
||||
testnames="$testnames MethodHandlesInvokersTest"
|
||||
testnames="$testnames MethodHandlesPermuteArgumentsTest"
|
||||
testnames="$testnames MethodHandlesSpreadArgumentsTest"
|
||||
|
||||
testnames=( MethodHandlesGeneralTest MethodHandlesAsCollectorTest MethodHandlesCastFailureTest MethodHandlesInvokersTest MethodHandlesPermuteArgumentsTest MethodHandlesSpreadArgumentsTest )
|
||||
name_suffix='.java'
|
||||
|
||||
for i in "${testnames[@]}"
|
||||
for i in ${testnames}
|
||||
do
|
||||
fname="$i$name_suffix"
|
||||
cat << EOF > $fname
|
||||
/*
|
||||
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2025, 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
|
||||
@ -55,88 +61,63 @@ do
|
||||
*/
|
||||
// this file is auto-generated by $0. Do not edit manually.
|
||||
|
||||
EOF
|
||||
|
||||
for w in AOT DYNAMIC STATIC; do
|
||||
id=$(echo "$w" | awk '{print tolower($0)}')
|
||||
|
||||
cat << EOF >> $fname
|
||||
/*
|
||||
* @test
|
||||
* @summary Run the $fname test in static CDS archive mode.
|
||||
* @test id=$id
|
||||
* @summary Run the $fname test in CDSAppTester::$w workflow.
|
||||
* @requires vm.cds & vm.compMode != "Xcomp"
|
||||
EOF
|
||||
|
||||
if test "$w" == "AOT"; then
|
||||
cat << EOF >> $fname
|
||||
* @requires vm.cds.supports.aot.class.linking
|
||||
* @comment work around JDK-8345635
|
||||
* @requires !vm.jvmci.enabled
|
||||
EOF
|
||||
fi
|
||||
|
||||
cat << EOF >> $fname
|
||||
* @comment Some of the tests run excessively slowly with -Xcomp. The original
|
||||
* tests aren't executed with -Xcomp in the CI pipeline, so let's exclude
|
||||
* the generated tests from -Xcomp execution as well.
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
|
||||
* /test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/test-classes
|
||||
* @compile ../../../../../../jdk/java/lang/invoke/MethodHandlesTest.java
|
||||
* ../../../../../../lib/jdk/test/lib/Utils.java
|
||||
* ../../../../../../jdk/java/lang/invoke/$fname
|
||||
* ../../../../../../jdk/java/lang/invoke/remote/RemoteExample.java
|
||||
* ../../../../../../jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java
|
||||
* ../dynamicArchive/test-classes/TestMHApp.java
|
||||
EOF
|
||||
|
||||
if test "$w" == "DYNAMIC"; then
|
||||
|
||||
cat << EOF >> $fname
|
||||
* @build jdk.test.whitebox.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
|
||||
* @run junit/othervm/timeout=480 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. $i
|
||||
* @run junit/othervm/timeout=480 -Dcds.app.tester.workflow=$w -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. $i
|
||||
*/
|
||||
EOF
|
||||
else
|
||||
cat << EOF >> $fname
|
||||
* @run junit/othervm/timeout=480 -Dcds.app.tester.workflow=$w $i
|
||||
*/
|
||||
EOF
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
cat << EOF >> $fname
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import jdk.test.lib.cds.CDSOptions;
|
||||
import jdk.test.lib.cds.CDSTestUtils;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.Platform;
|
||||
|
||||
public class $i {
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
testImpl();
|
||||
}
|
||||
|
||||
private static final String classDir = System.getProperty("test.classes");
|
||||
private static final String mainClass = "TestMHApp";
|
||||
private static final String javaClassPath = System.getProperty("java.class.path");
|
||||
private static final String ps = System.getProperty("path.separator");
|
||||
private static final String testPackageName = "test.java.lang.invoke";
|
||||
private static final String testClassName = "$i";
|
||||
|
||||
static void testImpl() throws Exception {
|
||||
String appJar = JarBuilder.build("MH", new File(classDir), null);
|
||||
String classList = testClassName + ".list";
|
||||
String archiveName = testClassName + ".jsa";
|
||||
// Disable VerifyDpendencies when running with debug build because
|
||||
// the test requires a lot more time to execute with the option enabled.
|
||||
String verifyOpt =
|
||||
Platform.isDebugBuild() ? "-XX:-VerifyDependencies" : "-showversion";
|
||||
|
||||
String junitJar = Path.of(Test.class.getProtectionDomain().getCodeSource().getLocation().toURI()).toString();
|
||||
|
||||
String jars = appJar + ps + junitJar;
|
||||
|
||||
// dump class list
|
||||
CDSTestUtils.dumpClassList(classList, "-cp", jars, verifyOpt, mainClass,
|
||||
testPackageName + "." + testClassName);
|
||||
|
||||
// create archive with the class list
|
||||
CDSOptions opts = (new CDSOptions())
|
||||
.addPrefix("-XX:ExtraSharedClassListFile=" + classList,
|
||||
"-cp", jars,
|
||||
"-Xlog:class+load,cds")
|
||||
.setArchiveName(archiveName);
|
||||
OutputAnalyzer output = CDSTestUtils.createArchiveAndCheck(opts);
|
||||
if (testClassName.equals("MethodHandlesInvokersTest")) {
|
||||
output.shouldNotContain("Failed to generate LambdaForm holder classes. Is your classlist out of date?");
|
||||
}
|
||||
|
||||
// run with archive
|
||||
CDSOptions runOpts = (new CDSOptions())
|
||||
.addPrefix("-cp", jars, "-Xlog:class+load,cds=debug", verifyOpt)
|
||||
.setArchiveName(archiveName)
|
||||
.setUseVersion(false)
|
||||
.addSuffix(mainClass, testPackageName + "." + testClassName);
|
||||
output = CDSTestUtils.runWithArchive(runOpts);
|
||||
output.shouldMatch(".class.load. test.java.lang.invoke.$i[$][$]Lambda.*/0x.*source:.*shared.*objects.*file")
|
||||
.shouldHaveExitValue(0);
|
||||
JDKMethodHandlesTestRunner.test($i.class.getName());
|
||||
}
|
||||
}
|
||||
EOF
|
||||
done
|
||||
echo "// --- end auto-generated"
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2025, 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
|
||||
@ -25,11 +25,84 @@
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TestMHApp {
|
||||
import jdk.test.lib.cds.CDSAppTester;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.Platform;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
// This class is for running the ../../../../../../jdk/java/lang/invoke/MethodHandles*java tests
|
||||
// using CDSAppTester
|
||||
public class JDKMethodHandlesTestRunner {
|
||||
private static final String classDir = System.getProperty("test.classes");
|
||||
private static final String mainClass = "TestMHApp";
|
||||
private static final String javaClassPath = System.getProperty("java.class.path");
|
||||
private static final String ps = System.getProperty("path.separator");
|
||||
private static final String testPackageName = "test.java.lang.invoke";
|
||||
|
||||
public static void test(String testClassName) throws Exception {
|
||||
String appJar = JarBuilder.build("MH", new File(classDir), null);
|
||||
String classList = testClassName + ".list";
|
||||
String archiveName = testClassName + ".jsa";
|
||||
// Disable VerifyDpendencies when running with debug build because
|
||||
// the test requires a lot more time to execute with the option enabled.
|
||||
String verifyOpt =
|
||||
Platform.isDebugBuild() ? "-XX:-VerifyDependencies" : "-showversion";
|
||||
|
||||
String junitJar = Path.of(Test.class.getProtectionDomain().getCodeSource().getLocation().toURI()).toString();
|
||||
|
||||
String jars = appJar + ps + junitJar;
|
||||
|
||||
CDSAppTester tester = new CDSAppTester(testClassName) {
|
||||
@Override
|
||||
public String classpath(RunMode runMode) {
|
||||
return jars;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] vmArgs(RunMode runMode) {
|
||||
if (runMode.isProductionRun()) {
|
||||
return new String[] {
|
||||
"-Xlog:class+load,cds=debug",
|
||||
verifyOpt,
|
||||
};
|
||||
} else {
|
||||
return new String[] {
|
||||
verifyOpt,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] appCommandLine(RunMode runMode) {
|
||||
return new String[] {
|
||||
mainClass,
|
||||
testPackageName + "." + testClassName,
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkExecution(OutputAnalyzer out, RunMode runMode) throws Exception {
|
||||
out.shouldHaveExitValue(0);
|
||||
if (runMode.isProductionRun()) {
|
||||
out.shouldMatch(".class.load. test.java.lang.invoke." + testClassName +
|
||||
"[$][$]Lambda.*/0x.*source:.*shared.*objects.*file");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
String workflow = System.getProperty("cds.app.tester.workflow");
|
||||
tester.run(workflow);
|
||||
}
|
||||
}
|
||||
|
||||
class TestMHApp {
|
||||
public static void main(String args[]) throws Exception {
|
||||
try {
|
||||
Class<?> testClass = Class.forName(args[0]);
|
||||
@ -37,7 +110,6 @@ public class TestMHApp {
|
||||
Object obj = testClass.newInstance();
|
||||
final List<Method> allMethods = new ArrayList<Method>(Arrays.asList(testClass.getDeclaredMethods()));
|
||||
for (final Method method : allMethods) {
|
||||
//System.out.println(method.toString());
|
||||
method.setAccessible(true);
|
||||
Annotation[] annotations = null;
|
||||
try {
|
||||
@ -63,7 +135,6 @@ public class TestMHApp {
|
||||
System.out.println(iae.getCause());
|
||||
} catch (InvocationTargetException ite) {
|
||||
System.out.println("Got InvocationTargetException!!!");
|
||||
//System.out.println(ite.getCause());
|
||||
throw ite;
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2025, 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
|
||||
@ -24,84 +24,60 @@
|
||||
// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually.
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary Run the MethodHandlesAsCollectorTest.java test in static CDS archive mode.
|
||||
* @test id=aot
|
||||
* @summary Run the MethodHandlesAsCollectorTest.java test in CDSAppTester::AOT workflow.
|
||||
* @requires vm.cds & vm.compMode != "Xcomp"
|
||||
* @requires vm.cds.supports.aot.class.linking
|
||||
* @comment work around JDK-8345635
|
||||
* @requires !vm.jvmci.enabled
|
||||
* @comment Some of the tests run excessively slowly with -Xcomp. The original
|
||||
* tests aren't executed with -Xcomp in the CI pipeline, so let's exclude
|
||||
* the generated tests from -Xcomp execution as well.
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
|
||||
* @compile ../../../../../../jdk/java/lang/invoke/MethodHandlesTest.java
|
||||
* ../../../../../../lib/jdk/test/lib/Utils.java
|
||||
* ../../../../../../jdk/java/lang/invoke/MethodHandlesAsCollectorTest.java
|
||||
* ../../../../../../jdk/java/lang/invoke/remote/RemoteExample.java
|
||||
* ../../../../../../jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java
|
||||
* @run junit/othervm/timeout=480 -Dcds.app.tester.workflow=AOT MethodHandlesAsCollectorTest
|
||||
*/
|
||||
/*
|
||||
* @test id=dynamic
|
||||
* @summary Run the MethodHandlesAsCollectorTest.java test in CDSAppTester::DYNAMIC workflow.
|
||||
* @requires vm.cds & vm.compMode != "Xcomp"
|
||||
* @comment Some of the tests run excessively slowly with -Xcomp. The original
|
||||
* tests aren't executed with -Xcomp in the CI pipeline, so let's exclude
|
||||
* the generated tests from -Xcomp execution as well.
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
|
||||
* /test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/test-classes
|
||||
* @compile ../../../../../../jdk/java/lang/invoke/MethodHandlesTest.java
|
||||
* ../../../../../../lib/jdk/test/lib/Utils.java
|
||||
* ../../../../../../jdk/java/lang/invoke/MethodHandlesAsCollectorTest.java
|
||||
* ../../../../../../jdk/java/lang/invoke/remote/RemoteExample.java
|
||||
* ../../../../../../jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java
|
||||
* ../dynamicArchive/test-classes/TestMHApp.java
|
||||
* @build jdk.test.whitebox.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
|
||||
* @run junit/othervm/timeout=480 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. MethodHandlesAsCollectorTest
|
||||
* @run junit/othervm/timeout=480 -Dcds.app.tester.workflow=DYNAMIC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. MethodHandlesAsCollectorTest
|
||||
*/
|
||||
/*
|
||||
* @test id=static
|
||||
* @summary Run the MethodHandlesAsCollectorTest.java test in CDSAppTester::STATIC workflow.
|
||||
* @requires vm.cds & vm.compMode != "Xcomp"
|
||||
* @comment Some of the tests run excessively slowly with -Xcomp. The original
|
||||
* tests aren't executed with -Xcomp in the CI pipeline, so let's exclude
|
||||
* the generated tests from -Xcomp execution as well.
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
|
||||
* @compile ../../../../../../jdk/java/lang/invoke/MethodHandlesTest.java
|
||||
* ../../../../../../lib/jdk/test/lib/Utils.java
|
||||
* ../../../../../../jdk/java/lang/invoke/MethodHandlesAsCollectorTest.java
|
||||
* ../../../../../../jdk/java/lang/invoke/remote/RemoteExample.java
|
||||
* ../../../../../../jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java
|
||||
* @run junit/othervm/timeout=480 -Dcds.app.tester.workflow=STATIC MethodHandlesAsCollectorTest
|
||||
*/
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import jdk.test.lib.cds.CDSOptions;
|
||||
import jdk.test.lib.cds.CDSTestUtils;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.Platform;
|
||||
|
||||
public class MethodHandlesAsCollectorTest {
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
testImpl();
|
||||
}
|
||||
|
||||
private static final String classDir = System.getProperty("test.classes");
|
||||
private static final String mainClass = "TestMHApp";
|
||||
private static final String javaClassPath = System.getProperty("java.class.path");
|
||||
private static final String ps = System.getProperty("path.separator");
|
||||
private static final String testPackageName = "test.java.lang.invoke";
|
||||
private static final String testClassName = "MethodHandlesAsCollectorTest";
|
||||
|
||||
static void testImpl() throws Exception {
|
||||
String appJar = JarBuilder.build("MH", new File(classDir), null);
|
||||
String classList = testClassName + ".list";
|
||||
String archiveName = testClassName + ".jsa";
|
||||
// Disable VerifyDpendencies when running with debug build because
|
||||
// the test requires a lot more time to execute with the option enabled.
|
||||
String verifyOpt =
|
||||
Platform.isDebugBuild() ? "-XX:-VerifyDependencies" : "-showversion";
|
||||
|
||||
String junitJar = Path.of(Test.class.getProtectionDomain().getCodeSource().getLocation().toURI()).toString();
|
||||
|
||||
String jars = appJar + ps + junitJar;
|
||||
|
||||
// dump class list
|
||||
CDSTestUtils.dumpClassList(classList, "-cp", jars, verifyOpt, mainClass,
|
||||
testPackageName + "." + testClassName);
|
||||
|
||||
// create archive with the class list
|
||||
CDSOptions opts = (new CDSOptions())
|
||||
.addPrefix("-XX:ExtraSharedClassListFile=" + classList,
|
||||
"-cp", jars,
|
||||
"-Xlog:class+load,cds")
|
||||
.setArchiveName(archiveName);
|
||||
OutputAnalyzer output = CDSTestUtils.createArchiveAndCheck(opts);
|
||||
if (testClassName.equals("MethodHandlesInvokersTest")) {
|
||||
output.shouldNotContain("Failed to generate LambdaForm holder classes. Is your classlist out of date?");
|
||||
}
|
||||
|
||||
// run with archive
|
||||
CDSOptions runOpts = (new CDSOptions())
|
||||
.addPrefix("-cp", jars, "-Xlog:class+load,cds=debug", verifyOpt)
|
||||
.setArchiveName(archiveName)
|
||||
.setUseVersion(false)
|
||||
.addSuffix(mainClass, testPackageName + "." + testClassName);
|
||||
output = CDSTestUtils.runWithArchive(runOpts);
|
||||
output.shouldMatch(".class.load. test.java.lang.invoke.MethodHandlesAsCollectorTest[$][$]Lambda.*/0x.*source:.*shared.*objects.*file")
|
||||
.shouldHaveExitValue(0);
|
||||
JDKMethodHandlesTestRunner.test(MethodHandlesAsCollectorTest.class.getName());
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2025, 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
|
||||
@ -24,84 +24,60 @@
|
||||
// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually.
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary Run the MethodHandlesCastFailureTest.java test in static CDS archive mode.
|
||||
* @test id=aot
|
||||
* @summary Run the MethodHandlesCastFailureTest.java test in CDSAppTester::AOT workflow.
|
||||
* @requires vm.cds & vm.compMode != "Xcomp"
|
||||
* @requires vm.cds.supports.aot.class.linking
|
||||
* @comment work around JDK-8345635
|
||||
* @requires !vm.jvmci.enabled
|
||||
* @comment Some of the tests run excessively slowly with -Xcomp. The original
|
||||
* tests aren't executed with -Xcomp in the CI pipeline, so let's exclude
|
||||
* the generated tests from -Xcomp execution as well.
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
|
||||
* @compile ../../../../../../jdk/java/lang/invoke/MethodHandlesTest.java
|
||||
* ../../../../../../lib/jdk/test/lib/Utils.java
|
||||
* ../../../../../../jdk/java/lang/invoke/MethodHandlesCastFailureTest.java
|
||||
* ../../../../../../jdk/java/lang/invoke/remote/RemoteExample.java
|
||||
* ../../../../../../jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java
|
||||
* @run junit/othervm/timeout=480 -Dcds.app.tester.workflow=AOT MethodHandlesCastFailureTest
|
||||
*/
|
||||
/*
|
||||
* @test id=dynamic
|
||||
* @summary Run the MethodHandlesCastFailureTest.java test in CDSAppTester::DYNAMIC workflow.
|
||||
* @requires vm.cds & vm.compMode != "Xcomp"
|
||||
* @comment Some of the tests run excessively slowly with -Xcomp. The original
|
||||
* tests aren't executed with -Xcomp in the CI pipeline, so let's exclude
|
||||
* the generated tests from -Xcomp execution as well.
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
|
||||
* /test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/test-classes
|
||||
* @compile ../../../../../../jdk/java/lang/invoke/MethodHandlesTest.java
|
||||
* ../../../../../../lib/jdk/test/lib/Utils.java
|
||||
* ../../../../../../jdk/java/lang/invoke/MethodHandlesCastFailureTest.java
|
||||
* ../../../../../../jdk/java/lang/invoke/remote/RemoteExample.java
|
||||
* ../../../../../../jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java
|
||||
* ../dynamicArchive/test-classes/TestMHApp.java
|
||||
* @build jdk.test.whitebox.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
|
||||
* @run junit/othervm/timeout=480 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. MethodHandlesCastFailureTest
|
||||
* @run junit/othervm/timeout=480 -Dcds.app.tester.workflow=DYNAMIC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. MethodHandlesCastFailureTest
|
||||
*/
|
||||
/*
|
||||
* @test id=static
|
||||
* @summary Run the MethodHandlesCastFailureTest.java test in CDSAppTester::STATIC workflow.
|
||||
* @requires vm.cds & vm.compMode != "Xcomp"
|
||||
* @comment Some of the tests run excessively slowly with -Xcomp. The original
|
||||
* tests aren't executed with -Xcomp in the CI pipeline, so let's exclude
|
||||
* the generated tests from -Xcomp execution as well.
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
|
||||
* @compile ../../../../../../jdk/java/lang/invoke/MethodHandlesTest.java
|
||||
* ../../../../../../lib/jdk/test/lib/Utils.java
|
||||
* ../../../../../../jdk/java/lang/invoke/MethodHandlesCastFailureTest.java
|
||||
* ../../../../../../jdk/java/lang/invoke/remote/RemoteExample.java
|
||||
* ../../../../../../jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java
|
||||
* @run junit/othervm/timeout=480 -Dcds.app.tester.workflow=STATIC MethodHandlesCastFailureTest
|
||||
*/
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import jdk.test.lib.cds.CDSOptions;
|
||||
import jdk.test.lib.cds.CDSTestUtils;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.Platform;
|
||||
|
||||
public class MethodHandlesCastFailureTest {
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
testImpl();
|
||||
}
|
||||
|
||||
private static final String classDir = System.getProperty("test.classes");
|
||||
private static final String mainClass = "TestMHApp";
|
||||
private static final String javaClassPath = System.getProperty("java.class.path");
|
||||
private static final String ps = System.getProperty("path.separator");
|
||||
private static final String testPackageName = "test.java.lang.invoke";
|
||||
private static final String testClassName = "MethodHandlesCastFailureTest";
|
||||
|
||||
static void testImpl() throws Exception {
|
||||
String appJar = JarBuilder.build("MH", new File(classDir), null);
|
||||
String classList = testClassName + ".list";
|
||||
String archiveName = testClassName + ".jsa";
|
||||
// Disable VerifyDpendencies when running with debug build because
|
||||
// the test requires a lot more time to execute with the option enabled.
|
||||
String verifyOpt =
|
||||
Platform.isDebugBuild() ? "-XX:-VerifyDependencies" : "-showversion";
|
||||
|
||||
String junitJar = Path.of(Test.class.getProtectionDomain().getCodeSource().getLocation().toURI()).toString();
|
||||
|
||||
String jars = appJar + ps + junitJar;
|
||||
|
||||
// dump class list
|
||||
CDSTestUtils.dumpClassList(classList, "-cp", jars, verifyOpt, mainClass,
|
||||
testPackageName + "." + testClassName);
|
||||
|
||||
// create archive with the class list
|
||||
CDSOptions opts = (new CDSOptions())
|
||||
.addPrefix("-XX:ExtraSharedClassListFile=" + classList,
|
||||
"-cp", jars,
|
||||
"-Xlog:class+load,cds")
|
||||
.setArchiveName(archiveName);
|
||||
OutputAnalyzer output = CDSTestUtils.createArchiveAndCheck(opts);
|
||||
if (testClassName.equals("MethodHandlesInvokersTest")) {
|
||||
output.shouldNotContain("Failed to generate LambdaForm holder classes. Is your classlist out of date?");
|
||||
}
|
||||
|
||||
// run with archive
|
||||
CDSOptions runOpts = (new CDSOptions())
|
||||
.addPrefix("-cp", jars, "-Xlog:class+load,cds=debug", verifyOpt)
|
||||
.setArchiveName(archiveName)
|
||||
.setUseVersion(false)
|
||||
.addSuffix(mainClass, testPackageName + "." + testClassName);
|
||||
output = CDSTestUtils.runWithArchive(runOpts);
|
||||
output.shouldMatch(".class.load. test.java.lang.invoke.MethodHandlesCastFailureTest[$][$]Lambda.*/0x.*source:.*shared.*objects.*file")
|
||||
.shouldHaveExitValue(0);
|
||||
JDKMethodHandlesTestRunner.test(MethodHandlesCastFailureTest.class.getName());
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2025, 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
|
||||
@ -24,84 +24,60 @@
|
||||
// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually.
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary Run the MethodHandlesGeneralTest.java test in static CDS archive mode.
|
||||
* @test id=aot
|
||||
* @summary Run the MethodHandlesGeneralTest.java test in CDSAppTester::AOT workflow.
|
||||
* @requires vm.cds & vm.compMode != "Xcomp"
|
||||
* @requires vm.cds.supports.aot.class.linking
|
||||
* @comment work around JDK-8345635
|
||||
* @requires !vm.jvmci.enabled
|
||||
* @comment Some of the tests run excessively slowly with -Xcomp. The original
|
||||
* tests aren't executed with -Xcomp in the CI pipeline, so let's exclude
|
||||
* the generated tests from -Xcomp execution as well.
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
|
||||
* @compile ../../../../../../jdk/java/lang/invoke/MethodHandlesTest.java
|
||||
* ../../../../../../lib/jdk/test/lib/Utils.java
|
||||
* ../../../../../../jdk/java/lang/invoke/MethodHandlesGeneralTest.java
|
||||
* ../../../../../../jdk/java/lang/invoke/remote/RemoteExample.java
|
||||
* ../../../../../../jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java
|
||||
* @run junit/othervm/timeout=480 -Dcds.app.tester.workflow=AOT MethodHandlesGeneralTest
|
||||
*/
|
||||
/*
|
||||
* @test id=dynamic
|
||||
* @summary Run the MethodHandlesGeneralTest.java test in CDSAppTester::DYNAMIC workflow.
|
||||
* @requires vm.cds & vm.compMode != "Xcomp"
|
||||
* @comment Some of the tests run excessively slowly with -Xcomp. The original
|
||||
* tests aren't executed with -Xcomp in the CI pipeline, so let's exclude
|
||||
* the generated tests from -Xcomp execution as well.
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
|
||||
* /test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/test-classes
|
||||
* @compile ../../../../../../jdk/java/lang/invoke/MethodHandlesTest.java
|
||||
* ../../../../../../lib/jdk/test/lib/Utils.java
|
||||
* ../../../../../../jdk/java/lang/invoke/MethodHandlesGeneralTest.java
|
||||
* ../../../../../../jdk/java/lang/invoke/remote/RemoteExample.java
|
||||
* ../../../../../../jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java
|
||||
* ../dynamicArchive/test-classes/TestMHApp.java
|
||||
* @build jdk.test.whitebox.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
|
||||
* @run junit/othervm/timeout=480 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. MethodHandlesGeneralTest
|
||||
* @run junit/othervm/timeout=480 -Dcds.app.tester.workflow=DYNAMIC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. MethodHandlesGeneralTest
|
||||
*/
|
||||
/*
|
||||
* @test id=static
|
||||
* @summary Run the MethodHandlesGeneralTest.java test in CDSAppTester::STATIC workflow.
|
||||
* @requires vm.cds & vm.compMode != "Xcomp"
|
||||
* @comment Some of the tests run excessively slowly with -Xcomp. The original
|
||||
* tests aren't executed with -Xcomp in the CI pipeline, so let's exclude
|
||||
* the generated tests from -Xcomp execution as well.
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
|
||||
* @compile ../../../../../../jdk/java/lang/invoke/MethodHandlesTest.java
|
||||
* ../../../../../../lib/jdk/test/lib/Utils.java
|
||||
* ../../../../../../jdk/java/lang/invoke/MethodHandlesGeneralTest.java
|
||||
* ../../../../../../jdk/java/lang/invoke/remote/RemoteExample.java
|
||||
* ../../../../../../jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java
|
||||
* @run junit/othervm/timeout=480 -Dcds.app.tester.workflow=STATIC MethodHandlesGeneralTest
|
||||
*/
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import jdk.test.lib.cds.CDSOptions;
|
||||
import jdk.test.lib.cds.CDSTestUtils;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.Platform;
|
||||
|
||||
public class MethodHandlesGeneralTest {
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
testImpl();
|
||||
}
|
||||
|
||||
private static final String classDir = System.getProperty("test.classes");
|
||||
private static final String mainClass = "TestMHApp";
|
||||
private static final String javaClassPath = System.getProperty("java.class.path");
|
||||
private static final String ps = System.getProperty("path.separator");
|
||||
private static final String testPackageName = "test.java.lang.invoke";
|
||||
private static final String testClassName = "MethodHandlesGeneralTest";
|
||||
|
||||
static void testImpl() throws Exception {
|
||||
String appJar = JarBuilder.build("MH", new File(classDir), null);
|
||||
String classList = testClassName + ".list";
|
||||
String archiveName = testClassName + ".jsa";
|
||||
// Disable VerifyDpendencies when running with debug build because
|
||||
// the test requires a lot more time to execute with the option enabled.
|
||||
String verifyOpt =
|
||||
Platform.isDebugBuild() ? "-XX:-VerifyDependencies" : "-showversion";
|
||||
|
||||
String junitJar = Path.of(Test.class.getProtectionDomain().getCodeSource().getLocation().toURI()).toString();
|
||||
|
||||
String jars = appJar + ps + junitJar;
|
||||
|
||||
// dump class list
|
||||
CDSTestUtils.dumpClassList(classList, "-cp", jars, verifyOpt, mainClass,
|
||||
testPackageName + "." + testClassName);
|
||||
|
||||
// create archive with the class list
|
||||
CDSOptions opts = (new CDSOptions())
|
||||
.addPrefix("-XX:ExtraSharedClassListFile=" + classList,
|
||||
"-cp", jars,
|
||||
"-Xlog:class+load,cds")
|
||||
.setArchiveName(archiveName);
|
||||
OutputAnalyzer output = CDSTestUtils.createArchiveAndCheck(opts);
|
||||
if (testClassName.equals("MethodHandlesInvokersTest")) {
|
||||
output.shouldNotContain("Failed to generate LambdaForm holder classes. Is your classlist out of date?");
|
||||
}
|
||||
|
||||
// run with archive
|
||||
CDSOptions runOpts = (new CDSOptions())
|
||||
.addPrefix("-cp", jars, "-Xlog:class+load,cds=debug", verifyOpt)
|
||||
.setArchiveName(archiveName)
|
||||
.setUseVersion(false)
|
||||
.addSuffix(mainClass, testPackageName + "." + testClassName);
|
||||
output = CDSTestUtils.runWithArchive(runOpts);
|
||||
output.shouldMatch(".class.load. test.java.lang.invoke.MethodHandlesGeneralTest[$][$]Lambda.*/0x.*source:.*shared.*objects.*file")
|
||||
.shouldHaveExitValue(0);
|
||||
JDKMethodHandlesTestRunner.test(MethodHandlesGeneralTest.class.getName());
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2025, 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
|
||||
@ -24,84 +24,60 @@
|
||||
// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually.
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary Run the MethodHandlesInvokersTest.java test in static CDS archive mode.
|
||||
* @test id=aot
|
||||
* @summary Run the MethodHandlesInvokersTest.java test in CDSAppTester::AOT workflow.
|
||||
* @requires vm.cds & vm.compMode != "Xcomp"
|
||||
* @requires vm.cds.supports.aot.class.linking
|
||||
* @comment work around JDK-8345635
|
||||
* @requires !vm.jvmci.enabled
|
||||
* @comment Some of the tests run excessively slowly with -Xcomp. The original
|
||||
* tests aren't executed with -Xcomp in the CI pipeline, so let's exclude
|
||||
* the generated tests from -Xcomp execution as well.
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
|
||||
* @compile ../../../../../../jdk/java/lang/invoke/MethodHandlesTest.java
|
||||
* ../../../../../../lib/jdk/test/lib/Utils.java
|
||||
* ../../../../../../jdk/java/lang/invoke/MethodHandlesInvokersTest.java
|
||||
* ../../../../../../jdk/java/lang/invoke/remote/RemoteExample.java
|
||||
* ../../../../../../jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java
|
||||
* @run junit/othervm/timeout=480 -Dcds.app.tester.workflow=AOT MethodHandlesInvokersTest
|
||||
*/
|
||||
/*
|
||||
* @test id=dynamic
|
||||
* @summary Run the MethodHandlesInvokersTest.java test in CDSAppTester::DYNAMIC workflow.
|
||||
* @requires vm.cds & vm.compMode != "Xcomp"
|
||||
* @comment Some of the tests run excessively slowly with -Xcomp. The original
|
||||
* tests aren't executed with -Xcomp in the CI pipeline, so let's exclude
|
||||
* the generated tests from -Xcomp execution as well.
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
|
||||
* /test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/test-classes
|
||||
* @compile ../../../../../../jdk/java/lang/invoke/MethodHandlesTest.java
|
||||
* ../../../../../../lib/jdk/test/lib/Utils.java
|
||||
* ../../../../../../jdk/java/lang/invoke/MethodHandlesInvokersTest.java
|
||||
* ../../../../../../jdk/java/lang/invoke/remote/RemoteExample.java
|
||||
* ../../../../../../jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java
|
||||
* ../dynamicArchive/test-classes/TestMHApp.java
|
||||
* @build jdk.test.whitebox.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
|
||||
* @run junit/othervm/timeout=480 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. MethodHandlesInvokersTest
|
||||
* @run junit/othervm/timeout=480 -Dcds.app.tester.workflow=DYNAMIC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. MethodHandlesInvokersTest
|
||||
*/
|
||||
/*
|
||||
* @test id=static
|
||||
* @summary Run the MethodHandlesInvokersTest.java test in CDSAppTester::STATIC workflow.
|
||||
* @requires vm.cds & vm.compMode != "Xcomp"
|
||||
* @comment Some of the tests run excessively slowly with -Xcomp. The original
|
||||
* tests aren't executed with -Xcomp in the CI pipeline, so let's exclude
|
||||
* the generated tests from -Xcomp execution as well.
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
|
||||
* @compile ../../../../../../jdk/java/lang/invoke/MethodHandlesTest.java
|
||||
* ../../../../../../lib/jdk/test/lib/Utils.java
|
||||
* ../../../../../../jdk/java/lang/invoke/MethodHandlesInvokersTest.java
|
||||
* ../../../../../../jdk/java/lang/invoke/remote/RemoteExample.java
|
||||
* ../../../../../../jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java
|
||||
* @run junit/othervm/timeout=480 -Dcds.app.tester.workflow=STATIC MethodHandlesInvokersTest
|
||||
*/
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import jdk.test.lib.cds.CDSOptions;
|
||||
import jdk.test.lib.cds.CDSTestUtils;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.Platform;
|
||||
|
||||
public class MethodHandlesInvokersTest {
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
testImpl();
|
||||
}
|
||||
|
||||
private static final String classDir = System.getProperty("test.classes");
|
||||
private static final String mainClass = "TestMHApp";
|
||||
private static final String javaClassPath = System.getProperty("java.class.path");
|
||||
private static final String ps = System.getProperty("path.separator");
|
||||
private static final String testPackageName = "test.java.lang.invoke";
|
||||
private static final String testClassName = "MethodHandlesInvokersTest";
|
||||
|
||||
static void testImpl() throws Exception {
|
||||
String appJar = JarBuilder.build("MH", new File(classDir), null);
|
||||
String classList = testClassName + ".list";
|
||||
String archiveName = testClassName + ".jsa";
|
||||
// Disable VerifyDpendencies when running with debug build because
|
||||
// the test requires a lot more time to execute with the option enabled.
|
||||
String verifyOpt =
|
||||
Platform.isDebugBuild() ? "-XX:-VerifyDependencies" : "-showversion";
|
||||
|
||||
String junitJar = Path.of(Test.class.getProtectionDomain().getCodeSource().getLocation().toURI()).toString();
|
||||
|
||||
String jars = appJar + ps + junitJar;
|
||||
|
||||
// dump class list
|
||||
CDSTestUtils.dumpClassList(classList, "-cp", jars, verifyOpt, mainClass,
|
||||
testPackageName + "." + testClassName);
|
||||
|
||||
// create archive with the class list
|
||||
CDSOptions opts = (new CDSOptions())
|
||||
.addPrefix("-XX:ExtraSharedClassListFile=" + classList,
|
||||
"-cp", jars,
|
||||
"-Xlog:class+load,cds")
|
||||
.setArchiveName(archiveName);
|
||||
OutputAnalyzer output = CDSTestUtils.createArchiveAndCheck(opts);
|
||||
if (testClassName.equals("MethodHandlesInvokersTest")) {
|
||||
output.shouldNotContain("Failed to generate LambdaForm holder classes. Is your classlist out of date?");
|
||||
}
|
||||
|
||||
// run with archive
|
||||
CDSOptions runOpts = (new CDSOptions())
|
||||
.addPrefix("-cp", jars, "-Xlog:class+load,cds=debug", verifyOpt)
|
||||
.setArchiveName(archiveName)
|
||||
.setUseVersion(false)
|
||||
.addSuffix(mainClass, testPackageName + "." + testClassName);
|
||||
output = CDSTestUtils.runWithArchive(runOpts);
|
||||
output.shouldMatch(".class.load. test.java.lang.invoke.MethodHandlesInvokersTest[$][$]Lambda.*/0x.*source:.*shared.*objects.*file")
|
||||
.shouldHaveExitValue(0);
|
||||
JDKMethodHandlesTestRunner.test(MethodHandlesInvokersTest.class.getName());
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2025, 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
|
||||
@ -24,84 +24,60 @@
|
||||
// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually.
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary Run the MethodHandlesPermuteArgumentsTest.java test in static CDS archive mode.
|
||||
* @test id=aot
|
||||
* @summary Run the MethodHandlesPermuteArgumentsTest.java test in CDSAppTester::AOT workflow.
|
||||
* @requires vm.cds & vm.compMode != "Xcomp"
|
||||
* @requires vm.cds.supports.aot.class.linking
|
||||
* @comment work around JDK-8345635
|
||||
* @requires !vm.jvmci.enabled
|
||||
* @comment Some of the tests run excessively slowly with -Xcomp. The original
|
||||
* tests aren't executed with -Xcomp in the CI pipeline, so let's exclude
|
||||
* the generated tests from -Xcomp execution as well.
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
|
||||
* @compile ../../../../../../jdk/java/lang/invoke/MethodHandlesTest.java
|
||||
* ../../../../../../lib/jdk/test/lib/Utils.java
|
||||
* ../../../../../../jdk/java/lang/invoke/MethodHandlesPermuteArgumentsTest.java
|
||||
* ../../../../../../jdk/java/lang/invoke/remote/RemoteExample.java
|
||||
* ../../../../../../jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java
|
||||
* @run junit/othervm/timeout=480 -Dcds.app.tester.workflow=AOT MethodHandlesPermuteArgumentsTest
|
||||
*/
|
||||
/*
|
||||
* @test id=dynamic
|
||||
* @summary Run the MethodHandlesPermuteArgumentsTest.java test in CDSAppTester::DYNAMIC workflow.
|
||||
* @requires vm.cds & vm.compMode != "Xcomp"
|
||||
* @comment Some of the tests run excessively slowly with -Xcomp. The original
|
||||
* tests aren't executed with -Xcomp in the CI pipeline, so let's exclude
|
||||
* the generated tests from -Xcomp execution as well.
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
|
||||
* /test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/test-classes
|
||||
* @compile ../../../../../../jdk/java/lang/invoke/MethodHandlesTest.java
|
||||
* ../../../../../../lib/jdk/test/lib/Utils.java
|
||||
* ../../../../../../jdk/java/lang/invoke/MethodHandlesPermuteArgumentsTest.java
|
||||
* ../../../../../../jdk/java/lang/invoke/remote/RemoteExample.java
|
||||
* ../../../../../../jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java
|
||||
* ../dynamicArchive/test-classes/TestMHApp.java
|
||||
* @build jdk.test.whitebox.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
|
||||
* @run junit/othervm/timeout=480 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. MethodHandlesPermuteArgumentsTest
|
||||
* @run junit/othervm/timeout=480 -Dcds.app.tester.workflow=DYNAMIC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. MethodHandlesPermuteArgumentsTest
|
||||
*/
|
||||
/*
|
||||
* @test id=static
|
||||
* @summary Run the MethodHandlesPermuteArgumentsTest.java test in CDSAppTester::STATIC workflow.
|
||||
* @requires vm.cds & vm.compMode != "Xcomp"
|
||||
* @comment Some of the tests run excessively slowly with -Xcomp. The original
|
||||
* tests aren't executed with -Xcomp in the CI pipeline, so let's exclude
|
||||
* the generated tests from -Xcomp execution as well.
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
|
||||
* @compile ../../../../../../jdk/java/lang/invoke/MethodHandlesTest.java
|
||||
* ../../../../../../lib/jdk/test/lib/Utils.java
|
||||
* ../../../../../../jdk/java/lang/invoke/MethodHandlesPermuteArgumentsTest.java
|
||||
* ../../../../../../jdk/java/lang/invoke/remote/RemoteExample.java
|
||||
* ../../../../../../jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java
|
||||
* @run junit/othervm/timeout=480 -Dcds.app.tester.workflow=STATIC MethodHandlesPermuteArgumentsTest
|
||||
*/
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import jdk.test.lib.cds.CDSOptions;
|
||||
import jdk.test.lib.cds.CDSTestUtils;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.Platform;
|
||||
|
||||
public class MethodHandlesPermuteArgumentsTest {
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
testImpl();
|
||||
}
|
||||
|
||||
private static final String classDir = System.getProperty("test.classes");
|
||||
private static final String mainClass = "TestMHApp";
|
||||
private static final String javaClassPath = System.getProperty("java.class.path");
|
||||
private static final String ps = System.getProperty("path.separator");
|
||||
private static final String testPackageName = "test.java.lang.invoke";
|
||||
private static final String testClassName = "MethodHandlesPermuteArgumentsTest";
|
||||
|
||||
static void testImpl() throws Exception {
|
||||
String appJar = JarBuilder.build("MH", new File(classDir), null);
|
||||
String classList = testClassName + ".list";
|
||||
String archiveName = testClassName + ".jsa";
|
||||
// Disable VerifyDpendencies when running with debug build because
|
||||
// the test requires a lot more time to execute with the option enabled.
|
||||
String verifyOpt =
|
||||
Platform.isDebugBuild() ? "-XX:-VerifyDependencies" : "-showversion";
|
||||
|
||||
String junitJar = Path.of(Test.class.getProtectionDomain().getCodeSource().getLocation().toURI()).toString();
|
||||
|
||||
String jars = appJar + ps + junitJar;
|
||||
|
||||
// dump class list
|
||||
CDSTestUtils.dumpClassList(classList, "-cp", jars, verifyOpt, mainClass,
|
||||
testPackageName + "." + testClassName);
|
||||
|
||||
// create archive with the class list
|
||||
CDSOptions opts = (new CDSOptions())
|
||||
.addPrefix("-XX:ExtraSharedClassListFile=" + classList,
|
||||
"-cp", jars,
|
||||
"-Xlog:class+load,cds")
|
||||
.setArchiveName(archiveName);
|
||||
OutputAnalyzer output = CDSTestUtils.createArchiveAndCheck(opts);
|
||||
if (testClassName.equals("MethodHandlesInvokersTest")) {
|
||||
output.shouldNotContain("Failed to generate LambdaForm holder classes. Is your classlist out of date?");
|
||||
}
|
||||
|
||||
// run with archive
|
||||
CDSOptions runOpts = (new CDSOptions())
|
||||
.addPrefix("-cp", jars, "-Xlog:class+load,cds=debug", verifyOpt)
|
||||
.setArchiveName(archiveName)
|
||||
.setUseVersion(false)
|
||||
.addSuffix(mainClass, testPackageName + "." + testClassName);
|
||||
output = CDSTestUtils.runWithArchive(runOpts);
|
||||
output.shouldMatch(".class.load. test.java.lang.invoke.MethodHandlesPermuteArgumentsTest[$][$]Lambda.*/0x.*source:.*shared.*objects.*file")
|
||||
.shouldHaveExitValue(0);
|
||||
JDKMethodHandlesTestRunner.test(MethodHandlesPermuteArgumentsTest.class.getName());
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2025, 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
|
||||
@ -24,84 +24,60 @@
|
||||
// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually.
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary Run the MethodHandlesSpreadArgumentsTest.java test in static CDS archive mode.
|
||||
* @test id=aot
|
||||
* @summary Run the MethodHandlesSpreadArgumentsTest.java test in CDSAppTester::AOT workflow.
|
||||
* @requires vm.cds & vm.compMode != "Xcomp"
|
||||
* @requires vm.cds.supports.aot.class.linking
|
||||
* @comment work around JDK-8345635
|
||||
* @requires !vm.jvmci.enabled
|
||||
* @comment Some of the tests run excessively slowly with -Xcomp. The original
|
||||
* tests aren't executed with -Xcomp in the CI pipeline, so let's exclude
|
||||
* the generated tests from -Xcomp execution as well.
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
|
||||
* @compile ../../../../../../jdk/java/lang/invoke/MethodHandlesTest.java
|
||||
* ../../../../../../lib/jdk/test/lib/Utils.java
|
||||
* ../../../../../../jdk/java/lang/invoke/MethodHandlesSpreadArgumentsTest.java
|
||||
* ../../../../../../jdk/java/lang/invoke/remote/RemoteExample.java
|
||||
* ../../../../../../jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java
|
||||
* @run junit/othervm/timeout=480 -Dcds.app.tester.workflow=AOT MethodHandlesSpreadArgumentsTest
|
||||
*/
|
||||
/*
|
||||
* @test id=dynamic
|
||||
* @summary Run the MethodHandlesSpreadArgumentsTest.java test in CDSAppTester::DYNAMIC workflow.
|
||||
* @requires vm.cds & vm.compMode != "Xcomp"
|
||||
* @comment Some of the tests run excessively slowly with -Xcomp. The original
|
||||
* tests aren't executed with -Xcomp in the CI pipeline, so let's exclude
|
||||
* the generated tests from -Xcomp execution as well.
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
|
||||
* /test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/test-classes
|
||||
* @compile ../../../../../../jdk/java/lang/invoke/MethodHandlesTest.java
|
||||
* ../../../../../../lib/jdk/test/lib/Utils.java
|
||||
* ../../../../../../jdk/java/lang/invoke/MethodHandlesSpreadArgumentsTest.java
|
||||
* ../../../../../../jdk/java/lang/invoke/remote/RemoteExample.java
|
||||
* ../../../../../../jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java
|
||||
* ../dynamicArchive/test-classes/TestMHApp.java
|
||||
* @build jdk.test.whitebox.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
|
||||
* @run junit/othervm/timeout=480 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. MethodHandlesSpreadArgumentsTest
|
||||
* @run junit/othervm/timeout=480 -Dcds.app.tester.workflow=DYNAMIC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. MethodHandlesSpreadArgumentsTest
|
||||
*/
|
||||
/*
|
||||
* @test id=static
|
||||
* @summary Run the MethodHandlesSpreadArgumentsTest.java test in CDSAppTester::STATIC workflow.
|
||||
* @requires vm.cds & vm.compMode != "Xcomp"
|
||||
* @comment Some of the tests run excessively slowly with -Xcomp. The original
|
||||
* tests aren't executed with -Xcomp in the CI pipeline, so let's exclude
|
||||
* the generated tests from -Xcomp execution as well.
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
|
||||
* @compile ../../../../../../jdk/java/lang/invoke/MethodHandlesTest.java
|
||||
* ../../../../../../lib/jdk/test/lib/Utils.java
|
||||
* ../../../../../../jdk/java/lang/invoke/MethodHandlesSpreadArgumentsTest.java
|
||||
* ../../../../../../jdk/java/lang/invoke/remote/RemoteExample.java
|
||||
* ../../../../../../jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java
|
||||
* @run junit/othervm/timeout=480 -Dcds.app.tester.workflow=STATIC MethodHandlesSpreadArgumentsTest
|
||||
*/
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import jdk.test.lib.cds.CDSOptions;
|
||||
import jdk.test.lib.cds.CDSTestUtils;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.Platform;
|
||||
|
||||
public class MethodHandlesSpreadArgumentsTest {
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
testImpl();
|
||||
}
|
||||
|
||||
private static final String classDir = System.getProperty("test.classes");
|
||||
private static final String mainClass = "TestMHApp";
|
||||
private static final String javaClassPath = System.getProperty("java.class.path");
|
||||
private static final String ps = System.getProperty("path.separator");
|
||||
private static final String testPackageName = "test.java.lang.invoke";
|
||||
private static final String testClassName = "MethodHandlesSpreadArgumentsTest";
|
||||
|
||||
static void testImpl() throws Exception {
|
||||
String appJar = JarBuilder.build("MH", new File(classDir), null);
|
||||
String classList = testClassName + ".list";
|
||||
String archiveName = testClassName + ".jsa";
|
||||
// Disable VerifyDpendencies when running with debug build because
|
||||
// the test requires a lot more time to execute with the option enabled.
|
||||
String verifyOpt =
|
||||
Platform.isDebugBuild() ? "-XX:-VerifyDependencies" : "-showversion";
|
||||
|
||||
String junitJar = Path.of(Test.class.getProtectionDomain().getCodeSource().getLocation().toURI()).toString();
|
||||
|
||||
String jars = appJar + ps + junitJar;
|
||||
|
||||
// dump class list
|
||||
CDSTestUtils.dumpClassList(classList, "-cp", jars, verifyOpt, mainClass,
|
||||
testPackageName + "." + testClassName);
|
||||
|
||||
// create archive with the class list
|
||||
CDSOptions opts = (new CDSOptions())
|
||||
.addPrefix("-XX:ExtraSharedClassListFile=" + classList,
|
||||
"-cp", jars,
|
||||
"-Xlog:class+load,cds")
|
||||
.setArchiveName(archiveName);
|
||||
OutputAnalyzer output = CDSTestUtils.createArchiveAndCheck(opts);
|
||||
if (testClassName.equals("MethodHandlesInvokersTest")) {
|
||||
output.shouldNotContain("Failed to generate LambdaForm holder classes. Is your classlist out of date?");
|
||||
}
|
||||
|
||||
// run with archive
|
||||
CDSOptions runOpts = (new CDSOptions())
|
||||
.addPrefix("-cp", jars, "-Xlog:class+load,cds=debug", verifyOpt)
|
||||
.setArchiveName(archiveName)
|
||||
.setUseVersion(false)
|
||||
.addSuffix(mainClass, testPackageName + "." + testClassName);
|
||||
output = CDSTestUtils.runWithArchive(runOpts);
|
||||
output.shouldMatch(".class.load. test.java.lang.invoke.MethodHandlesSpreadArgumentsTest[$][$]Lambda.*/0x.*source:.*shared.*objects.*file")
|
||||
.shouldHaveExitValue(0);
|
||||
JDKMethodHandlesTestRunner.test(MethodHandlesSpreadArgumentsTest.class.getName());
|
||||
}
|
||||
}
|
||||
|
@ -367,7 +367,7 @@ abstract public class CDSAppTester {
|
||||
return out;
|
||||
}
|
||||
|
||||
public void run(String args[]) throws Exception {
|
||||
public void run(String... args) throws Exception {
|
||||
String err = "Must have exactly one command line argument of the following: ";
|
||||
String prefix = "";
|
||||
for (Workflow wf : Workflow.values()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user