Correct "library" usage and concurrent use of scratch directory

Jonathan Gibbons jonathan.gibbons at oracle.com
Thu Jul 16 22:43:07 UTC 2015


On 06/29/2015 05:40 AM, David Holmes wrote:
> Hi,
>
> We have a test that sometimes fails with a ClassNotFoundException: 
> test.Empty. Here's the file structure:
>
> runtime/Metaspace/
>   classes/test/Empty.java
>   FragmentMetaspace.java
>   FragmentMetaspaceSimple.java
>
> And here's the test directives from the failing 
> FragmentMetaspaceSimple.java:
>
> /**
>  * @test
>  * @library /runtime/testlibrary
>  * @library classes
>  * @build test.Empty ClassUnloadCommon
>  * @run main/othervm/timeout=200 FragmentMetaspaceSimple
>  */
>
> Does this look right?
>
> I've only reproduced the failure when running both tests in the 
> Metaspace directory. And locally when that happens TraceExceptions 
> shows me that the Classloader can't find the JTwork/scratch/./classes 
> directory.
>
> The other test is specified as:
>
> /**
>  * @test
>  * @library /runtime/testlibrary
>  * @modules java.compiler
>  * @build GeneratedClassLoader
>  * @run main/othervm/timeout=200 -Xmx300m FragmentMetaspace
>  */
>
> will they both try to manipulate the scratch directory?
>
> Thanks,
> David

I'm surprised by the reference to JTwork/scratch/./classes. @library 
classes should map to JTwork/classes/runtime/Metaspace/classes.

jtreg should not itself be manipulating anything in the scratch 
directory, except to ensure that it is empty immediately before the test 
starts, and (optionally) to retain any files written in the scratch 
directory when the test completes.

-- Jon


More information about the jtreg-use mailing list