How to specity the -agentlib option in a jtreg test?
alexander.kulyakhtin at oracle.com
Mon Apr 18 11:53:40 UTC 2016
In the 'rerun' section I have:
While TestGetModules.so does reside in the images/test/hotspot/jtreg/native, jtreg does not set LD_LIBRARY_PATH to that directory before invoking java.
Therefore -agentlib does not know where to look for the library.
The System.loadLibrary, on the contrary, does succeed because of the -Djava.library.path passed to java.
----- Original Message -----
From: jonathan.gibbons at oracle.com
To: jtreg-use at openjdk.java.net
Sent: Friday, April 15, 2016 7:05:18 PM GMT +03:00 Iraq
Subject: Re: How to specity the -agentlib option in a jtreg test?
jtreg should report the command it is trying to execute in the "rerun"
If you execute that command directly, does it work? In other words,
can you isolate the problem to jtreg or to the execution of the command
that jtreg execs?
On 04/15/2016 07:53 AM, Staffan Larsen wrote:
> I don’t know why it does not work for -agentlib, but as a workaround you can create an @driver class that launches your test program with the -agentpath parameter and get the location of the native libraries through the system property test.nativepath.
>> On 15 apr. 2016, at 16:29, Alexander Kulyakhtin <alexander.kulyakhtin at oracle.com> wrote:
>> I'm trying to create a jtreg test which compiles and then executes a java class with the -agentlib option (to test some JVMTI functionality)
>> In my test I have
>> @compile MyTest.java
>> @run main/othervm -agentlib:mylib MyTest
>> I run the test with:
>> jtreg -nativepath:<path to libmylib.so> MyTest
>> However, it fails with:
>> "Could not find agent library mylib on the library path, libmylib.so: cannot open shared object file: No such file or directory"
>> The -nativepath does provide for the successful loading of the library when I use System.loadLibrary("mylib").
>> However, for the -agentlib option, it does not help.
>> Does someone know if it is possible to specify the library path for the -agentlib option, from within a jtreg test or using the jtreg options?
>> Thank you very much for your help.
>> Best regards,
More information about the jtreg-use