【问题标题】:AssertionFailedError Forked Java VM exited abnormally for non existing test suiteAssertionFailedError Forked Java VM 对于不存在的测试套件异常退出
【发布时间】:2017-10-23 04:54:06
【问题描述】:

这可能与 SO 上的某些内容重复,但是我查看了 thisthisthisthis,但没有找到有效的解决方案。

我遇到的问题是我在 jenkins 上为不存在的测试套件收到此错误。以下是 jenkins ant 构建日志中打印的错误;

compile-tests-run:
    [junit] Testsuite: com.smartstream.control.engine.validation.Batch-With-Multiple-Tests
    [junit] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 sec
    [junit] 
    [junit] Testcase: null took 0 sec
    [junit]     Caused an ERROR
    [junit] Forked Java VM exited abnormally. Please note the time in the report does not reflect the time until the VM exit.
    [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.
    [junit] 
    [junit] Running com.smartstream.control.engine.validation.Batch-With-Multiple-Tests
    [junit] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 sec

BUILD FAILED
u:\jenkins\workspace\control.unittests.execution.time.test\build\build.xml:256: The following error occurred while executing this line:
u:\jenkins\workspace\control.unittests.execution.time.test\engine\build\build.xml:287: Process fork failed.

Total time: 7 minutes 42 seconds
Build step 'Invoke Ant' marked build as failure
Archiving artifacts
Recording test results
[BFA] Scanning build for known causes...
[BFA] No failure causes found
[BFA] Done. 0s
Email was triggered for: Failure - Any
Sending email for trigger: Failure - Any
Sending email to: xxxxxxxx@abc.xom
Finished: FAILURE

现在您可以看到它似乎在com.smartstream.control.engine.validation.Batch-With-Multiple-Tests 上失败了,但是我的整个工作区中没有任何这样的测试套件。我什至在项目的任何地方都找不到它作为文字字符串。

工作区中的以下搜索没有返回任何内容;

窗户findstr也没有;

我尝试增加 ant build memory 和 permgen 无济于事。该构建使用 java 1.7.0_80-b15 和 ant 1.9.6 运行。下面是engine/build.xml文件中的junit ant任务规范;

    <junit dir="." haltonfailure="false" printsummary="yes" forkmode="once" fork="yes" showoutput="yes" failureproperty="tests.failed">
        <classpath location="${build.testclasses}" />
        <classpath location="${resources.dir}" />
        <classpath location="${common.properties}" />
        <classpath location="${common.libs}" />

        <formatter type="xml" />
        <formatter type="plain" usefile="false" />
        <jvmarg value="-Demma.coverage.out.file=${build.coveragereport}/coverage.emma" />
        <jvmarg value="-Demma.coverage.out.merge=true" />
        <jvmarg value="-Xms512m" />
        <jvmarg value="-Xmx1536m" />
        <jvmarg value="-XX:MaxPermSize=512m" />
        <jvmarg value="-XX:-UseSplitVerifier"/>

        <batchtest todir="${build.report}">
            <fileset dir="${test.dir}">
                <include name="**/*Test.java" />                    
                <exclude name="${excludeTestPattern1}" />
                <exclude name="${excludeTestPattern2}" />
                <exclude name="${excludeTestPattern3}" />
                <exclude name="${excludeTestPattern4}" />
                <exclude name="${excludeTestPattern5}" />
            </fileset>
        </batchtest>
    </junit>

到目前为止我已经尝试过什么

  • 在 jenkins 工作中检查了 Delete workspace before build starts 以获得完全干净的构建。
  • 初始 xmx 为 512m,我将其更新为 1024m,然后更新为 1536m
  • 初始烫发大小为 256m,已更新为 512m
  • 在 ant 任务中使用过 forkshowoutput 属性
  • 从最初的尝试更新了 java 和 ant 版本

任何帮助将不胜感激。

【问题讨论】:

  • 另外请告知我投反对票的原因。
  • 人工名字Batch-With-Multiple-Tests是Ant生成的,见bz.apache.org/bugzilla/show_bug.cgi?id=45227#c2
  • @wero 感谢您提供的信息。那么您知道如何获取有关此故障的更多信息吗?

标签: java jenkins junit ant


【解决方案1】:

我找到了解决此问题的方法。我必须为 ant 启用详细日志记录,并通过它观察到以下堆栈跟踪;

Caused by: java.io.IOException: Cannot run program "u:\jenkins\tools\hudson.model.JDK\Java7\jre\bin\java.exe" (in directory "u:\jenkins\workspace\control.unittests.execution.time.test\engine"): CreateProcess error=206, The filename or extension is too long
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047)
    at java.lang.Runtime.exec(Runtime.java:617)
    at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:58)
    at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:428)
    at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:442)
    at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeAsForked(JUnitTask.java:1257)
    ... 32 more
Caused by: java.io.IOException: CreateProcess error=206, The filename or extension is too long
    at java.lang.ProcessImpl.create(Native Method)
    at java.lang.ProcessImpl.<init>(ProcessImpl.java:385)
    at java.lang.ProcessImpl.start(ProcessImpl.java:136)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028)
    ... 37 more

由于 jenkins 基于构建作业名称创建工作空间,因此通过它创建分叉 vm 太长了。我更改了詹金斯的工作名称,它解决了这个问题。

【讨论】:

  • 我不能给你足够多的支持。谢谢。对于那些想知道您可以使用“-v”标志运行 ant 来获得完整输出的人。在我这样做之前,我给出了如此模糊的错误,这太疯狂了......
猜你喜欢
  • 2013-03-06
  • 2010-12-23
  • 1970-01-01
  • 1970-01-01
  • 2017-07-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多