From weijun.wang at oracle.com Tue Nov 13 16:54:07 2012 From: weijun.wang at oracle.com (Weijun Wang) Date: Wed, 14 Nov 2012 08:54:07 +0800 Subject: Access ${TESTCLASSES} on @run? Message-ID: <50A2EBAF.8050608@oracle.com> 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 From jonathan.gibbons at oracle.com Tue Nov 13 21:16:54 2012 From: jonathan.gibbons at oracle.com (Jonathan Gibbons) Date: Tue, 13 Nov 2012 21:16:54 -0800 Subject: Access ${TESTCLASSES} on @run? In-Reply-To: <50A2EBAF.8050608@oracle.com> References: <50A2EBAF.8050608@oracle.com> Message-ID: <50A32946.2010406@oracle.com> 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 > >