Skip to content

Commit

Permalink
8210669: Some launcher tests assume a pre-JDK 9 run-time image layout
Browse files Browse the repository at this point in the history
Backport-of: 6bc30c6
  • Loading branch information
shipilev committed Aug 13, 2021
1 parent 8e63ecb commit 270786f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 15 deletions.
25 changes: 17 additions & 8 deletions test/jdk/tools/launcher/ExecutionEnvironment.java
Expand Up @@ -241,17 +241,26 @@ private void verifyJavaLibraryPathOverride(TestResult tr,
*/
@Test
void testVmSelection() {
boolean haveSomeVM = false;
if (haveClientVM) {
TestResult tr = doExec(javaCmd, "-client", "-version");
if (!tr.matches(".*Client VM.*")) {
flagError(tr, "the expected vm -client did not launch");
}
tryVmOption("-client", ".*Client VM.*");
haveSomeVM = true;
}
if (haveServerVM) {
TestResult tr = doExec(javaCmd, "-server", "-version");
if (!tr.matches(".*Server VM.*")) {
flagError(tr, "the expected vm -server did not launch");
}
tryVmOption("-server", ".*Server VM.*");
haveSomeVM = true;
}
if (!haveSomeVM) {
String msg = "Don't have a known VM";
System.err.println(msg);
throw new RuntimeException(msg);
}
}

private void tryVmOption(String opt, String expected) {
TestResult tr = doExec(javaCmd, opt, "-version");
if (!tr.matches(expected)) {
flagError(tr, "the expected vm " + opt + " did not launch");
}
}

Expand Down
7 changes: 2 additions & 5 deletions test/jdk/tools/launcher/Test7029048.java
Expand Up @@ -59,13 +59,10 @@ public class Test7029048 extends TestHelper {
private static final File srcLibjvmSo = new File(srcServerDir, LIBJVM);

private static final File dstLibDir = new File("lib");
private static final File dstLibArchDir =
new File(dstLibDir, getJreArch());

private static final File dstServerDir = new File(dstLibArchDir, "server");
private static final File dstServerDir = new File(dstLibDir, "server");
private static final File dstServerLibjvm = new File(dstServerDir, LIBJVM);

private static final File dstClientDir = new File(dstLibArchDir, "client");
private static final File dstClientDir = new File(dstLibDir, "client");
private static final File dstClientLibjvm = new File(dstClientDir, LIBJVM);

private static final Map<String, String> env = new HashMap<>();
Expand Down
3 changes: 1 addition & 2 deletions test/jdk/tools/launcher/TestHelper.java
Expand Up @@ -186,8 +186,7 @@ private static boolean haveVmVariant(String type) {
return jvmFile.exists();
} else {
File vmDir = new File(JAVA_LIB, type);
File vmArchDir = new File(vmDir, getJreArch());
File jvmFile = new File(vmArchDir, LIBJVM);
File jvmFile = new File(vmDir, LIBJVM);
return jvmFile.exists();
}
}
Expand Down

1 comment on commit 270786f

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.