From weijun.wang at oracle.com Fri Apr 26 18:31:44 2013 From: weijun.wang at oracle.com (Weijun Wang) Date: Sat, 27 Apr 2013 09:31:44 +0800 Subject: Pass environment variables to a Java test Message-ID: <517B2A80.6080809@oracle.com> I might have asked this before but cannot find any mail on it. It seems there is no way to pass environment variables to a Java test, and the only way to do that is to write a script or use a ProcessBuilder. Is that correct? Thanks Max From brent.christian at oracle.com Fri Apr 26 23:43:59 2013 From: brent.christian at oracle.com (Brent Christian) Date: Fri, 26 Apr 2013 23:43:59 -0700 Subject: Pass environment variables to a Java test In-Reply-To: <517B2A80.6080809@oracle.com> References: <517B2A80.6080809@oracle.com> Message-ID: <517B73AF.4020304@oracle.com> You can just set it on the @run line, yes? I'm pretty sure something like this has worked for me: @run main/othervm -Dyour.property.name=value NameOfTestClass -Brent On 4/26/13 6:31 PM, Weijun Wang wrote: > I might have asked this before but cannot find any mail on it. > > It seems there is no way to pass environment variables to a Java test, > and the only way to do that is to write a script or use a > ProcessBuilder. Is that correct? > > Thanks > Max From weijun.wang at oracle.com Fri Apr 26 23:44:56 2013 From: weijun.wang at oracle.com (Weijun Wang) Date: Sat, 27 Apr 2013 14:44:56 +0800 Subject: Pass environment variables to a Java test In-Reply-To: <517B73AF.4020304@oracle.com> References: <517B2A80.6080809@oracle.com> <517B73AF.4020304@oracle.com> Message-ID: <517B73E8.10806@oracle.com> This is a system property. On 4/27/13 2:43 PM, Brent Christian wrote: > You can just set it on the @run line, yes? I'm pretty sure something > like this has worked for me: > > @run main/othervm -Dyour.property.name=value NameOfTestClass > > -Brent > > On 4/26/13 6:31 PM, Weijun Wang wrote: >> I might have asked this before but cannot find any mail on it. >> >> It seems there is no way to pass environment variables to a Java test, >> and the only way to do that is to write a script or use a >> ProcessBuilder. Is that correct? >> >> Thanks >> Max From brent.christian at oracle.com Fri Apr 26 23:57:27 2013 From: brent.christian at oracle.com (Brent Christian) Date: Fri, 26 Apr 2013 23:57:27 -0700 Subject: Pass environment variables to a Java test In-Reply-To: <517B73E8.10806@oracle.com> References: <517B2A80.6080809@oracle.com> <517B73AF.4020304@oracle.com> <517B73E8.10806@oracle.com> Message-ID: <517B76D7.8020006@oracle.com> Hmm, indeed. I misread your message. I don't know of anything in jtreg itself. There are utility classes around to help get a ProcessBuilder setup. I've had good luck with: test/tools/launcher/TestHelper.java -Brent On 4/26/13 11:44 PM, Weijun Wang wrote: > This is a system property. > > On 4/27/13 2:43 PM, Brent Christian wrote: >> You can just set it on the @run line, yes? I'm pretty sure something >> like this has worked for me: >> >> @run main/othervm -Dyour.property.name=value NameOfTestClass >> >> -Brent >> >> On 4/26/13 6:31 PM, Weijun Wang wrote: >>> I might have asked this before but cannot find any mail on it. >>> >>> It seems there is no way to pass environment variables to a Java test, >>> and the only way to do that is to write a script or use a >>> ProcessBuilder. Is that correct? >>> >>> Thanks >>> Max From Alan.Bateman at oracle.com Sat Apr 27 00:49:50 2013 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Sat, 27 Apr 2013 08:49:50 +0100 Subject: Pass environment variables to a Java test In-Reply-To: <517B2A80.6080809@oracle.com> References: <517B2A80.6080809@oracle.com> Message-ID: <517B831E.4080402@oracle.com> On 27/04/2013 02:31, Weijun Wang wrote: > I might have asked this before but cannot find any mail on it. > > It seems there is no way to pass environment variables to a Java test, > and the only way to do that is to write a script or use a > ProcessBuilder. Is that correct? > > Thanks > Max Are you looking for the jtreg -e option? -Alan. From weijun.wang at oracle.com Sat Apr 27 00:54:42 2013 From: weijun.wang at oracle.com (Weijun Wang) Date: Sat, 27 Apr 2013 15:54:42 +0800 Subject: Pass environment variables to a Java test In-Reply-To: <517B831E.4080402@oracle.com> References: <517B2A80.6080809@oracle.com> <517B831E.4080402@oracle.com> Message-ID: <517B8442.7090607@oracle.com> On 4/27/13 3:49 PM, Alan Bateman wrote: > On 27/04/2013 02:31, Weijun Wang wrote: >> I might have asked this before but cannot find any mail on it. >> >> It seems there is no way to pass environment variables to a Java test, >> and the only way to do that is to write a script or use a >> ProcessBuilder. Is that correct? >> >> Thanks >> Max > Are you looking for the jtreg -e option? No. I am looking for something like @run main/othervm/A=B/C=D Test Now I have to use ProcessBuilder. Although there are existing libraries making it easy, still a big pain. Thanks Max > > -Alan. From jonathan.gibbons at oracle.com Sat Apr 27 07:51:51 2013 From: jonathan.gibbons at oracle.com (Jonathan Gibbons) Date: Sat, 27 Apr 2013 07:51:51 -0700 Subject: Pass environment variables to a Java test In-Reply-To: <517B2A80.6080809@oracle.com> References: <517B2A80.6080809@oracle.com> Message-ID: <517BE607.7090405@oracle.com> jtreg -help -E -- Jon On 04/26/2013 06:31 PM, Weijun Wang wrote: > I might have asked this before but cannot find any mail on it. > > It seems there is no way to pass environment variables to a Java test, > and the only way to do that is to write a script or use a > ProcessBuilder. Is that correct? > > Thanks > Max From jonathan.gibbons at oracle.com Sat Apr 27 07:57:54 2013 From: jonathan.gibbons at oracle.com (Jonathan Gibbons) Date: Sat, 27 Apr 2013 07:57:54 -0700 Subject: Pass environment variables to a Java test In-Reply-To: <517B8442.7090607@oracle.com> References: <517B2A80.6080809@oracle.com> <517B831E.4080402@oracle.com> <517B8442.7090607@oracle.com> Message-ID: <517BE772.1000206@oracle.com> On 04/27/2013 12:54 AM, Weijun Wang wrote: > > > On 4/27/13 3:49 PM, Alan Bateman wrote: >> On 27/04/2013 02:31, Weijun Wang wrote: >>> I might have asked this before but cannot find any mail on it. >>> >>> It seems there is no way to pass environment variables to a Java test, >>> and the only way to do that is to write a script or use a >>> ProcessBuilder. Is that correct? >>> >>> Thanks >>> Max >> Are you looking for the jtreg -e option? > > No. I am looking for something like > > @run main/othervm/A=B/C=D Test > > Now I have to use ProcessBuilder. Although there are existing > libraries making it easy, still a big pain. > > Thanks > Max > >> >> -Alan. Sorry. jtreg can't do /everything/ for you :-) Unless you are looking for the as-yet-unimplemented -dwim option. -- Jon