Community
Participate
Working Groups
And then plugins project in the test workspace (-data parameter) do not compile. This is very annoying for projects that generate plugin code in their test. To reproduce: Create a Test Case that generates in the workspace a dummy bundle with a dependency to org.eclipse.core.runtime for instance; and assert it builds well. The issue is due to the fact that the default target platform when running test is set to ${eclipse_home}, which is empty with maven-osgi-test-plugin launcher. Instead, the maven-osgi-test-plugin could create a target platform (Windows>Preference>PDE>Target Platform) that is made of the bundles of the running instance. See also: http://dev.eclipse.org/mhonarc/lists/tycho-user/msg00059.html http://software.2206966.n2.nabble.com/Eclipse-UI-Tests-with-maven-osgi-test-plugin-td6036492.html
Fixing this bug in Tycho would be a workaround for PDE bug #343156
Why is ${eclipse_home} empty when launching? When launching from PDE the ${eclipse_home} variable is set which allows the target to work correctly.
To be clear, this is *NOT* a bug in tycho. Equinox is quite flexible about framework installation layout (see http://help.eclipse.org/helios/topic/org.eclipse.platform.doc.isv/reference/misc/runtime-options.html) and p2 extends this even further (see http://wiki.eclipse.org/Equinox_p2_Getting_Started). Tycho creates perfectly valid installation layout, which works for vast majority of test projects and is optimized to reduce file copy. If PDE or other thirdpart tools make assumptions about installation layout, this does not mean there is a bug in Tycho. It also means that all Tycho users must not pay (in terms of slower execution time and higher disk usage) for limitations of thirdparty tools only used by some Tycho users. With this in mind, any patch submitted to implement this enhancement must satisfy the following requirements * by default, test runtime uses all bundles by reference, nothing is copied beyond what is absolutely necessary (I can only think of framework extensions bundles atm) * by default, test runtime only relies on equinox to discover and load bundles. so no p2 simpleconfigurator, old-style update manager or anything like that *by default*. * alternative test runtime layouts must be configurable in pom.xml via maven-osgi-test-plugin configration parameter and implementation should be extensible enough to allow several alternative layouts, eg, fully fleshed-out eclipse folder with plugins/ and features/ directories, fully fleshed-out p2-enabled installed, p2-install with Maven local repository as bundle pool, etc. ** idealy, alternative layouts should be pluggable via maven build extensions, but this is not a hard requirement.
Created attachment 193516 [details] Example failing test plugin This is a sample failing project that creates a new bundle and intents to build it in order to ensure classpath is OK. It works well with manual tests, but it fails with Tycho (because of the deficient target platform).
Here is what I understood: You are requesting that the OSGi runtime used to execute the eclipse-test-plugin tests has a layout that is compatible with the "Running Platform" target platform configuration in the PDE. I agree with Igor that I'd rather see the necessary changes for this on the PDE side: OSGi offers very strong introspection capabilities, and the "Running Platform" target platform should use this mechanism rather than making assumptions on file system layout. Nevertheless, if you want to provide a quality patch that creates a test runtime installation with the p2 director, I'd be willing to answer questions.
I agree that the issue comes from PDE. But apparently, getting this fixed in PDE is not possible. Then I am currently more thinking about a workaround to have tests defining and using the right target platform. I'll first try to add the magic in tests, and then I'll see whether this can be an optional behavior of maven-osgi-test-plugin (for example having a <generatePDETargetPlatform>true</generatePDETargetPlatform>). But we are still far from here, and I'll hopefully find a pragmatic way to get GMF-Tooling tests working. I'll use this bug to track the progress I made on this topic.
I think this would be a good enhancement to Tycho regardless of PDE. If my tests require full blown p2 enabled install for whatever reason, I should be able to run them with tycho. So if somebody contributes a quality patch, I'll be happy to review and apply it.
Changed title from "maven-osgi-test-plugin starts an instance with target platform set to ${eclipse_home} which is empty" to "Make OSGi test runtime usable as "Running Platform" target platform" to reflect what is actually requested here.
You can see here some "hacky" code I added to the beginning of the test suite to generate and activate a target platform that is identical to the instance running the tests: http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.gmp/org.eclipse.gmf.tooling/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/AllTests.java?root=Modeling_Project&r1=1.104&r2=1.105 This is a bit ugly (reads activated bundle and add their parents folder to the target platform). It could maybe be improved, but I fear it will be difficult to do so while PDE won't provide a IBundleContainer that contains a single bundle to define target platforms. This workaround seems to work for GMF Tooling.
(In reply to comment #9) > You can see here some "hacky" code I added to the beginning of the test suite to > generate and activate a target platform that is identical to the instance > running the tests: Actually, this doesn't look bad. The can't see any reason why the PDE shouldn't set up the "Running Platform" target platform in exactly the same way.
Based on comments of bug #343156, I tried to get Tycho generate a bundles.info instead of listing bundles in config.ini. I added the unit test here: https://github.com/mickaelistria/sonatype-tycho/commit/ab3c329a2c0a6451c2cee737659309d1ce820a7f And the tentative fix here: https://github.com/mickaelistria/sonatype-tycho/commit/10f542702f3821ca6b8a1a1538ffb0aae172ba78 That did not help, the PDE target platform is still wrong.
*** Bug 367118 has been marked as a duplicate of this bug. ***
(In reply to comment #9) > This workaround seems to work for GMF Tooling. workaround Utils.setTargetPlatform() from GMF is now in git and reported to work, see http://dev.eclipse.org/mhonarc/lists/tycho-user/msg04391.html
New location of workaround source code example: http://git.eclipse.org/c/gmf-tooling/org.eclipse.gmf-tooling.git/tree/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests
(In reply to Igor Fedorenko from comment #7) > I think this would be a good enhancement to Tycho regardless of PDE. If my > tests require full blown p2 enabled install for whatever reason, I should be > able to run them with tycho. test runtime provisioned by p2 has been implemented now (see bug 386988) can we close this one?
I think there is nothing better that can be done on Tycho-side to handle this issue. It seems fine that tests creating PDE projects have to configure a target platform, and it is more a default behaviour to change in PDE buyg 343156 . I guess it can be closed as INVALID.
(In reply to comment #16) > It seems fine that tests creating PDE projects have to configure a target > platform This may be a solution, but using a complete product installation as test runtime (see bug 386988) should also work. In the latter case, the test code would not need to configure the PDE target platform, but the PDE default ${eclipse.home} should work out of the box. Note however that creating the complete product installation for the test run may be slower than having the test code configure the PDE. This is up the to users to decide. In any case, this enhancement has been implemented (and hence this bug is resolved as FIXED).