Understanding -nativepath and how it is applied
Jonathan Gibbons
jonathan.gibbons at oracle.com
Tue Feb 18 19:33:19 UTC 2020
On 02/17/2020 11:21 PM, David Holmes wrote:
> I have a test that uses native code.
>
> I specify "@run main/othervm/native" for the main test class
>
> I invoke jtreg with -nativepath
>
> My test exec's a second VM that needs to load the native library. This
> is done using ProcessTools.executeTestJvm.
>
> When I run the test locally it works fine and if I print out
> java.library.path it shows that the "nativepath" value has been set in
> that property.
>
> But when I run the test via our testing system it fails because the
> native library cannot be found! The jtr file shows -Dtest.nativepath
> being set as expected, but the exec'd VM doesn't have its value in
> java.library.path!
>
> I can obviously fix this by explicitly adding -Djava.library.path=...
> as an explicit arg to the exec'd VM, but I want to understand how this
> works in the local case but not otherwise.
>
> I'm also wondering whether this is something that should be
> automatically handled at the ProcessTools level?
>
> Thanks,
> David
David,
jtreg has no control over the VMs that a test might itself exec. That is
entirely up to the test code, and any library code (such as
ProcessTools) that may be involved. The most that jtreg can do is
provide the information (i.e. test.* properties) that may be required in
order for the test to do what is required in the specific context of the
test itself.
-- Jon
More information about the jtreg-use
mailing list