RFR (S) 8007142: Add utility classes for writing better multiprocess tests in jtreg

Yekaterina Kantserova yekaterina.kantserova at oracle.com
Mon Feb 4 10:33:16 UTC 2013


On 02/01/2013 04:18 PM, Alan Bateman wrote:
> On 01/02/2013 15:06, Yekaterina Kantserova wrote:
>>
>> Thanks for explanation! But I'm still confused.
>>
>> In my use case I need to test /_the tool_/ I'll find with 
>> JDKToolFinder. It will work if just -jdk will be specified. But if 
>> -compilejdk happens to be specified the results of my tests will be 
>> useless. Furthermore, it would be hard to detect. Do you think there 
>> is a solution that covers all use cases?
> I don't think it make sense to specify -compilejdk and not -jdk. Does 
> that help?
>
> -Alan

No, it was a bad example. Let's take another one:

/java -jar jtreg.jar -jdk MONKEY -compilejdk LION test.java/

In this case JDKToolFinder.getJDKTool("jcmd") will return LION/bin/jcmd, 
but I need to test MONKEY/bin/jcmd.

There is an example in ProcessTools.java:

...
     /**
      * Create ProcessBuilder using *the java launcher from the jdk to 
be tested*
      * and with any platform specific arguments prepended
      */
     public static ProcessBuilder createJavaProcessBuilder(String... 
command)
             throws Exception {
         String javapath = JDKToolFinder.getJDKTool("java");

         ArrayList<String> args = new ArrayList<>();
         args.add(javapath);
         Collections.addAll(args, getPlatformSpecificVMArgs());
         Collections.addAll(args, command);

         return new ProcessBuilder(args.toArray(new String[args.size()]));

     }
...


May be we need another solution for testing a JRE? JREToolFinder for 
example, which can be implemented later?

Thanks,
Katja



More information about the core-libs-dev mailing list