[crac] RFR: Convert CRaC tests from shell scripts to Java

Anton Kozlov akozlov at openjdk.org
Thu Mar 2 16:52:55 UTC 2023


On Wed, 1 Mar 2023 07:52:19 GMT, Radim Vansa <duke at openjdk.org> wrote:

>> test/jdk/jdk/crac/LazyProps.java line 37:
>> 
>>> 35:     public static void main(String[] args) throws Exception {
>>> 36:         CracTest.run(LazyProps.class, args);
>>> 37:     }
>> 
>> I assume this is the pattern that every test should be following. Is it possible to avoid this boiler plate by e.g. 
>> 
>> @run driver CracTest LazyProps
>> 
>> and by making CracTest.main to look for the class?
>
> Good idea! From docs I didn't really get what's the difference between `@run driver` and `@run main`, do you know?

I have not tried that myself, but from jtreg FAQ [1]

> ... `@run driver`. This is the same as `@run main` with the exception that any VM options specified on the command line will not be used when running the specified class.

Since we won't provide VM options, AFAIU there is no effective difference, but using `driver` specifies the intent better.

[1] https://openjdk.org/jtreg/faq.html

>> test/jdk/jdk/crac/LazyProps.java line 42:
>> 
>>> 40:     public void test() throws Exception {
>>> 41:         new CracBuilder().engine(CracEngine.SIMULATE).main(LazyProps.class).args(CracTest.args())
>>> 42:                 .captureOutput(true)
>> 
>> the same question, would it harm to make this default? Or is it false by default in the existing JDK testing libraries?
>
> Many tests don't use process output, and it was useful for debugging to have it printed straight out. If the process gets stuck I won't see that (right now we process the output only after it exits) but there's probably a way to both process it and print it out.

OK, thanks, something like this perfectly describes why it should not be default. Being explicit is not bad.

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

PR: https://git.openjdk.org/crac/pull/50


More information about the crac-dev mailing list