Guys,
Please look at the following code. I probably did the best I can with
core tasks:
---
<target name="-process-empty-reports">
<property name="per.crashed.tests.file"
value="${tests.output}${file.separator}TEST-crashed.xml"/>
<property name="per.header"
value="<?xml version='1.0' encoding='UTF-8'
?><testsuite errors='1' name='vmcrash.CrashedTests'
time='0'>"/>
<property name="per.prefix"
value="<testcase classname='"/>
<property name="per.middle" value="' name='"/>
<property name=" per.suffix"
value="' time='0.0'><error message='VM
crash?'/></testcase>"/>
<property name="per.footer" value="</testsuite>"/>
<fileset id="empty.test.reports" dir="${tests.output}">
<patternset>
<include name="TEST-*.xml"/>
</patternset>
<size value="0" when="equal"/>
</fileset>
<pathconvert refid="empty.test.reports" pathsep="@"
property="crashed.tests"/>
<echo message="${crashed.tests }"
file="${per.crashed.tests.file}"/>
<replaceregexp file="${per.crashed.tests.file}" flags="g">
<regexp pattern="[EMAIL PROTECTED]([EMAIL PROTECTED])[EMAIL
PROTECTED]"/>
<substitution
expression="${per.prefix}\1${per.middle}\1${per.suffix}"/>
</replaceregexp>
<replaceregexp file="${per.crashed.tests.file}" match="\A"
replace="${per.header}"/>
<echo file="${per.crashed.tests.file}" append="yes"
message="${per.footer}"/>
</target>
---
Drawbacks:
- crashed tests are listed under special stub package called
"vmcrash", so it is separated from other tests (not crashed) from the
same package
- actual number of crashes cannot be calculated and now always set to one
But if Mark insists on core-task-only solution then it seems we have
nothing more than to apply the above code (or something similar to
it).
Regards,
2006/12/12, Vladimir Ivanov < [EMAIL PROTECTED]>:
> On 12/12/06, Mark Hindess <[EMAIL PROTECTED]> wrote:
> >
> >
> > I can't see how to do exactly what you want, but perhaps it would be
> > sufficient to use the echo task to create a "TEST-crashed.xml" file
with
> > the list of tests (pathconvert with dirsep="${line.separator}") as
the
> > error message?
>
>
>
> I think it will be enough. In general, error and output streams are
missed
> for these tests so we can have one failed test with a list of tests to
> investigate.
>
> Thanks, Vladimir
>
>
>
> > HTH,
> > Mark.
> >
> > > Thanks!
> > >
> > > 2006/12/11, Vladimir Ivanov <[EMAIL PROTECTED] >:
> > > > Agree, this approach is better than additional dependency.
> > > >
> > > > Alexei, please, throw out my jira and use this code.
> > > >
> > > > Thanks, Vladimir
> > > >
> > > >
> > > > On 12/10/06, Mark Hindess <[EMAIL PROTECTED]> wrote:
> > > > >
> > > > >
> > > > > Please don't add this dependency. We should use something
like:
> > > > >
> > > > > <project name="test">
> > > > > <target name="check-for-empty" depends="-check-for-empty,
> > fail-if-empty"
> > > > > />
> > > > > <target name="-check-for-empty">
> > > > > <fileset id="empty.test.reports" dir="test_report">
> > > > > <patternset>
> > > > > <include name="TEST-*.xml"/>
> > > > > </patternset>
> > > > > <size value="0" when="equal"/>
> > > > > </fileset>
> > > > > <pathconvert refid="empty.test.reports" property="
crashed.tests"
> > />
> > > > > <condition property=" tests.crashed">
> > > > > <not>
> > > > > <equals arg1="" arg2="${crashed.tests}" />
> > > > > </not>
> > > > > </condition>
> > > > > </target>
> > > > > <target name="fail-if-empty" if="${crashed.tests}">
> > > > > <fail>Crashed tests: "${ crashed.tests}"</fail>
> > > > > </target>
> > > > > </project>
> > > > >
> > > > >
> > > > > -Mark.
> > > > >
> > > > > On 9 December 2006 at 23:29, "Alexei Zakharov" <
> > [EMAIL PROTECTED]
> > > >
> > > > > wrote:
> > > > > > All,
> > > > > >
> > > > > > I am going to commit changes for HARMONY-2349
([classlib][testing]
> > > > > > "detect crashes by the empty report files") now. However,
I've
> > > > > > realized that in order to do this I need to introduce a new
> > dependency
> > > > > > to our list of classlib dependencies - the ant-contrib
package.
> > > > > > Personally I don't see any harm in this. It is quite nice
package,
> > we
> > > > > > can also use it for organizing iterative test runs for
example.
> > > > > > Moreover, there is no need to force users to copy it to
> > ANT_HOME/lib
> > > > > > or wherever since ant's taskdef target is capable to load
JAR's
> > > > > > dynamically. BTW, DRLVM build has been using ant-contrib from
the
> > > > > > beginning.
> > > > > >
> > > > > > But I'd like to hear from others. Is ant-contrib ok with
everyone?
> > > > > >
> > > > > > Thanks,
> > > > > >
> > > > > > 2006/12/8, Vladimir Ivanov <[EMAIL PROTECTED]>:
> > > > > > > The last CC notification for 'Linux SUSE 9 gcc debug:
> > classlib over
> > > > > ibmvm'
> > > > > > > has failed status due to "There were test errors" but on
the
> > next lin
> > > e
> > > > > it
> > > > > > > told "All Tests Passed".
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > Note, it happened due to test crash:
> > > > > > >
> > > > > > > [Fatal Error] :-1:-1: Premature end of file.
> > > > > > >
> > > > > > > The file
> > > > > > >
> > /export/viv/trunk/cc/projects/classlib/trunk/build/test_report/TEST-
> > > > > > >
> > org.apache.harmony.security.tests.java.security.IdentityScope2Test.xm
> > > lis
> > > > > > > not a valid XML document. It is possibly corrupted.
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > This crash change the build status to 'FAILED' but no
report
> > file wer
> > > e
> > > > > > > generated so junit- reporter miss this crash.
--
Alexei Zakharov,
Intel ESSD