jtreg for Mac OS X

Mike Swingler swingler at apple.com
Wed Feb 22 14:02:16 PST 2012

On Feb 22, 2012, at 1:48 PM, Jonathan Gibbons wrote:

> I'm updating the jtreg FAQ, http://openjdk.java.net/jtreg/faq.html
> and notice a couple of questions that need to be updated for the Mac.
> Would someone care to provide the details necessary to update
> question 4.7 http://openjdk.java.net/jtreg/faq.html#question4.7
> and question 4.13 http://openjdk.java.net/jtreg/faq.html#question4.13

The appropriate checks are:

In Java: osName.contains("OS X")
In shell: uname -s == Darwin

While Darwin will also cover the non-graphical Darwin OS, for all intents and purposes, Darwin is accurate enough for the OpenJDK project.

To be perfectly pedantic from the command line, you can always use the sw_vers tool, but that does not exist on other platforms:
% sw_vers -productName

This will return "Mac OS X", and "Mac OS X Server" in currently released versions of Mac OS X. It's value should precisely match System.getProperty("os.name").

Mike Swingler
Apple Inc.

More information about the macosx-port-dev mailing list