7

tycho-surefire-pluginでJUnit テストを実行すると、tycho は分点ランタイムをフォークします。まれに、OSGi テスト ランタイムの一部のバンドルを解決/開始できないことがあります (たとえば、パッケージが競合を使用しています)。デバッグ ログ (maven CLI オプション-X) を読むと、次のようなものが見つかります。

!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]

パッケージで競合が使用されている場合、Eclipse コンソール ログは十分な情報を提供しません。

tycho によってフォークされた OSGi テスト ランタイムのバンドルを分析するにはどうすればよいですか?

4

2 に答える 2

8

リモート デバッグ モードでテストを開始し (単純-DdebugPort=8000に CLI で指定)、ローカル ポート (例: 1234) で OSGi コンソールを開始します。

        <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>

テストが開始されていない場合は、テスト クラスの 1 つまたは org/eclipse/tycho/surefire/osgibooter/OsgiSurefireBooter にブレークポイントを設定します。それで、

 telnet localhost 1234

などの通常の OSGi コンソール コマンドを使用して、ss, diag, bundle「in vivo」で問題を分析できます。

于 2012-10-08T14:45:53.187 に答える