[crac] RFR: Convert CRaC tests from shell scripts to Java
Radim Vansa
duke at openjdk.org
Thu Mar 2 16:52:54 UTC 2023
On Tue, 28 Feb 2023 18:18:34 GMT, Anton Kozlov <akozlov at openjdk.org> wrote:
>> Right now this is a draft as it builds on top of https://github.com/openjdk/crac/pull/47
>>
>> Please see `CracTest` javadoc for detailed info.
>
> 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?
> test/jdk/jdk/crac/LazyProps.java line 41:
>
>> 39: @Override
>> 40: public void test() throws Exception {
>> 41: new CracBuilder().engine(CracEngine.SIMULATE).main(LazyProps.class).args(CracTest.args())
>
> `main(LazyProps.class).args(CracTest.args())` seems to be repeated, would it harm to make them default?
I kind of thought about not having CracBuilder and CracTest interdependent but it's probably ok (and reduces boilerplate), so I'll do that.
> 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.
-------------
PR: https://git.openjdk.org/crac/pull/50
More information about the crac-dev
mailing list