Skip to content
Permalink
Browse files
8268591: a few runtime/jni tests don't need /othervm
Reviewed-by: dholmes, mseledtsov
  • Loading branch information
iignatev committed Jun 18, 2021
1 parent 7ed3634 commit 59d84787e91e85dba4df45e99aa376f484e6ddff
Showing 3 changed files with 17 additions and 10 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2021, 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
@@ -32,7 +32,7 @@
* atexit handler fails as expected without crashing.
*
* @library /test/lib
* @run main/othervm/native TestAtExit
* @run main/native TestAtExit
*/

public class TestAtExit {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2021, 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,8 +25,9 @@
* @bug 8193222
* @summary Check EnsureLocalCapacity doesn't shrink unexpectedly
* @library /test/lib
* @run main/othervm/native TestCheckedEnsureLocalCapacity launch
* @run main/native TestCheckedEnsureLocalCapacity launch
*/
import jdk.test.lib.Utils;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer;

@@ -65,6 +66,7 @@ public static void main(String[] args) throws Throwable {

// No warning
ProcessTools.executeTestJvm("-Xcheck:jni",
"-Djava.library.path=" + Utils.TEST_NATIVE_PATH,
"TestCheckedEnsureLocalCapacity",
Integer.toString(testArgs[0][0]),
Integer.toString(testArgs[0][1])).
@@ -77,6 +79,7 @@ public static void main(String[] args) throws Throwable {

// Warning
ProcessTools.executeTestJvm("-Xcheck:jni",
"-Djava.library.path=" + Utils.TEST_NATIVE_PATH,
"TestCheckedEnsureLocalCapacity",
Integer.toString(testArgs[1][0]),
Integer.toString(testArgs[1][1])).
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2021, 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
@@ -20,6 +20,8 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

import jdk.test.lib.Utils;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;

@@ -30,7 +32,7 @@
* generates a warning when not done from a boot class
*
* @library /test/lib
* @run main/othervm/native TestRegisterNativesWarning
* @run main/native TestRegisterNativesWarning
*/

public class TestRegisterNativesWarning {
@@ -61,15 +63,17 @@ public static void main(String[] args) throws Exception {
public static void main(String[] args) throws Exception {
String warning = "Re-registering of platform native method: java.lang.Thread.yield()V from code in a different classloader";

OutputAnalyzer output = ProcessTools.executeTestJvm(Tester.class.getName());
String cp = Utils.TEST_CLASS_PATH;
String libp = Utils.TEST_NATIVE_PATH;
OutputAnalyzer output = ProcessTools.executeTestJvm("-Djava.library.path=" + libp,
Tester.class.getName());
output.shouldContain(warning);
output.shouldHaveExitValue(0);
output.reportDiagnosticSummary();

// If we run everything from the "boot" loader there should be no warning
String cp = System.getProperty("test.class.path");
String libp = System.getProperty("java.library.path");
output = ProcessTools.executeTestJvm("-Xbootclasspath/a:" + cp,
output = ProcessTools.executeTestJvm("-Djava.library.path=" + libp,
"-Xbootclasspath/a:" + cp,
"-Dsun.boot.library.path=" + libp,
Tester.class.getName());
output.shouldNotContain(warning);

0 comments on commit 59d8478

Please sign in to comment.