On Thu, 18 Jul 2024 07:30:47 GMT, SendaoYan <s...@openjdk.org> wrote:

>> Hi all,
>> The testcase `serviceability/attach/LongArgTest.java` intermittent fails 
>> `java.lang.NoClassDefFoundError: jdk/test/lib/Utils`. Jtreg doesn't 
>> automatically compile `jdk/test/lib/Utils.class` and 
>> `jdk/test/lib/apps/LingeredApp.class` etc.. Maybe it's a jtreg  framework 
>> bug.
>> I think it's necessory to compile `jdk.test.lib.Utils` and 
>> `jdk.test.lib.apps.LingeredApp` explicitly.
>> Only change the testcase, the change has been verified, no risk.
>
> SendaoYan has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   delete @build LongArgTest

Hello Chen,

> Does this mean that even if libraries are imported with `@library /test/lib` 
> they still need explicit `@build` commands? If that's the case, many core 
> library tests need review as well.

Yes, jtreg does expect explicit `@build` for such library usages. It has this 
to say https://openjdk.org/jtreg/tag-spec.html:

> In general, classes in library directories are not automatically compiled as 
> part of a compilation command explicitly naming the source files containing 
> those classes. A test that relies upon library classes should contain 
> appropriate @build directives to ensure that the classes will be compiled. It 
> is strongly recommended that tests do not rely on the use of implicit 
> compilation by the Java compiler. Such an approach is generally fragile, and 
> may lead to incomplete recompilation when a test or library code has been 
> modified.

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

PR Comment: https://git.openjdk.org/jdk/pull/20228#issuecomment-2236372312

Reply via email to