Access ${TESTCLASSES} on @run?

Jonathan Gibbons jonathan.gibbons at oracle.com
Tue Nov 13 21:16:54 PST 2012


Max,

Right now you can't do that, and I'm sorry, but I don't find your use 
case very compelling. While it may look attractive and simple on the 
surface, once you start playing around with env variables or system 
properties on the command line, you're going to complicate an already 
complicated story regarding jtreg and how it sets up class paths.

For clarity, and yes, simplicity, I really think you are better either 
using a shell script, or (even better) run a samevm test that exec's the 
command that you want.  In the long run, I think you'll find that such 
an approach is more flexible, compared to ever-increasing rules in jtreg.

Of course, you could always file an RFE for the /dwim option. [1]

-- Jon

[1] http://www.urbandictionary.com/define.php?term=dwim


On 11/13/2012 04:54 PM, Weijun Wang wrote:
> Is there a way to access the $TESTCLASSES env variable on @run?
>
> I am writing a test that would need to prepend a class path to 
> bootclasspath. Currently I have to use a shell script:
>
>    $TESTJAVA/bin/javac -d . \
>         ${TESTSRC}/NamingManager.java ${TESTSRC}/DNS.java
>    $TESTJAVA/bin/java -Xbootclasspath/p:. DNS
>
> It will be nice if I can only write
>
>  * @build NamingManager
>  * @run main/othervm -Xbootclasspath/p:$TESTCLASSES DNS
>
> I know I can move the classes from TESTCLASSES to pwd by adding a line 
> at the top of the test:
>
>   Files.move(Paths.get(System.getProperty("test.classes") + "/javax"), 
> Paths.get("javax"));
>
> so that the test can be executed with
>
>  * @run main/othervm -Xbootclasspath/p:. DNS
>
> but that's really ugly.
>
> Thanks
> Max
>
>



More information about the jtreg-use mailing list