8238268: Many SA tests are not running on OSX because they do not attempt to use sudo when available
Reviewed-by: sspitsyn, iignatyev
This commit is contained in:
parent
94a6149de5
commit
a147636157
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -55,7 +55,6 @@ requires.properties= \
|
|||||||
vm.cpu.features \
|
vm.cpu.features \
|
||||||
vm.debug \
|
vm.debug \
|
||||||
vm.hasSA \
|
vm.hasSA \
|
||||||
vm.hasSAandCanAttach \
|
|
||||||
vm.hasJFR \
|
vm.hasJFR \
|
||||||
vm.rtm.cpu \
|
vm.rtm.cpu \
|
||||||
vm.rtm.compiler \
|
vm.rtm.compiler \
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -26,7 +26,7 @@
|
|||||||
* @bug 8011675
|
* @bug 8011675
|
||||||
* @library / /test/lib
|
* @library / /test/lib
|
||||||
* @summary testing of ciReplay with using generated by SA replay.txt
|
* @summary testing of ciReplay with using generated by SA replay.txt
|
||||||
* @requires vm.hasSAandCanAttach & vm.flightRecorder != true & vm.compMode != "Xint" & vm.debug == true & vm.flavor == "client"
|
* @requires vm.hasSA & vm.flightRecorder != true & vm.compMode != "Xint" & vm.debug == true & vm.flavor == "client"
|
||||||
* @modules java.base/jdk.internal.misc
|
* @modules java.base/jdk.internal.misc
|
||||||
* @build sun.hotspot.WhiteBox
|
* @build sun.hotspot.WhiteBox
|
||||||
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
|
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -26,7 +26,7 @@
|
|||||||
* @bug 8011675
|
* @bug 8011675
|
||||||
* @library / /test/lib
|
* @library / /test/lib
|
||||||
* @summary testing of ciReplay with using generated by SA replay.txt
|
* @summary testing of ciReplay with using generated by SA replay.txt
|
||||||
* @requires vm.hasSAandCanAttach & vm.flightRecorder != true & vm.compMode != "Xint" & vm.debug == true & vm.flavor == "server"
|
* @requires vm.hasSA & vm.flightRecorder != true & vm.compMode != "Xint" & vm.debug == true & vm.flavor == "server"
|
||||||
* @modules java.base/jdk.internal.misc
|
* @modules java.base/jdk.internal.misc
|
||||||
* @build sun.hotspot.WhiteBox
|
* @build sun.hotspot.WhiteBox
|
||||||
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
|
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -27,7 +27,7 @@ package gc.metaspace;
|
|||||||
* @test CompressedClassSpaceSizeInJmapHeap
|
* @test CompressedClassSpaceSizeInJmapHeap
|
||||||
* @bug 8004924
|
* @bug 8004924
|
||||||
* @summary Checks that jmap -heap contains the flag CompressedClassSpaceSize
|
* @summary Checks that jmap -heap contains the flag CompressedClassSpaceSize
|
||||||
* @requires vm.hasSAandCanAttach
|
* @requires vm.hasSA
|
||||||
* @requires vm.bits == 64 & vm.opt.final.UseCompressedOops == true
|
* @requires vm.bits == 64 & vm.opt.final.UseCompressedOops == true
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @modules java.base/jdk.internal.misc
|
* @modules java.base/jdk.internal.misc
|
||||||
@ -39,6 +39,7 @@ import jdk.test.lib.JDKToolLauncher;
|
|||||||
import jdk.test.lib.Platform;
|
import jdk.test.lib.Platform;
|
||||||
import jdk.test.lib.process.OutputAnalyzer;
|
import jdk.test.lib.process.OutputAnalyzer;
|
||||||
import jdk.test.lib.process.ProcessTools;
|
import jdk.test.lib.process.ProcessTools;
|
||||||
|
import jdk.test.lib.SA.SATestUtils;
|
||||||
import java.nio.file.*;
|
import java.nio.file.*;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
@ -47,6 +48,8 @@ import java.util.List;
|
|||||||
public class CompressedClassSpaceSizeInJmapHeap {
|
public class CompressedClassSpaceSizeInJmapHeap {
|
||||||
// Note that on some platforms it may require root privileges to run this test.
|
// Note that on some platforms it may require root privileges to run this test.
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
SATestUtils.skipIfCannotAttach(); // throws SkippedException if attach not expected to work.
|
||||||
|
|
||||||
if (!Platform.is64bit()) {
|
if (!Platform.is64bit()) {
|
||||||
// Compressed Class Space is only available on 64-bit JVMs
|
// Compressed Class Space is only available on 64-bit JVMs
|
||||||
return;
|
return;
|
||||||
@ -59,7 +62,7 @@ public class CompressedClassSpaceSizeInJmapHeap {
|
|||||||
.addToolArg("--heap")
|
.addToolArg("--heap")
|
||||||
.addToolArg("--pid")
|
.addToolArg("--pid")
|
||||||
.addToolArg(pid);
|
.addToolArg(pid);
|
||||||
ProcessBuilder pb = new ProcessBuilder(jmap.getCommand());
|
ProcessBuilder pb = SATestUtils.createProcessBuilder(jmap);
|
||||||
|
|
||||||
File out = new File("CompressedClassSpaceSizeInJmapHeap.stdout.txt");
|
File out = new File("CompressedClassSpaceSizeInJmapHeap.stdout.txt");
|
||||||
pb.redirectOutput(out);
|
pb.redirectOutput(out);
|
||||||
|
@ -34,19 +34,20 @@ import sun.jvm.hotspot.HotSpotAgent;
|
|||||||
import sun.jvm.hotspot.debugger.*;
|
import sun.jvm.hotspot.debugger.*;
|
||||||
|
|
||||||
import jdk.test.lib.apps.LingeredApp;
|
import jdk.test.lib.apps.LingeredApp;
|
||||||
|
import jdk.test.lib.Asserts;
|
||||||
import jdk.test.lib.JDKToolLauncher;
|
import jdk.test.lib.JDKToolLauncher;
|
||||||
import jdk.test.lib.JDKToolFinder;
|
import jdk.test.lib.JDKToolFinder;
|
||||||
import jdk.test.lib.Platform;
|
import jdk.test.lib.Platform;
|
||||||
import jdk.test.lib.process.ProcessTools;
|
import jdk.test.lib.process.ProcessTools;
|
||||||
import jdk.test.lib.process.OutputAnalyzer;
|
import jdk.test.lib.process.OutputAnalyzer;
|
||||||
|
import jdk.test.lib.SA.SATestUtils;
|
||||||
import jdk.test.lib.Utils;
|
import jdk.test.lib.Utils;
|
||||||
import jdk.test.lib.Asserts;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @bug 8171084
|
* @bug 8171084
|
||||||
* @requires vm.hasSAandCanAttach & (vm.bits == "64" & os.maxMemory > 8g)
|
* @requires vm.hasSA & (vm.bits == "64" & os.maxMemory > 8g)
|
||||||
* @modules java.base/jdk.internal.misc
|
* @modules java.base/jdk.internal.misc
|
||||||
* jdk.hotspot.agent/sun.jvm.hotspot
|
* jdk.hotspot.agent/sun.jvm.hotspot
|
||||||
* jdk.hotspot.agent/sun.jvm.hotspot.utilities
|
* jdk.hotspot.agent/sun.jvm.hotspot.utilities
|
||||||
@ -70,8 +71,7 @@ public class TestHeapDumpForLargeArray {
|
|||||||
launcher.addToolArg("--pid");
|
launcher.addToolArg("--pid");
|
||||||
launcher.addToolArg(Long.toString(lingeredAppPid));
|
launcher.addToolArg(Long.toString(lingeredAppPid));
|
||||||
|
|
||||||
ProcessBuilder processBuilder = new ProcessBuilder();
|
ProcessBuilder processBuilder = SATestUtils.createProcessBuilder(launcher);
|
||||||
processBuilder.command(launcher.getCommand());
|
|
||||||
System.out.println(
|
System.out.println(
|
||||||
processBuilder.command().stream().collect(Collectors.joining(" ")));
|
processBuilder.command().stream().collect(Collectors.joining(" ")));
|
||||||
|
|
||||||
@ -86,6 +86,7 @@ public class TestHeapDumpForLargeArray {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main (String... args) throws Exception {
|
public static void main (String... args) throws Exception {
|
||||||
|
SATestUtils.skipIfCannotAttach(); // throws SkippedException if attach not expected to work.
|
||||||
|
|
||||||
String heapDumpFileName = "LargeArrayHeapDump.bin";
|
String heapDumpFileName = "LargeArrayHeapDump.bin";
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
* @test
|
* @test
|
||||||
* @bug 8204308
|
* @bug 8204308
|
||||||
* @summary Test the jhsdb jmap -clstats command with CDS enabled
|
* @summary Test the jhsdb jmap -clstats command with CDS enabled
|
||||||
* @requires vm.hasSAandCanAttach & vm.cds
|
* @requires vm.hasSA & vm.cds
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @run main/othervm/timeout=2400 CDSJMapClstats
|
* @run main/othervm/timeout=2400 CDSJMapClstats
|
||||||
*/
|
*/
|
||||||
@ -39,6 +39,7 @@ import jdk.test.lib.apps.LingeredApp;
|
|||||||
import jdk.test.lib.process.OutputAnalyzer;
|
import jdk.test.lib.process.OutputAnalyzer;
|
||||||
import jdk.test.lib.process.ProcessTools;
|
import jdk.test.lib.process.ProcessTools;
|
||||||
import jdk.test.lib.JDKToolLauncher;
|
import jdk.test.lib.JDKToolLauncher;
|
||||||
|
import jdk.test.lib.SA.SATestUtils;
|
||||||
|
|
||||||
public class CDSJMapClstats {
|
public class CDSJMapClstats {
|
||||||
|
|
||||||
@ -50,8 +51,7 @@ public class CDSJMapClstats {
|
|||||||
launcher.addToolArg("--pid");
|
launcher.addToolArg("--pid");
|
||||||
launcher.addToolArg(Long.toString(lingeredAppPid));
|
launcher.addToolArg(Long.toString(lingeredAppPid));
|
||||||
|
|
||||||
ProcessBuilder processBuilder = new ProcessBuilder();
|
ProcessBuilder processBuilder = SATestUtils.createProcessBuilder(launcher);
|
||||||
processBuilder.command(launcher.getCommand());
|
|
||||||
System.out.println(
|
System.out.println(
|
||||||
processBuilder.command().stream().collect(Collectors.joining(" ")));
|
processBuilder.command().stream().collect(Collectors.joining(" ")));
|
||||||
|
|
||||||
@ -64,6 +64,7 @@ public class CDSJMapClstats {
|
|||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
System.out.println("Starting CDSJMapClstats test");
|
System.out.println("Starting CDSJMapClstats test");
|
||||||
|
SATestUtils.skipIfCannotAttach(); // throws SkippedException if attach not expected to work.
|
||||||
String sharedArchiveName = "ArchiveForCDSJMapClstats.jsa";
|
String sharedArchiveName = "ArchiveForCDSJMapClstats.jsa";
|
||||||
LingeredApp theApp = null;
|
LingeredApp theApp = null;
|
||||||
|
|
||||||
|
@ -68,36 +68,32 @@ public class ClhsdbFindPC {
|
|||||||
// the 'jstack -v' command
|
// the 'jstack -v' command
|
||||||
cmds = new ArrayList<String>();
|
cmds = new ArrayList<String>();
|
||||||
|
|
||||||
// Output could be null if the test was skipped due to
|
String cmdStr = null;
|
||||||
// attach permission issues.
|
String[] parts = output.split("LingeredAppWithTrivialMain.main");
|
||||||
if (output != null) {
|
String[] tokens = parts[1].split(" ");
|
||||||
String cmdStr = null;
|
for (String token : tokens) {
|
||||||
String[] parts = output.split("LingeredAppWithTrivialMain.main");
|
if (token.contains("pc")) {
|
||||||
String[] tokens = parts[1].split(" ");
|
String[] address = token.split("=");
|
||||||
for (String token : tokens) {
|
// address[1] represents the address of the Method
|
||||||
if (token.contains("pc")) {
|
cmdStr = "findpc " + address[1].replace(",","");
|
||||||
String[] address = token.split("=");
|
cmds.add(cmdStr);
|
||||||
// address[1] represents the address of the Method
|
break;
|
||||||
cmdStr = "findpc " + address[1].replace(",","");
|
|
||||||
cmds.add(cmdStr);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, List<String>> expStrMap = new HashMap<>();
|
Map<String, List<String>> expStrMap = new HashMap<>();
|
||||||
if (withXcomp) {
|
if (withXcomp) {
|
||||||
expStrMap.put(cmdStr, List.of(
|
expStrMap.put(cmdStr, List.of(
|
||||||
"In code in NMethod for LingeredAppWithTrivialMain.main",
|
"In code in NMethod for LingeredAppWithTrivialMain.main",
|
||||||
"content:",
|
"content:",
|
||||||
"oops:",
|
"oops:",
|
||||||
"frame size:"));
|
"frame size:"));
|
||||||
} else {
|
} else {
|
||||||
expStrMap.put(cmdStr, List.of(
|
expStrMap.put(cmdStr, List.of(
|
||||||
"In interpreter codelet"));
|
"In interpreter codelet"));
|
||||||
}
|
|
||||||
|
|
||||||
test.run(theApp.getPid(), cmds, expStrMap, null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test.run(theApp.getPid(), cmds, expStrMap, null);
|
||||||
} catch (SkippedException se) {
|
} catch (SkippedException se) {
|
||||||
throw se;
|
throw se;
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
@ -30,6 +30,7 @@ import java.util.regex.Pattern;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import jdk.test.lib.JDKToolLauncher;
|
import jdk.test.lib.JDKToolLauncher;
|
||||||
|
import jdk.test.lib.SA.SATestUtils;
|
||||||
import jdk.test.lib.Utils;
|
import jdk.test.lib.Utils;
|
||||||
import jdk.test.lib.apps.LingeredApp;
|
import jdk.test.lib.apps.LingeredApp;
|
||||||
import jdk.test.lib.process.OutputAnalyzer;
|
import jdk.test.lib.process.OutputAnalyzer;
|
||||||
@ -37,7 +38,7 @@ import jdk.test.lib.process.OutputAnalyzer;
|
|||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @bug 8196969
|
* @bug 8196969
|
||||||
* @requires vm.hasSAandCanAttach
|
* @requires vm.hasSA
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @run main/othervm ClhsdbJstackXcompStress
|
* @run main/othervm ClhsdbJstackXcompStress
|
||||||
*/
|
*/
|
||||||
@ -63,8 +64,7 @@ public class ClhsdbJstackXcompStress {
|
|||||||
launcher.addToolArg("--pid");
|
launcher.addToolArg("--pid");
|
||||||
launcher.addToolArg(Long.toString(app.getPid()));
|
launcher.addToolArg(Long.toString(app.getPid()));
|
||||||
|
|
||||||
ProcessBuilder pb = new ProcessBuilder();
|
ProcessBuilder pb = SATestUtils.createProcessBuilder(launcher);
|
||||||
pb.command(launcher.getCommand());
|
|
||||||
Process jhsdb = pb.start();
|
Process jhsdb = pb.start();
|
||||||
OutputAnalyzer out = new OutputAnalyzer(jhsdb);
|
OutputAnalyzer out = new OutputAnalyzer(jhsdb);
|
||||||
|
|
||||||
@ -88,6 +88,7 @@ public class ClhsdbJstackXcompStress {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String... args) throws Exception {
|
public static void main(String... args) throws Exception {
|
||||||
|
SATestUtils.skipIfCannotAttach(); // throws SkippedException if attach not expected to work.
|
||||||
LingeredApp app = null;
|
LingeredApp app = null;
|
||||||
try {
|
try {
|
||||||
app = new LingeredAppWithRecComputation();
|
app = new LingeredAppWithRecComputation();
|
||||||
|
@ -33,8 +33,6 @@ import jdk.test.lib.JDKToolLauncher;
|
|||||||
import jdk.test.lib.JDKToolFinder;
|
import jdk.test.lib.JDKToolFinder;
|
||||||
import jdk.test.lib.process.OutputAnalyzer;
|
import jdk.test.lib.process.OutputAnalyzer;
|
||||||
import jdk.test.lib.SA.SATestUtils;
|
import jdk.test.lib.SA.SATestUtils;
|
||||||
import jtreg.SkippedException;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a framework to run 'jhsdb clhsdb' commands.
|
* This is a framework to run 'jhsdb clhsdb' commands.
|
||||||
@ -45,11 +43,9 @@ import jtreg.SkippedException;
|
|||||||
public class ClhsdbLauncher {
|
public class ClhsdbLauncher {
|
||||||
|
|
||||||
private Process toolProcess;
|
private Process toolProcess;
|
||||||
private boolean needPrivileges;
|
|
||||||
|
|
||||||
public ClhsdbLauncher() {
|
public ClhsdbLauncher() {
|
||||||
toolProcess = null;
|
toolProcess = null;
|
||||||
needPrivileges = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -66,11 +62,7 @@ public class ClhsdbLauncher {
|
|||||||
System.out.println("Starting clhsdb against " + lingeredAppPid);
|
System.out.println("Starting clhsdb against " + lingeredAppPid);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> cmdStringList = Arrays.asList(launcher.getCommand());
|
ProcessBuilder processBuilder = SATestUtils.createProcessBuilder(launcher);
|
||||||
if (needPrivileges) {
|
|
||||||
cmdStringList = SATestUtils.addPrivileges(cmdStringList);
|
|
||||||
}
|
|
||||||
ProcessBuilder processBuilder = new ProcessBuilder(cmdStringList);
|
|
||||||
toolProcess = processBuilder.start();
|
toolProcess = processBuilder.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,22 +195,7 @@ public class ClhsdbLauncher {
|
|||||||
Map<String, List<String>> unExpectedStrMap)
|
Map<String, List<String>> unExpectedStrMap)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
if (!Platform.shouldSAAttach()) {
|
SATestUtils.skipIfCannotAttach(); // throws SkippedException if attach not expected to work.
|
||||||
if (Platform.isOSX()) {
|
|
||||||
if (Platform.isSignedOSX()) {
|
|
||||||
throw new SkippedException("SA attach not expected to work. JDK is signed.");
|
|
||||||
} else if (SATestUtils.canAddPrivileges()) {
|
|
||||||
needPrivileges = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!needPrivileges) {
|
|
||||||
// Skip the test if we don't have enough permissions to attach
|
|
||||||
// and cannot add privileges.
|
|
||||||
throw new SkippedException(
|
|
||||||
"SA attach not expected to work. Insufficient privileges.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
attach(lingeredAppPid);
|
attach(lingeredAppPid);
|
||||||
return runCmd(commands, expectedStrMap, unExpectedStrMap);
|
return runCmd(commands, expectedStrMap, unExpectedStrMap);
|
||||||
}
|
}
|
||||||
|
@ -24,8 +24,7 @@
|
|||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @summary Test deadlock detection
|
* @summary Test deadlock detection
|
||||||
* @requires vm.hasSAandCanAttach
|
* @requires vm.hasSA
|
||||||
* @requires os.family != "mac"
|
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @modules java.base/jdk.internal.misc
|
* @modules java.base/jdk.internal.misc
|
||||||
* @modules java.management
|
* @modules java.management
|
||||||
@ -38,18 +37,17 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
import jdk.test.lib.apps.LingeredApp;
|
import jdk.test.lib.apps.LingeredApp;
|
||||||
import jdk.test.lib.apps.LingeredAppWithDeadlock;
|
import jdk.test.lib.apps.LingeredAppWithDeadlock;
|
||||||
|
|
||||||
import jdk.test.lib.Utils;
|
|
||||||
import jdk.test.lib.JDKToolLauncher;
|
import jdk.test.lib.JDKToolLauncher;
|
||||||
import jdk.test.lib.process.OutputAnalyzer;
|
import jdk.test.lib.process.OutputAnalyzer;
|
||||||
import jdk.test.lib.process.ProcessTools;
|
import jdk.test.lib.process.ProcessTools;
|
||||||
|
import jdk.test.lib.SA.SATestUtils;
|
||||||
|
import jdk.test.lib.Utils;
|
||||||
|
|
||||||
import jtreg.SkippedException;
|
import jtreg.SkippedException;
|
||||||
|
|
||||||
public class DeadlockDetectionTest {
|
public class DeadlockDetectionTest {
|
||||||
|
|
||||||
private static LingeredAppWithDeadlock theApp = null;
|
private static LingeredAppWithDeadlock theApp = null;
|
||||||
private static ProcessBuilder processBuilder = new ProcessBuilder();
|
|
||||||
|
|
||||||
private static OutputAnalyzer jstack(String... toolArgs) throws Exception {
|
private static OutputAnalyzer jstack(String... toolArgs) throws Exception {
|
||||||
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jhsdb");
|
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jhsdb");
|
||||||
@ -60,7 +58,7 @@ public class DeadlockDetectionTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
processBuilder.command(launcher.getCommand());
|
ProcessBuilder processBuilder = SATestUtils.createProcessBuilder(launcher);
|
||||||
System.out.println(processBuilder.command().stream().collect(Collectors.joining(" ")));
|
System.out.println(processBuilder.command().stream().collect(Collectors.joining(" ")));
|
||||||
OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);
|
OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);
|
||||||
System.out.println(output.getOutput());
|
System.out.println(output.getOutput());
|
||||||
@ -69,6 +67,7 @@ public class DeadlockDetectionTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
SATestUtils.skipIfCannotAttach(); // throws SkippedException if attach not expected to work.
|
||||||
System.out.println("Starting DeadlockDetectionTest");
|
System.out.println("Starting DeadlockDetectionTest");
|
||||||
|
|
||||||
if (!LingeredApp.isLastModifiedWorking()) {
|
if (!LingeredApp.isLastModifiedWorking()) {
|
||||||
@ -91,7 +90,6 @@ public class DeadlockDetectionTest {
|
|||||||
output.shouldHaveExitValue(0);
|
output.shouldHaveExitValue(0);
|
||||||
output.shouldContain("Found a total of 1 deadlock.");
|
output.shouldContain("Found a total of 1 deadlock.");
|
||||||
}
|
}
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
LingeredApp.stopApp(theApp);
|
LingeredApp.stopApp(theApp);
|
||||||
}
|
}
|
||||||
|
@ -30,18 +30,19 @@ import jdk.test.lib.apps.LingeredApp;
|
|||||||
import jdk.test.lib.JDKToolLauncher;
|
import jdk.test.lib.JDKToolLauncher;
|
||||||
import jdk.test.lib.Platform;
|
import jdk.test.lib.Platform;
|
||||||
import jdk.test.lib.process.OutputAnalyzer;
|
import jdk.test.lib.process.OutputAnalyzer;
|
||||||
|
import jdk.test.lib.SA.SATestUtils;
|
||||||
import jdk.test.lib.Utils;
|
import jdk.test.lib.Utils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @requires vm.hasSAandCanAttach
|
* @requires vm.hasSA
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @run main JhsdbThreadInfoTest
|
* @run main JhsdbThreadInfoTest
|
||||||
*/
|
*/
|
||||||
public class JhsdbThreadInfoTest {
|
public class JhsdbThreadInfoTest {
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
SATestUtils.skipIfCannotAttach(); // throws SkippedException if attach not expected to work.
|
||||||
LingeredApp app = null;
|
LingeredApp app = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -54,8 +55,7 @@ public class JhsdbThreadInfoTest {
|
|||||||
jhsdbLauncher.addToolArg("--pid");
|
jhsdbLauncher.addToolArg("--pid");
|
||||||
jhsdbLauncher.addToolArg(Long.toString(app.getPid()));
|
jhsdbLauncher.addToolArg(Long.toString(app.getPid()));
|
||||||
|
|
||||||
ProcessBuilder pb = new ProcessBuilder();
|
ProcessBuilder pb = SATestUtils.createProcessBuilder(jhsdbLauncher);
|
||||||
pb.command(jhsdbLauncher.getCommand());
|
|
||||||
Process jhsdb = pb.start();
|
Process jhsdb = pb.start();
|
||||||
|
|
||||||
OutputAnalyzer out = new OutputAnalyzer(jhsdb);
|
OutputAnalyzer out = new OutputAnalyzer(jhsdb);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -29,12 +29,13 @@ import jdk.test.lib.apps.LingeredApp;
|
|||||||
import jdk.test.lib.Platform;
|
import jdk.test.lib.Platform;
|
||||||
import jdk.test.lib.process.OutputAnalyzer;
|
import jdk.test.lib.process.OutputAnalyzer;
|
||||||
import jdk.test.lib.process.ProcessTools;
|
import jdk.test.lib.process.ProcessTools;
|
||||||
|
import jdk.test.lib.SA.SATestUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @bug 8184982
|
* @bug 8184982
|
||||||
* @summary Test ClassDump tool
|
* @summary Test ClassDump tool
|
||||||
* @requires vm.hasSAandCanAttach
|
* @requires vm.hasSA
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @run main/othervm TestClassDump
|
* @run main/othervm TestClassDump
|
||||||
*/
|
*/
|
||||||
@ -50,6 +51,7 @@ public class TestClassDump {
|
|||||||
pb = ProcessTools.createJavaProcessBuilder(
|
pb = ProcessTools.createJavaProcessBuilder(
|
||||||
"-Dsun.jvm.hotspot.tools.jcore.outputDir=jtreg_classes",
|
"-Dsun.jvm.hotspot.tools.jcore.outputDir=jtreg_classes",
|
||||||
"-m", "jdk.hotspot.agent/sun.jvm.hotspot.tools.jcore.ClassDump", String.valueOf(lingeredAppPid));
|
"-m", "jdk.hotspot.agent/sun.jvm.hotspot.tools.jcore.ClassDump", String.valueOf(lingeredAppPid));
|
||||||
|
SATestUtils.addPrivilegesIfNeeded(pb);
|
||||||
output = new OutputAnalyzer(pb.start());
|
output = new OutputAnalyzer(pb.start());
|
||||||
output.shouldHaveExitValue(0);
|
output.shouldHaveExitValue(0);
|
||||||
if (!Files.isDirectory(Paths.get("jtreg_classes"))) {
|
if (!Files.isDirectory(Paths.get("jtreg_classes"))) {
|
||||||
@ -69,6 +71,7 @@ public class TestClassDump {
|
|||||||
"-Dsun.jvm.hotspot.tools.jcore.outputDir=jtreg_classes2",
|
"-Dsun.jvm.hotspot.tools.jcore.outputDir=jtreg_classes2",
|
||||||
"-Dsun.jvm.hotspot.tools.jcore.PackageNameFilter.pkgList=jdk,sun",
|
"-Dsun.jvm.hotspot.tools.jcore.PackageNameFilter.pkgList=jdk,sun",
|
||||||
"-m", "jdk.hotspot.agent/sun.jvm.hotspot.tools.jcore.ClassDump", String.valueOf(lingeredAppPid));
|
"-m", "jdk.hotspot.agent/sun.jvm.hotspot.tools.jcore.ClassDump", String.valueOf(lingeredAppPid));
|
||||||
|
SATestUtils.addPrivilegesIfNeeded(pb);
|
||||||
output = new OutputAnalyzer(pb.start());
|
output = new OutputAnalyzer(pb.start());
|
||||||
output.shouldHaveExitValue(0);
|
output.shouldHaveExitValue(0);
|
||||||
if (Files.exists(Paths.get("jtreg_classes2", "java", "math", "BigInteger.class"))) {
|
if (Files.exists(Paths.get("jtreg_classes2", "java", "math", "BigInteger.class"))) {
|
||||||
@ -83,6 +86,7 @@ public class TestClassDump {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
SATestUtils.skipIfCannotAttach(); // throws SkippedException if attach not expected to work.
|
||||||
LingeredApp theApp = null;
|
LingeredApp theApp = null;
|
||||||
try {
|
try {
|
||||||
theApp = LingeredApp.startApp();
|
theApp = LingeredApp.startApp();
|
||||||
|
@ -31,7 +31,7 @@ import jtreg.SkippedException;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @requires vm.hasSAandCanAttach
|
* @requires vm.hasSA
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @run main/othervm TestClhsdbJstackLock
|
* @run main/othervm TestClhsdbJstackLock
|
||||||
*/
|
*/
|
||||||
|
@ -33,18 +33,19 @@ import sun.jvm.hotspot.utilities.MethodArray;
|
|||||||
import sun.jvm.hotspot.ui.classbrowser.HTMLGenerator;
|
import sun.jvm.hotspot.ui.classbrowser.HTMLGenerator;
|
||||||
|
|
||||||
import jdk.test.lib.apps.LingeredApp;
|
import jdk.test.lib.apps.LingeredApp;
|
||||||
|
import jdk.test.lib.Asserts;
|
||||||
import jdk.test.lib.JDKToolLauncher;
|
import jdk.test.lib.JDKToolLauncher;
|
||||||
import jdk.test.lib.JDKToolFinder;
|
import jdk.test.lib.JDKToolFinder;
|
||||||
import jdk.test.lib.Platform;
|
import jdk.test.lib.Platform;
|
||||||
import jdk.test.lib.process.ProcessTools;
|
import jdk.test.lib.process.ProcessTools;
|
||||||
import jdk.test.lib.process.OutputAnalyzer;
|
import jdk.test.lib.process.OutputAnalyzer;
|
||||||
|
import jdk.test.lib.SA.SATestUtils;
|
||||||
import jdk.test.lib.Utils;
|
import jdk.test.lib.Utils;
|
||||||
import jdk.test.lib.Asserts;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @requires vm.hasSAandCanAttach & os.family != "mac"
|
* @requires vm.hasSA
|
||||||
* @modules java.base/jdk.internal.misc
|
* @modules java.base/jdk.internal.misc
|
||||||
* jdk.hotspot.agent/sun.jvm.hotspot
|
* jdk.hotspot.agent/sun.jvm.hotspot
|
||||||
* jdk.hotspot.agent/sun.jvm.hotspot.utilities
|
* jdk.hotspot.agent/sun.jvm.hotspot.utilities
|
||||||
@ -103,6 +104,7 @@ public class TestCpoolForInvokeDynamic {
|
|||||||
|
|
||||||
// Start a new process to attach to the lingered app
|
// Start a new process to attach to the lingered app
|
||||||
ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder(toolArgs);
|
ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder(toolArgs);
|
||||||
|
SATestUtils.addPrivilegesIfNeeded(processBuilder);
|
||||||
OutputAnalyzer SAOutput = ProcessTools.executeProcess(processBuilder);
|
OutputAnalyzer SAOutput = ProcessTools.executeProcess(processBuilder);
|
||||||
SAOutput.shouldHaveExitValue(0);
|
SAOutput.shouldHaveExitValue(0);
|
||||||
System.out.println(SAOutput.getOutput());
|
System.out.println(SAOutput.getOutput());
|
||||||
@ -115,6 +117,7 @@ public class TestCpoolForInvokeDynamic {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main (String... args) throws Exception {
|
public static void main (String... args) throws Exception {
|
||||||
|
SATestUtils.skipIfCannotAttach(); // throws SkippedException if attach not expected to work.
|
||||||
|
|
||||||
String[] instanceKlassNames = new String[] {
|
String[] instanceKlassNames = new String[] {
|
||||||
"LingeredAppWithInvokeDynamic"
|
"LingeredAppWithInvokeDynamic"
|
||||||
|
@ -32,18 +32,19 @@ import sun.jvm.hotspot.oops.Method;
|
|||||||
import sun.jvm.hotspot.utilities.MethodArray;
|
import sun.jvm.hotspot.utilities.MethodArray;
|
||||||
|
|
||||||
import jdk.test.lib.apps.LingeredApp;
|
import jdk.test.lib.apps.LingeredApp;
|
||||||
|
import jdk.test.lib.Asserts;
|
||||||
import jdk.test.lib.JDKToolLauncher;
|
import jdk.test.lib.JDKToolLauncher;
|
||||||
import jdk.test.lib.JDKToolFinder;
|
import jdk.test.lib.JDKToolFinder;
|
||||||
import jdk.test.lib.Platform;
|
import jdk.test.lib.Platform;
|
||||||
import jdk.test.lib.process.ProcessTools;
|
import jdk.test.lib.process.ProcessTools;
|
||||||
import jdk.test.lib.process.OutputAnalyzer;
|
import jdk.test.lib.process.OutputAnalyzer;
|
||||||
|
import jdk.test.lib.SA.SATestUtils;
|
||||||
import jdk.test.lib.Utils;
|
import jdk.test.lib.Utils;
|
||||||
import jdk.test.lib.Asserts;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @requires vm.hasSAandCanAttach & os.family != "mac"
|
* @requires vm.hasSA
|
||||||
* @modules java.base/jdk.internal.misc
|
* @modules java.base/jdk.internal.misc
|
||||||
* jdk.hotspot.agent/sun.jvm.hotspot
|
* jdk.hotspot.agent/sun.jvm.hotspot
|
||||||
* jdk.hotspot.agent/sun.jvm.hotspot.utilities
|
* jdk.hotspot.agent/sun.jvm.hotspot.utilities
|
||||||
@ -109,6 +110,7 @@ public class TestDefaultMethods {
|
|||||||
|
|
||||||
// Start a new process to attach to the lingered app
|
// Start a new process to attach to the lingered app
|
||||||
ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder(toolArgs);
|
ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder(toolArgs);
|
||||||
|
SATestUtils.addPrivilegesIfNeeded(processBuilder);
|
||||||
OutputAnalyzer SAOutput = ProcessTools.executeProcess(processBuilder);
|
OutputAnalyzer SAOutput = ProcessTools.executeProcess(processBuilder);
|
||||||
SAOutput.shouldHaveExitValue(0);
|
SAOutput.shouldHaveExitValue(0);
|
||||||
System.out.println(SAOutput.getOutput());
|
System.out.println(SAOutput.getOutput());
|
||||||
@ -124,7 +126,7 @@ public class TestDefaultMethods {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main (String... args) throws Exception {
|
public static void main (String... args) throws Exception {
|
||||||
|
SATestUtils.skipIfCannotAttach(); // throws SkippedException if attach not expected to work.
|
||||||
String[] instanceKlassNames = new String[] {
|
String[] instanceKlassNames = new String[] {
|
||||||
"Language",
|
"Language",
|
||||||
"ParselTongue",
|
"ParselTongue",
|
||||||
|
@ -34,12 +34,13 @@ import jdk.test.lib.Asserts;
|
|||||||
import jdk.test.lib.Platform;
|
import jdk.test.lib.Platform;
|
||||||
import jdk.test.lib.process.OutputAnalyzer;
|
import jdk.test.lib.process.OutputAnalyzer;
|
||||||
import jdk.test.lib.process.ProcessTools;
|
import jdk.test.lib.process.ProcessTools;
|
||||||
|
import jdk.test.lib.SA.SATestUtils;
|
||||||
import jdk.test.lib.Utils;
|
import jdk.test.lib.Utils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @requires vm.hasSAandCanAttach & os.family != "mac"
|
* @requires vm.hasSA
|
||||||
* @requires vm.gc.G1
|
* @requires vm.gc.G1
|
||||||
* @modules jdk.hotspot.agent/sun.jvm.hotspot
|
* @modules jdk.hotspot.agent/sun.jvm.hotspot
|
||||||
* jdk.hotspot.agent/sun.jvm.hotspot.gc.g1
|
* jdk.hotspot.agent/sun.jvm.hotspot.gc.g1
|
||||||
@ -82,12 +83,14 @@ public class TestG1HeapRegion {
|
|||||||
|
|
||||||
// Start a new process to attach to the lingered app
|
// Start a new process to attach to the lingered app
|
||||||
ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder(toolArgs);
|
ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder(toolArgs);
|
||||||
|
SATestUtils.addPrivilegesIfNeeded(processBuilder);
|
||||||
OutputAnalyzer SAOutput = ProcessTools.executeProcess(processBuilder);
|
OutputAnalyzer SAOutput = ProcessTools.executeProcess(processBuilder);
|
||||||
SAOutput.shouldHaveExitValue(0);
|
SAOutput.shouldHaveExitValue(0);
|
||||||
System.out.println(SAOutput.getOutput());
|
System.out.println(SAOutput.getOutput());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main (String... args) throws Exception {
|
public static void main (String... args) throws Exception {
|
||||||
|
SATestUtils.skipIfCannotAttach(); // throws SkippedException if attach not expected to work.
|
||||||
if (args == null || args.length == 0) {
|
if (args == null || args.length == 0) {
|
||||||
try {
|
try {
|
||||||
String[] vmArgs = Utils.appendTestJavaOpts(
|
String[] vmArgs = Utils.appendTestJavaOpts(
|
||||||
|
@ -34,13 +34,14 @@ import sun.jvm.hotspot.HotSpotAgent;
|
|||||||
import sun.jvm.hotspot.debugger.*;
|
import sun.jvm.hotspot.debugger.*;
|
||||||
|
|
||||||
import jdk.test.lib.apps.LingeredApp;
|
import jdk.test.lib.apps.LingeredApp;
|
||||||
|
import jdk.test.lib.Asserts;
|
||||||
import jdk.test.lib.JDKToolLauncher;
|
import jdk.test.lib.JDKToolLauncher;
|
||||||
import jdk.test.lib.JDKToolFinder;
|
import jdk.test.lib.JDKToolFinder;
|
||||||
import jdk.test.lib.Platform;
|
import jdk.test.lib.Platform;
|
||||||
import jdk.test.lib.process.ProcessTools;
|
import jdk.test.lib.process.ProcessTools;
|
||||||
import jdk.test.lib.process.OutputAnalyzer;
|
import jdk.test.lib.process.OutputAnalyzer;
|
||||||
|
import jdk.test.lib.SA.SATestUtils;
|
||||||
import jdk.test.lib.Utils;
|
import jdk.test.lib.Utils;
|
||||||
import jdk.test.lib.Asserts;
|
|
||||||
import jdk.test.lib.hprof.HprofParser;
|
import jdk.test.lib.hprof.HprofParser;
|
||||||
import jdk.test.lib.hprof.parser.HprofReader;
|
import jdk.test.lib.hprof.parser.HprofReader;
|
||||||
import jdk.test.lib.hprof.parser.PositionDataInputStream;
|
import jdk.test.lib.hprof.parser.PositionDataInputStream;
|
||||||
@ -49,7 +50,7 @@ import jdk.test.lib.hprof.model.Snapshot;
|
|||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @requires vm.hasSAandCanAttach & os.family != "mac"
|
* @requires vm.hasSA
|
||||||
* @modules java.base/jdk.internal.misc
|
* @modules java.base/jdk.internal.misc
|
||||||
* jdk.hotspot.agent/sun.jvm.hotspot
|
* jdk.hotspot.agent/sun.jvm.hotspot
|
||||||
* jdk.hotspot.agent/sun.jvm.hotspot.utilities
|
* jdk.hotspot.agent/sun.jvm.hotspot.utilities
|
||||||
@ -97,8 +98,7 @@ public class TestHeapDumpForInvokeDynamic {
|
|||||||
launcher.addToolArg("--pid");
|
launcher.addToolArg("--pid");
|
||||||
launcher.addToolArg(Long.toString(lingeredAppPid));
|
launcher.addToolArg(Long.toString(lingeredAppPid));
|
||||||
|
|
||||||
ProcessBuilder processBuilder = new ProcessBuilder();
|
ProcessBuilder processBuilder = SATestUtils.createProcessBuilder(launcher);
|
||||||
processBuilder.command(launcher.getCommand());
|
|
||||||
System.out.println(
|
System.out.println(
|
||||||
processBuilder.command().stream().collect(Collectors.joining(" ")));
|
processBuilder.command().stream().collect(Collectors.joining(" ")));
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ public class TestHeapDumpForInvokeDynamic {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main (String... args) throws Exception {
|
public static void main (String... args) throws Exception {
|
||||||
|
SATestUtils.skipIfCannotAttach(); // throws SkippedException if attach not expected to work.
|
||||||
String heapDumpFileName = "lambdaHeapDump.bin";
|
String heapDumpFileName = "lambdaHeapDump.bin";
|
||||||
|
|
||||||
File heapDumpFile = new File(heapDumpFileName);
|
File heapDumpFile = new File(heapDumpFileName);
|
||||||
|
@ -30,13 +30,14 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import jdk.test.lib.apps.LingeredApp;
|
||||||
|
import jdk.test.lib.Asserts;
|
||||||
import jdk.test.lib.JDKToolLauncher;
|
import jdk.test.lib.JDKToolLauncher;
|
||||||
import jdk.test.lib.Platform;
|
import jdk.test.lib.Platform;
|
||||||
import jdk.test.lib.process.ProcessTools;
|
import jdk.test.lib.process.ProcessTools;
|
||||||
import jdk.test.lib.process.OutputAnalyzer;
|
import jdk.test.lib.process.OutputAnalyzer;
|
||||||
|
import jdk.test.lib.SA.SATestUtils;
|
||||||
import jdk.test.lib.Utils;
|
import jdk.test.lib.Utils;
|
||||||
import jdk.test.lib.apps.LingeredApp;
|
|
||||||
import jdk.test.lib.Asserts;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -44,7 +45,7 @@ import java.util.*;
|
|||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @requires vm.hasSAandCanAttach
|
* @requires vm.hasSA
|
||||||
* @modules java.base/jdk.internal.misc
|
* @modules java.base/jdk.internal.misc
|
||||||
* jdk.hotspot.agent/sun.jvm.hotspot
|
* jdk.hotspot.agent/sun.jvm.hotspot
|
||||||
* jdk.hotspot.agent/sun.jvm.hotspot.utilities
|
* jdk.hotspot.agent/sun.jvm.hotspot.utilities
|
||||||
@ -97,6 +98,7 @@ public class TestInstanceKlassSize {
|
|||||||
|
|
||||||
ProcessBuilder processBuilder = ProcessTools
|
ProcessBuilder processBuilder = ProcessTools
|
||||||
.createJavaProcessBuilder(toolArgs);
|
.createJavaProcessBuilder(toolArgs);
|
||||||
|
SATestUtils.addPrivilegesIfNeeded(processBuilder);
|
||||||
output = ProcessTools.executeProcess(processBuilder);
|
output = ProcessTools.executeProcess(processBuilder);
|
||||||
System.out.println(output.getOutput());
|
System.out.println(output.getOutput());
|
||||||
output.shouldHaveExitValue(0);
|
output.shouldHaveExitValue(0);
|
||||||
@ -148,7 +150,7 @@ public class TestInstanceKlassSize {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
SATestUtils.skipIfCannotAttach(); // throws SkippedException if attach not expected to work.
|
||||||
if (args == null || args.length == 0) {
|
if (args == null || args.length == 0) {
|
||||||
System.out.println ("No args run. Starting with args now.");
|
System.out.println ("No args run. Starting with args now.");
|
||||||
startMeWithArgs();
|
startMeWithArgs();
|
||||||
|
@ -29,18 +29,19 @@ import sun.jvm.hotspot.oops.InstanceKlass;
|
|||||||
import sun.jvm.hotspot.debugger.*;
|
import sun.jvm.hotspot.debugger.*;
|
||||||
|
|
||||||
import jdk.test.lib.apps.LingeredApp;
|
import jdk.test.lib.apps.LingeredApp;
|
||||||
|
import jdk.test.lib.Asserts;
|
||||||
import jdk.test.lib.JDKToolLauncher;
|
import jdk.test.lib.JDKToolLauncher;
|
||||||
import jdk.test.lib.JDKToolFinder;
|
import jdk.test.lib.JDKToolFinder;
|
||||||
import jdk.test.lib.Platform;
|
import jdk.test.lib.Platform;
|
||||||
import jdk.test.lib.process.ProcessTools;
|
import jdk.test.lib.process.ProcessTools;
|
||||||
import jdk.test.lib.process.OutputAnalyzer;
|
import jdk.test.lib.process.OutputAnalyzer;
|
||||||
|
import jdk.test.lib.SA.SATestUtils;
|
||||||
import jdk.test.lib.Utils;
|
import jdk.test.lib.Utils;
|
||||||
import jdk.test.lib.Asserts;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @requires vm.hasSAandCanAttach
|
* @requires vm.hasSA
|
||||||
* @modules java.base/jdk.internal.misc
|
* @modules java.base/jdk.internal.misc
|
||||||
* jdk.hotspot.agent/sun.jvm.hotspot
|
* jdk.hotspot.agent/sun.jvm.hotspot
|
||||||
* jdk.hotspot.agent/sun.jvm.hotspot.utilities
|
* jdk.hotspot.agent/sun.jvm.hotspot.utilities
|
||||||
@ -118,6 +119,7 @@ public class TestInstanceKlassSizeForInterface {
|
|||||||
// Start a new process to attach to the LingeredApp process to get SA info
|
// Start a new process to attach to the LingeredApp process to get SA info
|
||||||
ProcessBuilder processBuilder = ProcessTools
|
ProcessBuilder processBuilder = ProcessTools
|
||||||
.createJavaProcessBuilder(toolArgs);
|
.createJavaProcessBuilder(toolArgs);
|
||||||
|
SATestUtils.addPrivilegesIfNeeded(processBuilder);
|
||||||
OutputAnalyzer SAOutput = ProcessTools.executeProcess(processBuilder);
|
OutputAnalyzer SAOutput = ProcessTools.executeProcess(processBuilder);
|
||||||
SAOutput.shouldHaveExitValue(0);
|
SAOutput.shouldHaveExitValue(0);
|
||||||
System.out.println(SAOutput.getOutput());
|
System.out.println(SAOutput.getOutput());
|
||||||
@ -141,6 +143,7 @@ public class TestInstanceKlassSizeForInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main (String... args) throws Exception {
|
public static void main (String... args) throws Exception {
|
||||||
|
SATestUtils.skipIfCannotAttach(); // throws SkippedException if attach not expected to work.
|
||||||
String[] instanceKlassNames = new String[] {
|
String[] instanceKlassNames = new String[] {
|
||||||
"Language",
|
"Language",
|
||||||
"ParselTongue",
|
"ParselTongue",
|
||||||
|
@ -33,7 +33,7 @@ import jtreg.SkippedException;
|
|||||||
* @test
|
* @test
|
||||||
* @summary Test the 'intConstant' command of jhsdb clhsdb.
|
* @summary Test the 'intConstant' command of jhsdb clhsdb.
|
||||||
* @bug 8190307
|
* @bug 8190307
|
||||||
* @requires vm.hasSAandCanAttach
|
* @requires vm.hasSA
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @build jdk.test.lib.apps.*
|
* @build jdk.test.lib.apps.*
|
||||||
* @run main/othervm TestIntConstant
|
* @run main/othervm TestIntConstant
|
||||||
|
@ -35,11 +35,12 @@ import jdk.test.lib.JDKToolLauncher;
|
|||||||
import jdk.test.lib.Platform;
|
import jdk.test.lib.Platform;
|
||||||
import jdk.test.lib.process.OutputAnalyzer;
|
import jdk.test.lib.process.OutputAnalyzer;
|
||||||
import jdk.test.lib.process.ProcessTools;
|
import jdk.test.lib.process.ProcessTools;
|
||||||
|
import jdk.test.lib.SA.SATestUtils;
|
||||||
import jdk.test.lib.Utils;
|
import jdk.test.lib.Utils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @requires vm.hasSAandCanAttach
|
* @requires vm.hasSA
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @run main/othervm TestJhsdbJstackLock
|
* @run main/othervm TestJhsdbJstackLock
|
||||||
*/
|
*/
|
||||||
@ -47,7 +48,7 @@ import jdk.test.lib.Utils;
|
|||||||
public class TestJhsdbJstackLock {
|
public class TestJhsdbJstackLock {
|
||||||
|
|
||||||
public static void main (String... args) throws Exception {
|
public static void main (String... args) throws Exception {
|
||||||
|
SATestUtils.skipIfCannotAttach(); // throws SkippedException if attach not expected to work.
|
||||||
LingeredApp app = null;
|
LingeredApp app = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -60,8 +61,7 @@ public class TestJhsdbJstackLock {
|
|||||||
launcher.addToolArg("--pid");
|
launcher.addToolArg("--pid");
|
||||||
launcher.addToolArg(Long.toString(app.getPid()));
|
launcher.addToolArg(Long.toString(app.getPid()));
|
||||||
|
|
||||||
ProcessBuilder pb = new ProcessBuilder();
|
ProcessBuilder pb = SATestUtils.createProcessBuilder(launcher);
|
||||||
pb.command(launcher.getCommand());
|
|
||||||
Process jhsdb = pb.start();
|
Process jhsdb = pb.start();
|
||||||
OutputAnalyzer out = new OutputAnalyzer(jhsdb);
|
OutputAnalyzer out = new OutputAnalyzer(jhsdb);
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ import java.util.regex.Matcher;
|
|||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import jdk.test.lib.JDKToolLauncher;
|
import jdk.test.lib.JDKToolLauncher;
|
||||||
|
import jdk.test.lib.SA.SATestUtils;
|
||||||
import jdk.test.lib.Utils;
|
import jdk.test.lib.Utils;
|
||||||
import jdk.test.lib.apps.LingeredApp;
|
import jdk.test.lib.apps.LingeredApp;
|
||||||
import jdk.test.lib.process.OutputAnalyzer;
|
import jdk.test.lib.process.OutputAnalyzer;
|
||||||
@ -34,7 +35,7 @@ import jdk.test.lib.process.OutputAnalyzer;
|
|||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @bug 8208091
|
* @bug 8208091
|
||||||
* @requires (os.family == "linux") & (vm.hasSAandCanAttach)
|
* @requires (os.family == "linux") & (vm.hasSA)
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @run main/othervm TestJhsdbJstackMixed
|
* @run main/othervm TestJhsdbJstackMixed
|
||||||
*/
|
*/
|
||||||
@ -135,8 +136,7 @@ public class TestJhsdbJstackMixed {
|
|||||||
launcher.addToolArg("--pid");
|
launcher.addToolArg("--pid");
|
||||||
launcher.addToolArg(Long.toString(app.getPid()));
|
launcher.addToolArg(Long.toString(app.getPid()));
|
||||||
|
|
||||||
ProcessBuilder pb = new ProcessBuilder();
|
ProcessBuilder pb = SATestUtils.createProcessBuilder(launcher);
|
||||||
pb.command(launcher.getCommand());
|
|
||||||
Process jhsdb = pb.start();
|
Process jhsdb = pb.start();
|
||||||
OutputAnalyzer out = new OutputAnalyzer(jhsdb);
|
OutputAnalyzer out = new OutputAnalyzer(jhsdb);
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ public class TestJhsdbJstackMixed {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String... args) throws Exception {
|
public static void main(String... args) throws Exception {
|
||||||
|
SATestUtils.skipIfCannotAttach(); // throws SkippedException if attach not expected to work.
|
||||||
LingeredApp app = null;
|
LingeredApp app = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -32,7 +32,7 @@ import jtreg.SkippedException;
|
|||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @requires vm.hasSAandCanAttach
|
* @requires vm.hasSA
|
||||||
* @requires vm.flavor == "server" & !vm.emulatedClient & !(vm.opt.TieredStopAtLevel == 1)
|
* @requires vm.flavor == "server" & !vm.emulatedClient & !(vm.opt.TieredStopAtLevel == 1)
|
||||||
* @build jdk.test.lib.apps.*
|
* @build jdk.test.lib.apps.*
|
||||||
* @run main/othervm TestPrintMdo
|
* @run main/othervm TestPrintMdo
|
||||||
@ -41,7 +41,6 @@ import jtreg.SkippedException;
|
|||||||
public class TestPrintMdo {
|
public class TestPrintMdo {
|
||||||
|
|
||||||
public static void main (String... args) throws Exception {
|
public static void main (String... args) throws Exception {
|
||||||
|
|
||||||
System.out.println("Starting TestPrintMdo test");
|
System.out.println("Starting TestPrintMdo test");
|
||||||
LingeredApp app = null;
|
LingeredApp app = null;
|
||||||
try {
|
try {
|
||||||
|
@ -34,12 +34,13 @@ import jdk.test.lib.JDKToolLauncher;
|
|||||||
import jdk.test.lib.Platform;
|
import jdk.test.lib.Platform;
|
||||||
import jdk.test.lib.process.OutputAnalyzer;
|
import jdk.test.lib.process.OutputAnalyzer;
|
||||||
import jdk.test.lib.process.ProcessTools;
|
import jdk.test.lib.process.ProcessTools;
|
||||||
|
import jdk.test.lib.SA.SATestUtils;
|
||||||
import jdk.test.lib.Utils;
|
import jdk.test.lib.Utils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @requires vm.hasSAandCanAttach & os.family != "mac"
|
* @requires vm.hasSA
|
||||||
* @modules java.base/jdk.internal.misc
|
* @modules java.base/jdk.internal.misc
|
||||||
* jdk.hotspot.agent/sun.jvm.hotspot
|
* jdk.hotspot.agent/sun.jvm.hotspot
|
||||||
* jdk.hotspot.agent/sun.jvm.hotspot.utilities
|
* jdk.hotspot.agent/sun.jvm.hotspot.utilities
|
||||||
@ -74,12 +75,14 @@ public class TestRevPtrsForInvokeDynamic {
|
|||||||
|
|
||||||
// Start a new process to attach to the lingered app
|
// Start a new process to attach to the lingered app
|
||||||
ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder(toolArgs);
|
ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder(toolArgs);
|
||||||
|
SATestUtils.addPrivilegesIfNeeded(processBuilder);
|
||||||
OutputAnalyzer SAOutput = ProcessTools.executeProcess(processBuilder);
|
OutputAnalyzer SAOutput = ProcessTools.executeProcess(processBuilder);
|
||||||
SAOutput.shouldHaveExitValue(0);
|
SAOutput.shouldHaveExitValue(0);
|
||||||
System.out.println(SAOutput.getOutput());
|
System.out.println(SAOutput.getOutput());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main (String... args) throws Exception {
|
public static void main (String... args) throws Exception {
|
||||||
|
SATestUtils.skipIfCannotAttach(); // throws SkippedException if attach not expected to work.
|
||||||
if (args == null || args.length == 0) {
|
if (args == null || args.length == 0) {
|
||||||
try {
|
try {
|
||||||
String[] vmArgs = Utils.appendTestJavaOpts("-XX:+UsePerfData");
|
String[] vmArgs = Utils.appendTestJavaOpts("-XX:+UsePerfData");
|
||||||
|
@ -33,7 +33,7 @@ import jtreg.SkippedException;
|
|||||||
* @test
|
* @test
|
||||||
* @summary Test the 'type' command of jhsdb clhsdb.
|
* @summary Test the 'type' command of jhsdb clhsdb.
|
||||||
* @bug 8190307
|
* @bug 8190307
|
||||||
* @requires vm.hasSAandCanAttach
|
* @requires vm.hasSA
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @build jdk.test.lib.apps.*
|
* @build jdk.test.lib.apps.*
|
||||||
* @run main/othervm TestType
|
* @run main/othervm TestType
|
||||||
|
@ -34,7 +34,7 @@ import sun.hotspot.gc.GC;
|
|||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @summary Test the 'universe' command of jhsdb clhsdb.
|
* @summary Test the 'universe' command of jhsdb clhsdb.
|
||||||
* @requires vm.hasSAandCanAttach
|
* @requires vm.hasSA
|
||||||
* @bug 8190307
|
* @bug 8190307
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @build jdk.test.lib.apps.*
|
* @build jdk.test.lib.apps.*
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -36,12 +36,13 @@ import jdk.test.lib.JDKToolLauncher;
|
|||||||
import jdk.test.lib.Platform;
|
import jdk.test.lib.Platform;
|
||||||
import jdk.test.lib.process.OutputAnalyzer;
|
import jdk.test.lib.process.OutputAnalyzer;
|
||||||
import jdk.test.lib.process.ProcessTools;
|
import jdk.test.lib.process.ProcessTools;
|
||||||
|
import jdk.test.lib.SA.SATestUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @bug 6313383
|
* @bug 6313383
|
||||||
* @key regression
|
* @key regression
|
||||||
* @requires vm.hasSAandCanAttach
|
* @requires vm.hasSA
|
||||||
* @summary Regression test for hprof export issue due to large heaps (>2G)
|
* @summary Regression test for hprof export issue due to large heaps (>2G)
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @modules java.base/jdk.internal.misc
|
* @modules java.base/jdk.internal.misc
|
||||||
@ -59,6 +60,7 @@ public class JMapHProfLargeHeapTest {
|
|||||||
private static final long G = 1024L * M;
|
private static final long G = 1024L * M;
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
SATestUtils.skipIfCannotAttach(); // throws SkippedException if attach not expected to work.
|
||||||
|
|
||||||
// All heap dumps should create 1.0.2 file format
|
// All heap dumps should create 1.0.2 file format
|
||||||
testHProfFileFormat("-Xmx1g", 22 * M, HPROF_HEADER_1_0_2);
|
testHProfFileFormat("-Xmx1g", 22 * M, HPROF_HEADER_1_0_2);
|
||||||
@ -101,8 +103,7 @@ public class JMapHProfLargeHeapTest {
|
|||||||
jMapLauncher.addToolArg("--pid");
|
jMapLauncher.addToolArg("--pid");
|
||||||
jMapLauncher.addToolArg(String.valueOf(pid));
|
jMapLauncher.addToolArg(String.valueOf(pid));
|
||||||
|
|
||||||
ProcessBuilder jMapProcessBuilder = new ProcessBuilder(
|
ProcessBuilder jMapProcessBuilder = SATestUtils.createProcessBuilder(jMapLauncher);
|
||||||
jMapLauncher.getCommand());
|
|
||||||
System.out.println("jmap command: "
|
System.out.println("jmap command: "
|
||||||
+ Arrays.toString(jMapLauncher.getCommand()));
|
+ Arrays.toString(jMapLauncher.getCommand()));
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -25,7 +25,7 @@
|
|||||||
* @test
|
* @test
|
||||||
* @bug 8209790
|
* @bug 8209790
|
||||||
* @summary Checks ability for connecting to debug server (jstack, jmap, jinfo, jsnap)
|
* @summary Checks ability for connecting to debug server (jstack, jmap, jinfo, jsnap)
|
||||||
* @requires vm.hasSAandCanAttach
|
* @requires vm.hasSA
|
||||||
* @requires os.family != "windows"
|
* @requires os.family != "windows"
|
||||||
* @modules java.base/jdk.internal.misc
|
* @modules java.base/jdk.internal.misc
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
@ -36,6 +36,7 @@
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import jdk.test.lib.JDKToolLauncher;
|
import jdk.test.lib.JDKToolLauncher;
|
||||||
|
import jdk.test.lib.SA.SATestUtils;
|
||||||
import jdk.test.lib.apps.LingeredApp;
|
import jdk.test.lib.apps.LingeredApp;
|
||||||
import jdk.test.lib.process.OutputAnalyzer;
|
import jdk.test.lib.process.OutputAnalyzer;
|
||||||
|
|
||||||
@ -52,7 +53,7 @@ public class DebugdConnectTest {
|
|||||||
jhsdbLauncher.addToolArg("localhost");
|
jhsdbLauncher.addToolArg("localhost");
|
||||||
}
|
}
|
||||||
|
|
||||||
Process jhsdb = (new ProcessBuilder(jhsdbLauncher.getCommand())).start();
|
Process jhsdb = (SATestUtils.createProcessBuilder(jhsdbLauncher)).start();
|
||||||
OutputAnalyzer out = new OutputAnalyzer(jhsdb);
|
OutputAnalyzer out = new OutputAnalyzer(jhsdb);
|
||||||
|
|
||||||
jhsdb.waitFor();
|
jhsdb.waitFor();
|
||||||
@ -110,6 +111,7 @@ public class DebugdConnectTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
SATestUtils.skipIfCannotAttach(); // throws SkippedException if attach not expected to work.
|
||||||
LingeredApp app = null;
|
LingeredApp app = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -26,7 +26,7 @@
|
|||||||
* @bug 8163805 8224252
|
* @bug 8163805 8224252
|
||||||
* @summary Checks that the jshdb debugd utility sucessfully starts
|
* @summary Checks that the jshdb debugd utility sucessfully starts
|
||||||
* and tries to attach to a running process
|
* and tries to attach to a running process
|
||||||
* @requires vm.hasSAandCanAttach
|
* @requires vm.hasSA
|
||||||
* @requires os.family != "windows"
|
* @requires os.family != "windows"
|
||||||
* @modules java.base/jdk.internal.misc
|
* @modules java.base/jdk.internal.misc
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
@ -38,13 +38,30 @@ import java.util.concurrent.TimeUnit;
|
|||||||
|
|
||||||
import jdk.test.lib.apps.LingeredApp;
|
import jdk.test.lib.apps.LingeredApp;
|
||||||
import jdk.test.lib.JDKToolLauncher;
|
import jdk.test.lib.JDKToolLauncher;
|
||||||
|
import jdk.test.lib.SA.SATestUtils;
|
||||||
import static jdk.test.lib.process.ProcessTools.startProcess;
|
import static jdk.test.lib.process.ProcessTools.startProcess;
|
||||||
|
|
||||||
|
import jtreg.SkippedException;
|
||||||
|
|
||||||
public class SADebugDTest {
|
public class SADebugDTest {
|
||||||
|
|
||||||
private static final String GOLDEN = "Debugger attached";
|
private static final String GOLDEN = "Debugger attached";
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
SATestUtils.skipIfCannotAttach(); // throws SkippedException if attach not expected to work.
|
||||||
|
|
||||||
|
if (SATestUtils.needsPrivileges()) {
|
||||||
|
// This tests has issues if you try adding privileges on OSX. The debugd process cannot
|
||||||
|
// be killed if you do this (because it is a root process and the test is not), so the destroy()
|
||||||
|
// call fails to do anything, and then waitFor() will time out. If you try to manually kill it with
|
||||||
|
// a "sudo kill" command, that seems to work, but then leaves the LingeredApp it was
|
||||||
|
// attached to in a stuck state for some unknown reason, causing the stopApp() call
|
||||||
|
// to timeout. For that reason we don't run this test when privileges are needed. Note
|
||||||
|
// it does appear to run fine as root, so we still allow it to run on OSX when privileges
|
||||||
|
// are not required.
|
||||||
|
throw new SkippedException("Cannot run this test on OSX if adding privileges is required.");
|
||||||
|
}
|
||||||
|
|
||||||
LingeredApp app = null;
|
LingeredApp app = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -55,11 +72,11 @@ public class SADebugDTest {
|
|||||||
jhsdbLauncher.addToolArg("debugd");
|
jhsdbLauncher.addToolArg("debugd");
|
||||||
jhsdbLauncher.addToolArg("--pid");
|
jhsdbLauncher.addToolArg("--pid");
|
||||||
jhsdbLauncher.addToolArg(Long.toString(app.getPid()));
|
jhsdbLauncher.addToolArg(Long.toString(app.getPid()));
|
||||||
ProcessBuilder pb = new ProcessBuilder(jhsdbLauncher.getCommand());
|
ProcessBuilder pb = SATestUtils.createProcessBuilder(jhsdbLauncher);
|
||||||
|
|
||||||
// The startProcess will block untl the 'golden' string appears in either process' stdout or stderr
|
// The startProcess will block untl the 'golden' string appears in either process' stdout or stderr
|
||||||
// In case of timeout startProcess kills the debugd process
|
// In case of timeout startProcess kills the debugd process
|
||||||
Process debugd = startProcess("debugd", pb, null, l -> l.contains(GOLDEN), 0, TimeUnit.SECONDS);
|
Process debugd = startProcess("debugd", pb, null, l -> l.contains(GOLDEN), 20, TimeUnit.SECONDS);
|
||||||
|
|
||||||
// If we are here, this means we have received the golden line and the test has passed
|
// If we are here, this means we have received the golden line and the test has passed
|
||||||
// The debugd remains running, we have to kill it
|
// The debugd remains running, we have to kill it
|
||||||
|
@ -51,7 +51,7 @@ public class TestMutuallyExclusivePlatformPredicates {
|
|||||||
VM_TYPE("isClient", "isServer", "isMinimal", "isZero", "isEmbedded"),
|
VM_TYPE("isClient", "isServer", "isMinimal", "isZero", "isEmbedded"),
|
||||||
MODE("isInt", "isMixed", "isComp"),
|
MODE("isInt", "isMixed", "isComp"),
|
||||||
IGNORED("isEmulatedClient", "isDebugBuild", "isFastDebugBuild",
|
IGNORED("isEmulatedClient", "isDebugBuild", "isFastDebugBuild",
|
||||||
"isSlowDebugBuild", "hasSA", "shouldSAAttach", "isTieredSupported",
|
"isSlowDebugBuild", "hasSA", "isRoot", "isTieredSupported",
|
||||||
"areCustomLoadersSupportedForCDS", "isDefaultCDSArchiveSupported",
|
"areCustomLoadersSupportedForCDS", "isDefaultCDSArchiveSupported",
|
||||||
"isSignedOSX");
|
"isSignedOSX");
|
||||||
|
|
||||||
|
@ -53,7 +53,6 @@ requires.properties= \
|
|||||||
vm.cds \
|
vm.cds \
|
||||||
vm.debug \
|
vm.debug \
|
||||||
vm.hasSA \
|
vm.hasSA \
|
||||||
vm.hasSAandCanAttach \
|
|
||||||
vm.hasJFR \
|
vm.hasJFR \
|
||||||
docker.support \
|
docker.support \
|
||||||
release.implementor
|
release.implementor
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
* @test
|
* @test
|
||||||
* @summary Basic test for jhsdb launcher
|
* @summary Basic test for jhsdb launcher
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @requires vm.hasSAandCanAttach
|
* @requires vm.hasSA
|
||||||
* @build jdk.test.lib.apps.*
|
* @build jdk.test.lib.apps.*
|
||||||
* @run main BasicLauncherTest
|
* @run main BasicLauncherTest
|
||||||
*/
|
*/
|
||||||
@ -43,6 +43,7 @@ import jdk.test.lib.process.ProcessTools;
|
|||||||
import jdk.test.lib.apps.LingeredApp;
|
import jdk.test.lib.apps.LingeredApp;
|
||||||
import jdk.test.lib.Platform;
|
import jdk.test.lib.Platform;
|
||||||
import jdk.test.lib.JDKToolLauncher;
|
import jdk.test.lib.JDKToolLauncher;
|
||||||
|
import jdk.test.lib.SA.SATestUtils;
|
||||||
import jdk.test.lib.Utils;
|
import jdk.test.lib.Utils;
|
||||||
|
|
||||||
public class BasicLauncherTest {
|
public class BasicLauncherTest {
|
||||||
@ -78,7 +79,7 @@ public class BasicLauncherTest {
|
|||||||
launcher.addToolArg("clhsdb");
|
launcher.addToolArg("clhsdb");
|
||||||
launcher.addToolArg("--pid=" + Long.toString(theApp.getPid()));
|
launcher.addToolArg("--pid=" + Long.toString(theApp.getPid()));
|
||||||
|
|
||||||
ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand());
|
ProcessBuilder processBuilder = SATestUtils.createProcessBuilder(launcher);
|
||||||
processBuilder.redirectError(ProcessBuilder.Redirect.INHERIT);
|
processBuilder.redirectError(ProcessBuilder.Redirect.INHERIT);
|
||||||
Process toolProcess = processBuilder.start();
|
Process toolProcess = processBuilder.start();
|
||||||
|
|
||||||
@ -122,13 +123,6 @@ public class BasicLauncherTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void launchJStack() throws IOException {
|
public static void launchJStack() throws IOException {
|
||||||
|
|
||||||
if (Platform.isOSX()) {
|
|
||||||
// Coredump stackwalking is not implemented for Darwin
|
|
||||||
System.out.println("This test is not expected to work on OS X. Skipping");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println("Starting LingeredApp");
|
System.out.println("Starting LingeredApp");
|
||||||
try {
|
try {
|
||||||
theApp = LingeredApp.startApp("-Xmx256m");
|
theApp = LingeredApp.startApp("-Xmx256m");
|
||||||
@ -139,7 +133,7 @@ public class BasicLauncherTest {
|
|||||||
launcher.addToolArg("jstack");
|
launcher.addToolArg("jstack");
|
||||||
launcher.addToolArg("--pid=" + Long.toString(theApp.getPid()));
|
launcher.addToolArg("--pid=" + Long.toString(theApp.getPid()));
|
||||||
|
|
||||||
ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand());
|
ProcessBuilder processBuilder = SATestUtils.createProcessBuilder(launcher);
|
||||||
OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);;
|
OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);;
|
||||||
output.shouldContain("No deadlocks found");
|
output.shouldContain("No deadlocks found");
|
||||||
output.shouldNotContain("illegal bci");
|
output.shouldNotContain("illegal bci");
|
||||||
@ -175,7 +169,7 @@ public class BasicLauncherTest {
|
|||||||
|
|
||||||
launcher.addToolArg("--pid=" + Long.toString(theApp.getPid()));
|
launcher.addToolArg("--pid=" + Long.toString(theApp.getPid()));
|
||||||
|
|
||||||
ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand());
|
ProcessBuilder processBuilder = SATestUtils.createProcessBuilder(launcher);
|
||||||
processBuilder.redirectError(ProcessBuilder.Redirect.INHERIT);
|
processBuilder.redirectError(ProcessBuilder.Redirect.INHERIT);
|
||||||
OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);;
|
OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);;
|
||||||
output.shouldContain(expectedMessage);
|
output.shouldContain(expectedMessage);
|
||||||
@ -198,6 +192,7 @@ public class BasicLauncherTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
SATestUtils.skipIfCannotAttach(); // throws SkippedException if attach not expected to work.
|
||||||
|
|
||||||
launchCLHSDB();
|
launchCLHSDB();
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
* @test
|
* @test
|
||||||
* @bug 8163346
|
* @bug 8163346
|
||||||
* @summary Test hashing of extended characters in Serviceability Agent.
|
* @summary Test hashing of extended characters in Serviceability Agent.
|
||||||
* @requires vm.hasSAandCanAttach
|
* @requires vm.hasSA
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @compile -encoding utf8 HeapDumpTest.java
|
* @compile -encoding utf8 HeapDumpTest.java
|
||||||
* @run main/timeout=240 HeapDumpTest
|
* @run main/timeout=240 HeapDumpTest
|
||||||
@ -38,12 +38,12 @@ import java.io.File;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import jdk.test.lib.Platform;
|
import jdk.test.lib.apps.LingeredApp;
|
||||||
|
import jdk.test.lib.hprof.parser.HprofReader;
|
||||||
import jdk.test.lib.JDKToolLauncher;
|
import jdk.test.lib.JDKToolLauncher;
|
||||||
import jdk.test.lib.process.OutputAnalyzer;
|
import jdk.test.lib.process.OutputAnalyzer;
|
||||||
import jdk.test.lib.process.ProcessTools;
|
import jdk.test.lib.process.ProcessTools;
|
||||||
import jdk.test.lib.apps.LingeredApp;
|
import jdk.test.lib.SA.SATestUtils;
|
||||||
import jdk.test.lib.hprof.parser.HprofReader;
|
|
||||||
|
|
||||||
public class HeapDumpTest {
|
public class HeapDumpTest {
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ public class HeapDumpTest {
|
|||||||
|
|
||||||
launcher.addToolArg("--pid=" + Long.toString(theApp.getPid()));
|
launcher.addToolArg("--pid=" + Long.toString(theApp.getPid()));
|
||||||
|
|
||||||
ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand());
|
ProcessBuilder processBuilder = SATestUtils.createProcessBuilder(launcher);
|
||||||
processBuilder.redirectError(ProcessBuilder.Redirect.INHERIT);
|
processBuilder.redirectError(ProcessBuilder.Redirect.INHERIT);
|
||||||
OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);
|
OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);
|
||||||
System.out.println("stdout:");
|
System.out.println("stdout:");
|
||||||
@ -125,7 +125,7 @@ public class HeapDumpTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
SATestUtils.skipIfCannotAttach(); // throws SkippedException if attach not expected to work.
|
||||||
testHeapDump();
|
testHeapDump();
|
||||||
|
|
||||||
// The test throws RuntimeException on error.
|
// The test throws RuntimeException on error.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -24,7 +24,7 @@
|
|||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @bug 8230731 8001227 8231635 8231634 8196969
|
* @bug 8230731 8001227 8231635 8231634 8196969
|
||||||
* @requires vm.hasSAandCanAttach
|
* @requires vm.hasSA
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @compile JShellHeapDumpTest.java
|
* @compile JShellHeapDumpTest.java
|
||||||
* @run main/timeout=240 JShellHeapDumpTest nosleep
|
* @run main/timeout=240 JShellHeapDumpTest nosleep
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -24,7 +24,7 @@
|
|||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @bug 8225715
|
* @bug 8225715
|
||||||
* @requires vm.hasSAandCanAttach
|
* @requires vm.hasSA
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @compile JShellHeapDumpTest.java
|
* @compile JShellHeapDumpTest.java
|
||||||
* @run main/timeout=240 JShellHeapDumpTest
|
* @run main/timeout=240 JShellHeapDumpTest
|
||||||
@ -38,11 +38,12 @@ import java.util.List;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import jdk.test.lib.hprof.parser.HprofReader;
|
||||||
import jdk.test.lib.JDKToolLauncher;
|
import jdk.test.lib.JDKToolLauncher;
|
||||||
import jdk.test.lib.JDKToolFinder;
|
import jdk.test.lib.JDKToolFinder;
|
||||||
import jdk.test.lib.process.OutputAnalyzer;
|
import jdk.test.lib.process.OutputAnalyzer;
|
||||||
import jdk.test.lib.process.ProcessTools;
|
import jdk.test.lib.process.ProcessTools;
|
||||||
import jdk.test.lib.hprof.parser.HprofReader;
|
import jdk.test.lib.SA.SATestUtils;
|
||||||
|
|
||||||
import jdk.jshell.JShell;
|
import jdk.jshell.JShell;
|
||||||
|
|
||||||
@ -67,7 +68,7 @@ public class JShellHeapDumpTest {
|
|||||||
|
|
||||||
launcher.addToolArg("--pid=" + Long.toString(jShellPID));
|
launcher.addToolArg("--pid=" + Long.toString(jShellPID));
|
||||||
|
|
||||||
ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand());
|
ProcessBuilder processBuilder = SATestUtils.createProcessBuilder(launcher);
|
||||||
OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);
|
OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);
|
||||||
System.out.println("jhsdb jmap stdout:");
|
System.out.println("jhsdb jmap stdout:");
|
||||||
System.out.println(output.getStdout());
|
System.out.println(output.getStdout());
|
||||||
@ -150,6 +151,7 @@ public class JShellHeapDumpTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
SATestUtils.skipIfCannotAttach(); // throws SkippedException if attach not expected to work.
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
if (args[0].equals("nosleep")) {
|
if (args[0].equals("nosleep")) {
|
||||||
doSleep = false;
|
doSleep = false;
|
||||||
|
@ -30,15 +30,15 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import jdk.test.lib.apps.LingeredApp;
|
import jdk.test.lib.apps.LingeredApp;
|
||||||
|
import jdk.test.lib.SA.SATestUtils;
|
||||||
import jdk.test.lib.Utils;
|
import jdk.test.lib.Utils;
|
||||||
import jdk.test.lib.Platform;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @bug 8042397
|
* @bug 8042397
|
||||||
* @summary Unit test for jmap utility test heap configuration reader
|
* @summary Unit test for jmap utility test heap configuration reader
|
||||||
*
|
*
|
||||||
* @requires vm.hasSAandCanAttach
|
* @requires vm.hasSA
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @modules java.management
|
* @modules java.management
|
||||||
* jdk.hotspot.agent/sun.jvm.hotspot
|
* jdk.hotspot.agent/sun.jvm.hotspot
|
||||||
@ -120,6 +120,7 @@ public class JMapHeapConfigTest {
|
|||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
System.out.println("Starting JMapHeapConfigTest");
|
System.out.println("Starting JMapHeapConfigTest");
|
||||||
|
SATestUtils.skipIfCannotAttach(); // throws SkippedException if attach not expected to work.
|
||||||
|
|
||||||
if (!LingeredApp.isLastModifiedWorking()) {
|
if (!LingeredApp.isLastModifiedWorking()) {
|
||||||
// Exact behaviour of the test depends to operating system and the test nature,
|
// Exact behaviour of the test depends to operating system and the test nature,
|
||||||
|
@ -35,6 +35,7 @@ import java.util.logging.Logger;
|
|||||||
|
|
||||||
import jdk.test.lib.apps.LingeredApp;
|
import jdk.test.lib.apps.LingeredApp;
|
||||||
import jdk.test.lib.JDKToolLauncher;
|
import jdk.test.lib.JDKToolLauncher;
|
||||||
|
import jdk.test.lib.SA.SATestUtils;
|
||||||
import jdk.test.lib.Utils;
|
import jdk.test.lib.Utils;
|
||||||
|
|
||||||
public class TmtoolTestScenario {
|
public class TmtoolTestScenario {
|
||||||
@ -110,8 +111,8 @@ public class TmtoolTestScenario {
|
|||||||
launcher.addToolArg("--pid");
|
launcher.addToolArg("--pid");
|
||||||
launcher.addToolArg(Long.toString(theApp.getPid()));
|
launcher.addToolArg(Long.toString(theApp.getPid()));
|
||||||
|
|
||||||
ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand());
|
ProcessBuilder processBuilder = SATestUtils.createProcessBuilder(launcher);
|
||||||
processBuilder.redirectError(ProcessBuilder.Redirect.INHERIT);
|
processBuilder.redirectError(ProcessBuilder.Redirect.INHERIT);
|
||||||
Process toolProcess = processBuilder.start();
|
Process toolProcess = processBuilder.start();
|
||||||
|
|
||||||
// By default child process output stream redirected to pipe, so we are reading it in foreground.
|
// By default child process output stream redirected to pipe, so we are reading it in foreground.
|
||||||
|
@ -27,19 +27,19 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
import jdk.test.lib.apps.LingeredApp;
|
import jdk.test.lib.apps.LingeredApp;
|
||||||
import jdk.test.lib.apps.LingeredAppWithDeadlock;
|
import jdk.test.lib.apps.LingeredAppWithDeadlock;
|
||||||
import jdk.test.lib.Platform;
|
import jdk.test.lib.JDKToolLauncher;
|
||||||
import jdk.test.lib.process.OutputAnalyzer;
|
import jdk.test.lib.process.OutputAnalyzer;
|
||||||
import jdk.test.lib.process.ProcessTools;
|
import jdk.test.lib.process.ProcessTools;
|
||||||
|
|
||||||
import jdk.test.lib.Utils;
|
import jdk.test.lib.Utils;
|
||||||
import jdk.test.lib.JDKToolLauncher;
|
|
||||||
|
import jtreg.SkippedException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @summary Test deadlock detection
|
* @summary Test deadlock detection
|
||||||
* @requires vm.hasSAandCanAttach
|
* @requires vm.hasSA
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @build jdk.test.lib.apps.* jdk.test.lib.Platform
|
* @build jdk.test.lib.apps.*
|
||||||
* @build DeadlockDetectionTest
|
* @build DeadlockDetectionTest
|
||||||
* @run main DeadlockDetectionTest
|
* @run main DeadlockDetectionTest
|
||||||
*/
|
*/
|
||||||
@ -83,13 +83,11 @@ public class DeadlockDetectionTest {
|
|||||||
System.out.println(output.getOutput());
|
System.out.println(output.getOutput());
|
||||||
|
|
||||||
if (output.getExitValue() == 3) {
|
if (output.getExitValue() == 3) {
|
||||||
System.out.println("Test can't run for some reason. Skipping");
|
throw new SkippedException("Test can't run for some reason");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
output.shouldHaveExitValue(0);
|
output.shouldHaveExitValue(0);
|
||||||
output.shouldContain("Found 1 deadlock.");
|
output.shouldContain("Found 1 deadlock.");
|
||||||
}
|
}
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
LingeredApp.stopApp(theApp);
|
LingeredApp.stopApp(theApp);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -96,9 +96,6 @@ public class VMProps implements Callable<Map<String, String>> {
|
|||||||
// vm.hasSA is "true" if the VM contains the serviceability agent
|
// vm.hasSA is "true" if the VM contains the serviceability agent
|
||||||
// and jhsdb.
|
// and jhsdb.
|
||||||
map.put("vm.hasSA", this::vmHasSA);
|
map.put("vm.hasSA", this::vmHasSA);
|
||||||
// vm.hasSAandCanAttach is "true" if the VM contains the serviceability agent
|
|
||||||
// and jhsdb and it can attach to the VM.
|
|
||||||
map.put("vm.hasSAandCanAttach", this::vmHasSAandCanAttach);
|
|
||||||
// vm.hasJFR is "true" if JFR is included in the build of the VM and
|
// vm.hasJFR is "true" if JFR is included in the build of the VM and
|
||||||
// so tests can be executed.
|
// so tests can be executed.
|
||||||
map.put("vm.hasJFR", this::vmHasJFR);
|
map.put("vm.hasJFR", this::vmHasJFR);
|
||||||
@ -318,19 +315,6 @@ public class VMProps implements Callable<Map<String, String>> {
|
|||||||
return "" + Platform.hasSA();
|
return "" + Platform.hasSA();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return "true" if VM has a serviceability agent and it can
|
|
||||||
* attach to the VM.
|
|
||||||
*/
|
|
||||||
protected String vmHasSAandCanAttach() {
|
|
||||||
try {
|
|
||||||
return "" + Platform.shouldSAAttach();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return errorWithMessage("Checking whether SA can attach to the VM failed.:" + e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return "true" if the VM is compiled with Java Flight Recorder (JFR)
|
* @return "true" if the VM is compiled with Java Flight Recorder (JFR)
|
||||||
* support.
|
* support.
|
||||||
|
@ -26,15 +26,12 @@ package jdk.test.lib;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.RandomAccessFile;
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
import java.security.AccessController;
|
import java.security.AccessController;
|
||||||
import java.security.PrivilegedAction;
|
import java.security.PrivilegedAction;
|
||||||
import java.security.PrivilegedActionException;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.security.PrivilegedExceptionAction;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class Platform {
|
public class Platform {
|
||||||
public static final String vmName = privilegedGetProperty("java.vm.name");
|
public static final String vmName = privilegedGetProperty("java.vm.name");
|
||||||
@ -217,6 +214,10 @@ public class Platform {
|
|||||||
return osArch;
|
return osArch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isRoot() {
|
||||||
|
return userName.equals("root");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a boolean for whether SA and jhsdb are ported/available
|
* Return a boolean for whether SA and jhsdb are ported/available
|
||||||
* on this platform.
|
* on this platform.
|
||||||
@ -286,77 +287,6 @@ public class Platform {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a boolean for whether we expect to be able to attach
|
|
||||||
* the SA to our own processes on this system. This requires
|
|
||||||
* that SA is ported/available on this platform.
|
|
||||||
*/
|
|
||||||
public static boolean shouldSAAttach() throws IOException {
|
|
||||||
if (!hasSA()) return false;
|
|
||||||
if (isLinux()) {
|
|
||||||
return canPtraceAttachLinux();
|
|
||||||
} else if (isOSX()) {
|
|
||||||
return canAttachOSX() && !isSignedOSX();
|
|
||||||
} else {
|
|
||||||
// Other platforms expected to work:
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* On Linux, first check the SELinux boolean "deny_ptrace" and return false
|
|
||||||
* as we expect to be denied if that is "1". Then expect permission to attach
|
|
||||||
* if we are root, so return true. Then return false for an expected denial
|
|
||||||
* if "ptrace_scope" is 1, and true otherwise.
|
|
||||||
*/
|
|
||||||
private static boolean canPtraceAttachLinux() throws IOException {
|
|
||||||
// SELinux deny_ptrace:
|
|
||||||
File deny_ptrace = new File("/sys/fs/selinux/booleans/deny_ptrace");
|
|
||||||
if (deny_ptrace.exists()) {
|
|
||||||
try (RandomAccessFile file = AccessController.doPrivileged(
|
|
||||||
(PrivilegedExceptionAction<RandomAccessFile>) () -> new RandomAccessFile(deny_ptrace, "r"))) {
|
|
||||||
if (file.readByte() != '0') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} catch (PrivilegedActionException e) {
|
|
||||||
IOException t = (IOException) e.getException();
|
|
||||||
throw t;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// YAMA enhanced security ptrace_scope:
|
|
||||||
// 0 - a process can PTRACE_ATTACH to any other process running under the same uid
|
|
||||||
// 1 - restricted ptrace: a process must be a children of the inferior or user is root
|
|
||||||
// 2 - only processes with CAP_SYS_PTRACE may use ptrace or user is root
|
|
||||||
// 3 - no attach: no processes may use ptrace with PTRACE_ATTACH
|
|
||||||
File ptrace_scope = new File("/proc/sys/kernel/yama/ptrace_scope");
|
|
||||||
if (ptrace_scope.exists()) {
|
|
||||||
try (RandomAccessFile file = AccessController.doPrivileged(
|
|
||||||
(PrivilegedExceptionAction<RandomAccessFile>) () -> new RandomAccessFile(ptrace_scope, "r"))) {
|
|
||||||
byte yama_scope = file.readByte();
|
|
||||||
if (yama_scope == '3') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!userName.equals("root") && yama_scope != '0') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} catch (PrivilegedActionException e) {
|
|
||||||
IOException t = (IOException) e.getException();
|
|
||||||
throw t;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Otherwise expect to be permitted:
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* On OSX, expect permission to attach only if we are root.
|
|
||||||
*/
|
|
||||||
private static boolean canAttachOSX() {
|
|
||||||
return userName.equals("root");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean isArch(String archnameRE) {
|
private static boolean isArch(String archnameRE) {
|
||||||
return Pattern.compile(archnameRE, Pattern.CASE_INSENSITIVE)
|
return Pattern.compile(archnameRE, Pattern.CASE_INSENSITIVE)
|
||||||
.matcher(osArch)
|
.matcher(osArch)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -26,64 +26,187 @@ import java.io.File;
|
|||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.RandomAccessFile;
|
||||||
|
import java.security.AccessController;
|
||||||
|
import java.security.PrivilegedAction;
|
||||||
|
import java.security.PrivilegedActionException;
|
||||||
|
import java.security.PrivilegedExceptionAction;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
import jdk.test.lib.Asserts;
|
import jdk.test.lib.Asserts;
|
||||||
|
import jdk.test.lib.JDKToolLauncher;
|
||||||
import jdk.test.lib.Platform;
|
import jdk.test.lib.Platform;
|
||||||
|
import jdk.test.lib.process.OutputAnalyzer;
|
||||||
|
import jdk.test.lib.process.ProcessTools;
|
||||||
import jtreg.SkippedException;
|
import jtreg.SkippedException;
|
||||||
|
|
||||||
public class SATestUtils {
|
public class SATestUtils {
|
||||||
|
/**
|
||||||
|
* Creates a ProcessBuilder, adding privileges (sudo) if needed.
|
||||||
|
*/
|
||||||
|
public static ProcessBuilder createProcessBuilder(JDKToolLauncher launcher) {
|
||||||
|
List<String> cmdStringList = Arrays.asList(launcher.getCommand());
|
||||||
|
if (needsPrivileges()) {
|
||||||
|
cmdStringList = addPrivileges(cmdStringList);
|
||||||
|
}
|
||||||
|
return new ProcessBuilder(cmdStringList);
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean canAddPrivileges()
|
/**
|
||||||
throws IOException, InterruptedException {
|
* Checks if SA Attach is expected to work.
|
||||||
List<String> echoList = new ArrayList<String>();
|
* @throws SkippedException if SA Attach is not expected to work.
|
||||||
echoList.add("sudo");
|
*/
|
||||||
echoList.add("-E");
|
public static void skipIfCannotAttach() {
|
||||||
echoList.add("/bin/echo");
|
if (!Platform.hasSA()) {
|
||||||
echoList.add("'Checking for sudo'");
|
throw new SkippedException("SA not supported.");
|
||||||
ProcessBuilder pb = new ProcessBuilder(echoList);
|
}
|
||||||
|
try {
|
||||||
|
if (Platform.isLinux()) {
|
||||||
|
if (!canPtraceAttachLinux()) {
|
||||||
|
throw new SkippedException("SA Attach not expected to work. Ptrace attach not supported.");
|
||||||
|
}
|
||||||
|
} else if (Platform.isOSX()) {
|
||||||
|
if (Platform.isSignedOSX()) {
|
||||||
|
throw new SkippedException("SA Attach not expected to work. JDK is signed.");
|
||||||
|
}
|
||||||
|
if (!Platform.isRoot() && !canAddPrivileges()) {
|
||||||
|
throw new SkippedException("SA Attach not expected to work. Insufficient privileges (not root and can't use sudo).");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException("skipIfCannotAttach() failed due to IOException.", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if this platform is expected to require extra privileges (running using sudo).
|
||||||
|
*/
|
||||||
|
public static boolean needsPrivileges() {
|
||||||
|
return Platform.isOSX() && !Platform.isRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if a no-password sudo is expected to work properly.
|
||||||
|
*/
|
||||||
|
private static boolean canAddPrivileges() throws IOException {
|
||||||
|
List<String> sudoList = new ArrayList<String>();
|
||||||
|
sudoList.add("sudo");
|
||||||
|
sudoList.add("-E"); // Preserve existing environment variables.
|
||||||
|
sudoList.add("-n"); // non-interactive. Don't prompt for password. Must be cached or not required.
|
||||||
|
sudoList.add("/bin/echo");
|
||||||
|
sudoList.add("'Checking for sudo'");
|
||||||
|
ProcessBuilder pb = new ProcessBuilder(sudoList);
|
||||||
Process echoProcess = pb.start();
|
Process echoProcess = pb.start();
|
||||||
if (echoProcess.waitFor(60, TimeUnit.SECONDS) == false) {
|
try {
|
||||||
// 'sudo' has been added but we don't have a no-password
|
if (echoProcess.waitFor(60, TimeUnit.SECONDS) == false) {
|
||||||
// entry for the user in the /etc/sudoers list. Could
|
// Due to using the "-n" option, sudo should complete almost immediately. 60 seconds
|
||||||
// have timed out waiting for the password. Skip the
|
// is more than generous. If it didn't complete in that time, something went very wrong.
|
||||||
// test if there is a timeout here.
|
echoProcess.destroyForcibly();
|
||||||
System.out.println("Timed out waiting for the password to be entered.");
|
throw new RuntimeException("Timed out waiting for sudo to execute.");
|
||||||
echoProcess.destroyForcibly();
|
}
|
||||||
return false;
|
} catch (InterruptedException e) {
|
||||||
|
throw new RuntimeException("sudo process interrupted", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (echoProcess.exitValue() == 0) {
|
if (echoProcess.exitValue() == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
java.io.InputStream is = echoProcess.getErrorStream();
|
java.io.InputStream is = echoProcess.getErrorStream();
|
||||||
String err = new String(is.readAllBytes());
|
String err = new String(is.readAllBytes());
|
||||||
System.out.println(err);
|
System.out.println(err);
|
||||||
// 'sudo' has been added but we don't have a no-password
|
// 'sudo' has been run, but did not succeed, probably because the cached credentials
|
||||||
// entry for the user in the /etc/sudoers list. Check for
|
// have expired, or we don't have a no-password entry for the user in the /etc/sudoers list.
|
||||||
// the sudo error message and skip the test.
|
// Check the sudo error message and skip the test.
|
||||||
if (err.contains("no tty present") ||
|
if (err.contains("no tty present") || err.contains("a password is required")) {
|
||||||
err.contains("a password is required")) {
|
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
throw new Error("Unknown Error from 'sudo'");
|
throw new RuntimeException("Unknown error from 'sudo': " + err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> addPrivileges(List<String> cmdStringList)
|
/**
|
||||||
throws IOException {
|
* Adds privileges (sudo) to the command.
|
||||||
Asserts.assertTrue(Platform.isOSX());
|
*/
|
||||||
|
private static List<String> addPrivileges(List<String> cmdStringList) {
|
||||||
|
if (!Platform.isOSX()) {
|
||||||
|
throw new RuntimeException("Can only add privileges on OSX.");
|
||||||
|
}
|
||||||
|
|
||||||
System.out.println("Adding 'sudo -E' to the command.");
|
System.out.println("Adding 'sudo -E -n' to the command.");
|
||||||
List<String> outStringList = new ArrayList<String>();
|
List<String> outStringList = new ArrayList<String>();
|
||||||
outStringList.add("sudo");
|
outStringList.add("sudo");
|
||||||
outStringList.add("-E");
|
outStringList.add("-E"); // Preserve existing environment variables.
|
||||||
|
outStringList.add("-n"); // non-interactive. Don't prompt for password. Must be cached or not required.
|
||||||
outStringList.addAll(cmdStringList);
|
outStringList.addAll(cmdStringList);
|
||||||
return outStringList;
|
return outStringList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds privileges (sudo) to the command already setup for the ProcessBuilder.
|
||||||
|
*/
|
||||||
|
public static void addPrivilegesIfNeeded(ProcessBuilder pb) {
|
||||||
|
if (!Platform.isOSX()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (needsPrivileges()) {
|
||||||
|
List<String> cmdStringList = pb.command();
|
||||||
|
cmdStringList = addPrivileges(cmdStringList);
|
||||||
|
pb.command(cmdStringList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On Linux, first check the SELinux boolean "deny_ptrace" and return false
|
||||||
|
* as we expect to be denied if that is "1". Then expect permission to attach
|
||||||
|
* if we are root, so return true. Then return false for an expected denial
|
||||||
|
* if "ptrace_scope" is 1, and true otherwise.
|
||||||
|
*/
|
||||||
|
private static boolean canPtraceAttachLinux() throws IOException {
|
||||||
|
// SELinux deny_ptrace:
|
||||||
|
File deny_ptrace = new File("/sys/fs/selinux/booleans/deny_ptrace");
|
||||||
|
if (deny_ptrace.exists()) {
|
||||||
|
try (RandomAccessFile file = AccessController.doPrivileged(
|
||||||
|
(PrivilegedExceptionAction<RandomAccessFile>) () -> new RandomAccessFile(deny_ptrace, "r"))) {
|
||||||
|
if (file.readByte() != '0') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} catch (PrivilegedActionException e) {
|
||||||
|
IOException t = (IOException) e.getException();
|
||||||
|
throw t;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// YAMA enhanced security ptrace_scope:
|
||||||
|
// 0 - a process can PTRACE_ATTACH to any other process running under the same uid
|
||||||
|
// 1 - restricted ptrace: a process must be a children of the inferior or user is root
|
||||||
|
// 2 - only processes with CAP_SYS_PTRACE may use ptrace or user is root
|
||||||
|
// 3 - no attach: no processes may use ptrace with PTRACE_ATTACH
|
||||||
|
File ptrace_scope = new File("/proc/sys/kernel/yama/ptrace_scope");
|
||||||
|
if (ptrace_scope.exists()) {
|
||||||
|
try (RandomAccessFile file = AccessController.doPrivileged(
|
||||||
|
(PrivilegedExceptionAction<RandomAccessFile>) () -> new RandomAccessFile(ptrace_scope, "r"))) {
|
||||||
|
byte yama_scope = file.readByte();
|
||||||
|
if (yama_scope == '3') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Platform.isRoot() && yama_scope != '0') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} catch (PrivilegedActionException e) {
|
||||||
|
IOException t = (IOException) e.getException();
|
||||||
|
throw t;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Otherwise expect to be permitted:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public static void unzipCores(File dir) {
|
public static void unzipCores(File dir) {
|
||||||
File[] gzCores = dir.listFiles((directory, name) -> name.matches("core(\\.\\d+)?\\.gz"));
|
File[] gzCores = dir.listFiles((directory, name) -> name.matches("core(\\.\\d+)?\\.gz"));
|
||||||
for (File gzCore : gzCores) {
|
for (File gzCore : gzCores) {
|
||||||
|
Loading…
Reference in New Issue
Block a user