On Tue, 5 Mar 2024 20:34:47 GMT, Vladimir Petko <vpe...@openjdk.org> wrote:

> > The change in jspawnhelper looks good.
> > I think it would be simpler to have a separate 
> > `jdk/java/lang/ProcessBuilder/JspawnhelperMisuse.java` test that simply 
> > invokes the `jspawnhelper` and verifies the proper message is printed. It 
> > would be more straightforward than trying to fit the _protocol_ test? Plus, 
> > we can test 0, 1, 3, 4 args, not only 0 args in that test, and we can also 
> > test 2 args with bad format.
> 
> Yes, this makes the test cleaner[1]. 

Note that we have `OutputAnalyzer` for these test cases: 
https://github.com/openjdk/jdk/blob/master/test/lib/jdk/test/lib/process/OutputAnalyzer.java
 -- lots of test use it, and it would be something like just:


  Process p = ProcessTools.startProcess(...);
  OutputAnalyzer oa = new OutputAnalyzer(p);
  oa.shouldNotHaveExitValue(0);
  oa.shouldContain("This command is not for general use");

-------------

PR Comment: https://git.openjdk.org/jdk/pull/18112#issuecomment-1980434240

Reply via email to