1
1
#! /bin/bash
2
- # Copyright (c) 2020, 2022 , Oracle and/or its affiliates. All rights reserved.
2
+ # Copyright (c) 2020, 2023 , Oracle and/or its affiliates. All rights reserved.
3
3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
#
5
5
# This code is free software; you can redistribute it and/or modify it
31
31
fname=" $i$name_suffix "
32
32
cat << EOF > $fname
33
33
/*
34
- * Copyright (c) 2020, 2022 , Oracle and/or its affiliates. All rights reserved.
34
+ * Copyright (c) 2020, 2023 , Oracle and/or its affiliates. All rights reserved.
35
35
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
36
36
*
37
37
* This code is free software; you can redistribute it and/or modify it
@@ -94,6 +94,9 @@ public class $i extends DynamicArchiveTestBase {
94
94
private static final String ps = System.getProperty("path.separator");
95
95
private static final String testPackageName = "test.java.lang.invoke";
96
96
private static final String testClassName = "$i ";
97
+ private static final String loggingOpts = "-Xlog:cds,cds+dynamic=debug,class+load=trace";
98
+ private static final String lambdaLoadedFromArchive =
99
+ ".class.load. test.java.lang.invoke.$i [$][$]Lambda[$].*/0x.*source:.*shared.*objects.*file.*(top)";
97
100
98
101
static void testImpl() throws Exception {
99
102
String topArchiveName = getNewArchiveName();
@@ -104,10 +107,20 @@ public class $i extends DynamicArchiveTestBase {
104
107
Platform.isDebugBuild() ? "-XX:-VerifyDependencies" : "-showversion";
105
108
106
109
String junitJar = Path.of(Test.class.getProtectionDomain().getCodeSource().getLocation().toURI()).toString();
110
+ String jars = appJar + ps + junitJar;
111
+ String className = testPackageName + "." + testClassName;
112
+
113
+ dump(topArchiveName, loggingOpts, "-cp", jars, verifyOpt, mainClass, className)
114
+ .assertNormalExit(output -> {
115
+ output.shouldContain("Written dynamic archive 0x");
116
+ });
117
+
118
+ run(topArchiveName, loggingOpts, "-cp", jars, verifyOpt, mainClass, className)
119
+ .assertNormalExit(output -> {
120
+ output.shouldMatch(lambdaLoadedFromArchive)
121
+ .shouldHaveExitValue(0);
122
+ });
107
123
108
- dumpAndRun(topArchiveName, "-Xlog:cds,cds+dynamic=debug,class+load=trace",
109
- "-cp", appJar + ps + junitJar, verifyOpt,
110
- mainClass, testPackageName + "." + testClassName);
111
124
}
112
125
}
113
126
EOF
0 commit comments