Skip to content

Commit 4fe6a3d

Browse files
committedSep 2, 2020
8252532: use Utils.TEST_NATIVE_PATH instead of System.getProperty("test.nativepath")
Reviewed-by: dholmes, sspitsyn
1 parent de49337 commit 4fe6a3d

File tree

8 files changed

+120
-112
lines changed

8 files changed

+120
-112
lines changed
 

‎test/hotspot/jtreg/gtest/GTestWrapper.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public class GTestWrapper {
4545
public static void main(String[] args) throws Throwable {
4646
// gtestLauncher is located in <test_image>/hotspot/gtest/<vm_variant>/
4747
// nativePath points either to <test_image>/hotspot/jtreg/native or to <test_image>/hotspot/gtest
48-
Path nativePath = Paths.get(System.getProperty("test.nativepath"));
48+
Path nativePath = Paths.get(Utils.TEST_NATIVE_PATH);
4949
String jvmVariantDir = getJVMVariantSubDir();
5050
// let's assume it's <test_image>/hotspot/gtest
5151
Path path = nativePath.resolve(jvmVariantDir);

‎test/hotspot/jtreg/runtime/handshake/HandshakeTransitionTest.java

+2-8
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@
2222
*
2323
*/
2424

25-
import java.io.File;
26-
import java.nio.file.Paths;
27-
import java.time.Duration;
28-
25+
import jdk.test.lib.Utils;
2926
import jdk.test.lib.process.ProcessTools;
3027
import jdk.test.lib.process.OutputAnalyzer;
3128

@@ -42,11 +39,9 @@
4239
*/
4340

4441
public class HandshakeTransitionTest {
45-
4642
public static native void someTime(int ms);
4743

4844
public static void main(String[] args) throws Exception {
49-
String lib = System.getProperty("test.nativepath");
5045
WhiteBox wb = WhiteBox.getWhiteBox();
5146
Boolean useJVMCICompiler = wb.getBooleanVMFlag("UseJVMCICompiler");
5247
String useJVMCICompilerStr;
@@ -58,7 +53,7 @@ public static void main(String[] args) throws Exception {
5853
}
5954
ProcessBuilder pb =
6055
ProcessTools.createTestJvm(
61-
"-Djava.library.path=" + lib,
56+
"-Djava.library.path=" + Utils.TEST_NATIVE_PATH,
6257
"-XX:+SafepointALot",
6358
"-XX:+HandshakeALot",
6459
"-XX:GuaranteedSafepointInterval=20",
@@ -70,7 +65,6 @@ public static void main(String[] args) throws Exception {
7065
useJVMCICompilerStr,
7166
"HandshakeTransitionTest$Test");
7267

73-
7468
OutputAnalyzer output = ProcessTools.executeProcess(pb);
7569
output.reportDiagnosticSummary();
7670
output.shouldHaveExitValue(0);

‎test/hotspot/jtreg/runtime/jni/CalleeSavedRegisters/FPRegs.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,7 @@
2222
*
2323
*/
2424

25-
/**
25+
/*
2626
* @test
2727
* @bug 8067744
2828
* @comment Test uses custom launcher that starts VM in primordial thread. This is
@@ -35,7 +35,6 @@
3535

3636
import jdk.test.lib.Platform;
3737
import jdk.test.lib.Utils;
38-
import jdk.test.lib.process.ProcessTools;
3938
import jdk.test.lib.process.OutputAnalyzer;
4039

4140
import java.io.File;
@@ -47,14 +46,14 @@
4746

4847
public class FPRegs {
4948
public static void main(String[] args) throws IOException {
50-
Path launcher = Paths.get(System.getProperty("test.nativepath"), "FPRegs" + (Platform.isWindows() ? ".exe" : ""));
49+
Path launcher = Paths.get(Utils.TEST_NATIVE_PATH, "FPRegs" + (Platform.isWindows() ? ".exe" : ""));
5150
System.out.println("Launcher = " + launcher + (Files.exists(launcher) ? " (exists)" : " (not exists)"));
5251
Path jvmLib = findJVM();
5352
ProcessBuilder pb = new ProcessBuilder(launcher.toString(), jvmLib.toString());
5453
// bin as working directory to let Windows load dll
5554
pb.directory(jvmLib.getParent().getParent().toFile());
56-
OutputAnalyzer outputf = new OutputAnalyzer(pb.start());
57-
outputf.shouldHaveExitValue(0);
55+
OutputAnalyzer oa = new OutputAnalyzer(pb.start());
56+
oa.shouldHaveExitValue(0);
5857
}
5958

6059
static Path findJVM() throws IOException {

‎test/hotspot/jtreg/runtime/jni/atExit/TestAtExit.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
* or visit www.oracle.com if you need additional information or have any
2121
* questions.
2222
*/
23+
24+
import jdk.test.lib.Utils;
2325
import jdk.test.lib.process.OutputAnalyzer;
2426
import jdk.test.lib.process.ProcessTools;
2527

@@ -57,7 +59,7 @@ public static void main(String[] args) throws Exception {
5759
// We mustn't load Tester in this VM so we exec by name.
5860
String main = "TestAtExit$Tester";
5961

60-
String jlp = "-Djava.library.path=" + System.getProperty("test.nativepath");
62+
String jlp = "-Djava.library.path=" + Utils.TEST_NATIVE_PATH;
6163
// First run will terminate via DestroyJavaVM
6264
OutputAnalyzer output = ProcessTools.executeTestJvm(jlp, main);
6365
output.shouldNotContain("Unexpected");

‎test/hotspot/jtreg/runtime/signal/SigTestDriver.java

+8-7
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public static void main(String[] args) {
4545
}
4646

4747
// At least one argument should be specified
48-
if ( (args == null) || (args.length < 1) ) {
48+
if ((args == null) || (args.length < 1)) {
4949
throw new IllegalArgumentException("At lease one argument should be specified, the signal name");
5050
}
5151

@@ -65,7 +65,7 @@ public static void main(String[] args) {
6565
}
6666
}
6767

68-
Path test = Paths.get(System.getProperty("test.nativepath"))
68+
Path test = Paths.get(Utils.TEST_NATIVE_PATH)
6969
.resolve("sigtest")
7070
.toAbsolutePath();
7171
String envVar = Platform.sharedLibraryPathVariableName();
@@ -87,16 +87,17 @@ public static void main(String[] args) {
8787
cmd.addAll(vmargs());
8888

8989
// add test specific arguments w/o signame
90-
cmd.addAll(Arrays.asList(args)
91-
.subList(1, args.length));
90+
var argList = Arrays.asList(args)
91+
.subList(1, args.length);
92+
cmd.addAll(argList);
9293

9394
boolean passed = true;
9495

95-
for (String mode : new String[]{"sigset", "sigaction"}) {
96+
for (String mode : new String[] {"sigset", "sigaction"}) {
9697
for (String scenario : new String[] {"nojvm", "prepre", "prepost", "postpre", "postpost"}) {
9798
cmd.set(modeIdx, mode);
9899
cmd.set(scenarioIdx, scenario);
99-
System.out.printf("START TESTING: SIGNAL = %s, MODE = %s, SCENARIO=%s%n",signame, mode, scenario);
100+
System.out.printf("START TESTING: SIGNAL = %s, MODE = %s, SCENARIO=%s%n", signame, mode, scenario);
100101
System.out.printf("Do execute: %s%n", cmd.toString());
101102

102103
ProcessBuilder pb = new ProcessBuilder(cmd);
@@ -117,7 +118,7 @@ public static void main(String[] args) {
117118
oa.reportDiagnosticSummary();
118119
int exitCode = oa.getExitValue();
119120
if (exitCode == 0) {
120-
System.out.println("PASSED with exit code 0");
121+
System.out.println("PASSED with exit code 0");
121122
} else {
122123
System.out.println("FAILED with exit code " + exitCode);
123124
passed = false;

‎test/hotspot/jtreg/serviceability/dcmd/jvmti/AttachFailed/AttachFailedTestBase.java

+12-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -20,9 +20,15 @@
2020
* or visit www.oracle.com if you need additional information or have any
2121
* questions.
2222
*/
23-
import java.nio.file.Paths;
24-
import jdk.test.lib.dcmd.*;
23+
2524
import jdk.test.lib.Platform;
25+
import jdk.test.lib.Utils;
26+
import jdk.test.lib.dcmd.CommandExecutor;
27+
import jdk.test.lib.dcmd.JMXExecutor;
28+
import jdk.test.lib.dcmd.PidJcmdExecutor;
29+
30+
import java.nio.file.Paths;
31+
2632
import org.testng.annotations.Test;
2733

2834
public abstract class AttachFailedTestBase {
@@ -42,18 +48,18 @@ public static String getSharedObjectPath(String name) {
4248
libname = "lib" + name + ".so";
4349
}
4450

45-
return Paths.get(System.getProperty("test.nativepath"), libname)
51+
return Paths.get(Utils.TEST_NATIVE_PATH, libname)
4652
.toAbsolutePath()
4753
.toString();
4854
}
4955

5056
@Test
51-
public void jmx() throws Throwable {
57+
public void jmx() {
5258
run(new JMXExecutor());
5359
}
5460

5561
@Test
56-
public void cli() throws Throwable {
62+
public void cli() {
5763
run(new PidJcmdExecutor());
5864
}
5965
}

‎test/hotspot/jtreg/vmTestbase/nsk/jvmti/NativeLibraryCopier.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
2424
package nsk.jvmti;
2525

2626
import jdk.test.lib.Platform;
27+
import jdk.test.lib.Utils;
2728

2829
import java.io.IOException;
2930
import java.nio.file.Files;
@@ -32,7 +33,7 @@
3233

3334
public class NativeLibraryCopier {
3435
public static void main(String[] args) {
35-
Path src = Paths.get( System.getProperty("test.nativepath", "."))
36+
Path src = Paths.get(Utils.TEST_NATIVE_PATH)
3637
.resolve(libname(args[0]))
3738
.toAbsolutePath();
3839

‎test/lib/jdk/test/lib/process/ProcessTools.java

+86-81
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.