JDK-8199700 : SA: Enable jhsdb jtreg tests for Mac OS X
  • Type: Bug
  • Component: hotspot
  • Sub-Component: svc-agent
  • Affected Version: 11
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: os_x
  • CPU: x86_64
  • Submitted: 2018-03-15
  • Updated: 2020-03-13
  • Resolved: 2020-03-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdResolved
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
Is there a way we can enable the jhsdb tests like open/test/hotspot/jtreg/serviceability/sa tests on Mac?

If I run it right now I get:

----------System.out:(1/47)----------
SA attach not expected to work - test skipped.
----------System.err:(1/15)----------
STATUS:Passed.

because the test is skipped, since we don't run them as root, as determined in /test/lib/jdk/test/lib/Platform.java:

    private static boolean canAttachOSX() {
        return userName.equals("root");
    }

It would be useful to have the tests actually running on Mac OS X, for greater coverage (assuming jhsdb is supported on Mac)

This applies to running the test via Mach5 and locally using "/jtreg/bin/jtreg ...", though locally one can run it as "sudo /jtreg/bin/jtreg ..." and it will indeed execute, but this should be done by default somehow (if possible).
Comments
This is a duplicate of JDK-8238268, which I'll be pushing a fix for shortly.
13-03-2020

Making modifications to: - create SATestUtils to add sudo privileges to the launchers for OSX if Platform.shouldSAAttach() fails. - Refactor some tests using 'clhsdb' to use the ClhsdbLauncher for uniformity and easier maintainence. - ClhsdbLauncher runCmd() method to test for regular expressions with shouldMatch rather than shouldContain. Modified certain tests to check for regexs. - ClhsdbLauncher runOnCore() to not check for Platform.shouldSAAttach() since sudo privileges are not needed to read corefiles. - Enable OSX tests for tests skipped for forgotten reasons. - Avoid fake passes. With these changes, the test errors out if there is an attach failure. Leaving TestClassDump.java intact at this point. Running this on OSX (without an external sudo) causes the directories containing the SA generated class files to be retained and causes cleanup related errors. This will be taken up as a separate issue.
09-07-2018

Adding sudo before the launcher command in ClhsdbLauncher.java and skipping Platform.shouldSAAttach() causes the test to execute in Mach5 for OSX.
09-07-2018