[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[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(EnvironmentUtils.java:66)
at org.apache.commons.exec.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.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(DefaultEquinoxLauncher.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