Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] Passing environment variable to tests

Hi Jan,

Indeed removing environmentVariables block did the trick. I don't remember why I took the habit to always "redefine" each variable (maybe it was not the same behavior in earlier Tycho versions?). Anyway it solve my issue.

Thanks

Julien


De : "Sievers, Jan" <jan.sievers@xxxxxxx>
À : Tycho user list <tycho-user@xxxxxxxxxxx>
Envoyé le : Jeudi 6 août 2015 9h30
Objet : 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



_______________________________________________
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



Back to the top