2016-08-01 8 views
0

junit 3とjunit 4のテストをant 1.9.4で実行しようとしていますjunitタスクでfork = "true"奇妙なエラー(JVM)のクラッシュ:junit4テストをant 1.9.4で実行する(jvm crash with fork = "true")

12:40:58,686 [master>Build>Run and publish Unit Tests and Coverage>Run [email protected]:80] INFO - [junit] Testcase: testAdd took 0,005 sec 
12:40:58,686 [master>Build>Run and publish Unit Tests and Coverage>Run [email protected]:80] INFO - [junit] Testcase: testAdd1 took 0 sec 
12:40:58,755 [master>Build>Run and publish Unit Tests and Coverage>Run [email protected]:80] INFO - [junit] Testsuite: vai.testproduct.TestCalculator3 
12:40:58,755 [master>Build>Run and publish Unit Tests and Coverage>Run [email protected]:80] INFO - [junit] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 sec 
12:40:58,755 [master>Build>Run and publish Unit Tests and Coverage>Run [email protected]:80] INFO - 
12:40:58,756 [master>Build>Run and publish Unit Tests and Coverage>Run [email protected]:80] INFO - [junit] Testcase: null took 0 sec 
12:40:58,756 [master>Build>Run and publish Unit Tests and Coverage>Run [email protected]:80] INFO - [junit]  Caused an ERROR 
12:40:58,756 [master>Build>Run and publish Unit Tests and Coverage>Run [email protected]:80] INFO - [junit] Forked Java VM exited abnormally. Please note the time in the report does not reflect the time until the VM exit. 
12:40:58,756 [master>Build>Run and publish Unit Tests and Coverage>Run [email protected]:80] INFO - [junit] junit.framework.AssertionFailedError: Forked Java VM exited abnormally. Please note the time in the report does not reflect the time until the VM exit. 

私はフォーク=「false」を持つユニットテストを実行すると、問題はありません。 antタスクは次のようになります。

<junit failureproperty="testCasesFailed" jvm="C:\Program Files\Java\jdk1.8.0_40\bin\java" fork="true" clonevm="true" showoutput="false" haltonfailure="false" haltonerror="false" timeout="600000" printsummary="true" includeantruntime="true"> 
      <!-- NOTE timeout of 10 minutes--> 

      <jvmarg line="-Djava.awt.headless=true" /> 
      <jvmarg value="-DbuildDate=${buildDate}" /> 
      <jvmarg value="-XX:ErrorFile=./myfile%.txt" /> 
      <jvmarg value="-XX:+PrintCommandLineFlags" /> 
      <!--<jvmarg value="-XX:+UnlockCommercialFeatures"/> 
      <jvmarg value="-XX:+FlightRecorder" /> 
      <jvmarg value="-XX:FlightRecorderOptions=dumponexit=true,defaultrecording=true,dumponexitpath=.,loglevel=info" />--> 

      <classpath refid="test.classpath" /> 
      <formatter type="xml" /> 
      <formatter type="plain" usefile="false" /> 
      <batchtest todir="${tests.report.dir}"> 
       <fileset dir="${target.tests.dir}" includes="${tests.includes}" excludes="${tests.excludes}" /> 
      </batchtest> 
     </junit> 

jvm属性のいずれかがないと動作しません。 test.classpathもjunit 4で正しく埋められているようです。

問題は単体テストのコードに依存しません。テストにassertEquals(true、true)のみが含まれていても、jvmがクラッシュします。 jvmはクラッシュファイルを書きません。 jvmをflightrecorderで実行するとデッドロックが発生し、junit antタスクのタイムアウトに達するまで終了しません。

リモートデバッグも機能しませんでした。テストを実行しているjvmは、デバッガが接続するとすぐに終了します。

は基本的に私はのJUnit Antタスクで使用可能なパラメータのすべてを演奏し、それらのどれも働いていない(showoutput =「真」/「偽」clonevm =「真」/「偽」等。)

Stackoverflowに関する同様の質問では、System.exit()またはOutOfMemoryExceptionが問題を引き起こす可能性があることが示唆されていますが、ここは間違いありません。

antでjunit 4テストを実行すると、問題なくすぐに問題なく動作するはずです。

答えて

0

問題は、(非常に長い)クラスパスに古いバージョンのantのための古いantの寄与があり、JVMがクラッシュするという不思議なことでした。

+0

こんにちは、あなたは寄付が何だったのか詳しく教えていただけますか?私は同様の問題を抱えています。 – jens

関連する問題