-
Bug
-
Resolution: Fixed
-
P3
-
15
-
b15
-
os_x
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8297239 | 11.0.19-oracle | Adithya Haradi Gopal | P3 | Resolved | Fixed | b01 |
JDK-8291704 | 11.0.17 | Christoph Langer | P3 | Resolved | Fixed | b01 |
Another option when not running as root is for the test to attempt to use sudo. We actually already support this in the tests that use ClhsdbLauncher. Instead of using "@require vm.hasSAandCanAttach", they do the equivalent of the vm.hasSAandCanAttach check from within the test by checking Platform.shouldSAAttach(). If it returns true, then the test can run. If it returns false and we are on OSX, then the tests query SATestUtils.canAddPrivileges(), which is basically a test to see if sudo will work. If it does work, then we also allow the test to run, and make sure the test runs the clhsdb command under sudo. All of this is handled by the following code ClhsdbLauncher:
if (!Platform.shouldSAAttach()) {
if (Platform.isOSX() && SATestUtils.canAddPrivileges()) {
needPrivileges = true;
}
else {
// 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.");
}
And then for execution of clhsdb
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jhsdb");
launcher.addToolArg("clhsdb");
if (lingeredAppPid != -1) {
launcher.addToolArg("--pid=" + Long.toString(lingeredAppPid));
System.out.println("Starting clhsdb against " + lingeredAppPid);
}
List<String> cmdStringList = Arrays.asList(launcher.getCommand());
if (needPrivileges) {
cmdStringList = SATestUtils.addPrivileges(cmdStringList);
}
ProcessBuilder processBuilder = new ProcessBuilder(cmdStringList);
toolProcess = processBuilder.start();
We should modify non-ClhsdbLauncher tests to do the same as ClhsdbLauncher and use sudo if not running as root. We can move the SATestUtils.canAddPrivileges() check into vm.hasSAandCanAttach, and then have the test always use sudo if not running as root.
- backported by
-
JDK-8291704 Many SA tests are not running on OSX because they do not attempt to use sudo when available
-
- Resolved
-
-
JDK-8297239 Many SA tests are not running on OSX because they do not attempt to use sudo when available
-
- Resolved
-
- duplicates
-
JDK-8199700 SA: Enable jhsdb jtreg tests for Mac OS X
-
- Closed
-
-
JDK-8216545 SA: Enable the remaining tests on macOS
-
- Closed
-
- is blocked by
-
JDK-8239379 ProblemList serviceability/sa/sadebugd/DebugdConnectTest.java on OSX
-
- Resolved
-
-
JDK-8271512 ProblemList serviceability/sa/sadebugd/DebugdConnectTest.java due to 8270326
-
- Resolved
-
- relates to
-
JDK-8271512 ProblemList serviceability/sa/sadebugd/DebugdConnectTest.java due to 8270326
-
- Resolved
-
-
JDK-8239379 ProblemList serviceability/sa/sadebugd/DebugdConnectTest.java on OSX
-
- Resolved
-
-
JDK-8239062 jhsdb jstack does not work with debugd server on OSX
-
- Open
-
-
JDK-8241158 SA TestHeapDumpForInvokeDynamic.java fails when CDS archive is relocated
-
- Resolved
-
-
JDK-8237250 pmap and pstack should do a better of making it clear that they are not supported on Mac OS X
-
- Resolved
-
-
JDK-8313357 Revisit requiring SA tests on OSX to either run as root or use sudo
-
- Resolved
-