RFR [6943190] TEST_BUG: java/lang/Runtime/exec/ExecWithInput.java hardcodes path to cat

Alan Bateman Alan.Bateman at oracle.com
Thu Mar 20 13:09:08 UTC 2014

On 20/03/2014 07:25, Ivan Gerasimov wrote:
> Now I've got two suggestions that somehow contradict each other.
> Martin suggested to check for particular OS only as a last resort, but 
> without knowing that we run under Unix, we cannot treat a command 
> absence as an error.
It's always hard to get complete agreement on things like this but for 
tests that are *nix specific then I would say that it's better to check 
it at the start and have it just pass on Windows without needlessly 
checking for programs that don't exist or can't be used by the test.

> I think we can assume that none of the tests which need UnixCommands 
> are for Windows, so I added explicit checking for that.
> Having made sure the OS is a Unix (i.e. not Windows), the absence of a 
> required command now causes an exception to be thrown.
> Would you please take a look at the updated webrev?
> http://cr.openjdk.java.net/~igerasim/6943190/6/webrev/
This looks okay to me. An alternative would be for findCommand to throw 
an exception when the command is not found  and that would allow most of 
the ensureCommandAvailables(...) usages to be removed and saves 
searching for them twice.


More information about the core-libs-dev mailing list