Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

Commit

Permalink
8268591: a few runtime/jni tests don't need /othervm
Browse files Browse the repository at this point in the history
Reviewed-by: dholmes, mseledtsov
  • Loading branch information
iignatev committed Jun 18, 2021
1 parent 7ed3634 commit 59d8478
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
4 changes: 2 additions & 2 deletions test/hotspot/jtreg/runtime/jni/atExit/TestAtExit.java
@@ -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
Expand Down Expand Up @@ -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 {
Expand Down
@@ -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
Expand All @@ -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;

Expand Down Expand Up @@ -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])).
Expand All @@ -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])).
Expand Down
@@ -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
Expand All @@ -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;

Expand All @@ -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 {
Expand Down Expand Up @@ -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);
Expand Down

1 comment on commit 59d8478

@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.