How to analyze low level OSGi problems during tycho test execution?

When executing a JUnit test with tycho-surefire-plugin , tycho deploys the equinox runtime. In rare cases, it may happen that some packages in the OSGi test environment cannot be resolved / started (for example, conflicts are used in packages). If you read the debug log (maven CLI -X option), you will find something like

 !ENTRY org.eclipse.osgi 2 0 2012-10-08 16:41:31.635 !MESSAGE The following is a complete list of bundles which are not resolved, see the prior log entry for the root cause if it exists: !SUBENTRY 1 org.eclipse.osgi 2 0 2012-10-08 16:41:31.635 An error has occurred. See the log file C:\mytestproject.tests\target\work\configuration\1349705136008.log. [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 12:03.181s [INFO] Finished at: Mon Oct 08 16:17:16 CEST 2012 [INFO] Final Memory: 20M/309M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.eclipse.tycho:tycho-surefire-plugin:0.15.0:test (default-test) on project mytestproject.tests: An unexpected error occured (return c ode 13). See log for details. -> [Help 1] 

The eclipse console log does not provide sufficient information in case of package usage conflicts.

How can I parse packets in an OSGi test environment forked by tycho?

+7
source share
2 answers

start tests in remote debugging mode (just specify -DdebugPort=8000 in the CLI) and start the OSGi console on the local port, for example. 1234:

  <plugin> <groupId>org.eclipse.tycho</groupId> <artifactId>tycho-surefire-plugin</artifactId> <version>${tycho-version}</version> <configuration> <systemProperties> <osgi.console>1234</osgi.console> </systemProperties> </configuration> </plugin> 

Set a breakpoint in one of your test classes or in org / eclipse / tycho / surefire / osgibooter / OsgiSurefireBooter if tests have not already started. Then,

  telnet localhost 1234 

and you can use regular OSGi console commands, such as ss, diag, bundle , etc., to analyze the "in vivo" problem.

+7
source

Alternatively, you can work with -consolelog or set the eclipse.consoleLog property to true . If you are working with Tycho, you can use <argLine>-Declipse.consoleLog=true</argLine> .

0
source

All Articles