[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [tycho-user] Passing environment variable to tests
|
IIRC all environment variables are passed to the forked VM anyway [1],
so you could simply remove the whole
<environmentVariables> configuration block and it should work regardless of this NPE.
Regards
Jan
[1] https://eclipse.org/tycho/sitedocs/tycho-surefire/tycho-surefire-plugin/test-mojo.html#environmentVariables
> -----Original Message-----
> From: tycho-user-bounces@xxxxxxxxxxx [mailto:tycho-user-bounces@xxxxxxxxxxx]
> On Behalf Of Julien HENRY
> Sent: Mittwoch, 5. August 2015 13:38
> To: Tycho User List
> Subject: [tycho-user] Passing environment variable to tests
>
> Hi guys,
>
> I'm trying to make a system (optional) env variable visible to tests in
> Tycho:
> <plugin>
> <groupId>org.eclipse.tycho</groupId>
> <artifactId>tycho-surefire-plugin</artifactId>
> <version>0.23.0</version>
> <configuration>
> <environmentVariables>
> <TRAVIS>${env.TRAVIS}</TRAVIS>
> </environmentVariables>
> </configuration>
> </plugin>
>
> It works when the variable is set on the host. But when the variable is not
> set it fails with:
> Caused by: java.lang.NullPointerException
> at
> org.apache.commons.exec.environment.EnvironmentUtils.toStrings(EnvironmentUti
> ls.java:66)
> at
> org.apache.commons.exec.launcher.Java13CommandLauncher.exec(Java13CommandLaun
> cher.java:56)
> at
> org.apache.commons.exec.DefaultExecutor.launch(DefaultExecutor.java:277)
> at
> org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:
> 334)
> at
> org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:164)
> at
> org.eclipse.sisu.equinox.launching.internal.DefaultEquinoxLauncher.execute(De
> faultEquinoxLauncher.java:68)
> at org.eclipse.tycho.surefire.TestMojo.runTest(TestMojo.java:910)
>
>
> I have found the ticket https://bugs.eclipse.org/bugs/show_bug.cgi?id=470621
> that is fixed in 0.23.0 so I guess it was only a fix for empty variable. Here
> I want to support "unset" variable.
>
> FYI in my tests there is something like:
> if (System.getenv("TRAVIS") != null) {
> // Do something specific to travis}
>
> Any help is appreciated.
>
> Thanks
>
> Julien
> _______________________________________________
> tycho-user mailing list
> tycho-user@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from
> this list, visit
> https://dev.eclipse.org/mailman/listinfo/tycho-user