Nice! Thank you for sharing this piece of code Mark. I also rise all
my hands for avoiding any extra dependencies if possible. However, it
seems that the code above misses one of the important feature from the
original Vladimir's patch - it doesn't allow junit report to see the
name of failed test class. Today I was trying to rewrite your code a
little bit. And I ended up with the following not-very-readable text:
<target name="fill-empty">
<fileset id="empty.test.reports" dir="${tests.output}">
<patternset>
<include name="TEST-*.xml"/>
</patternset>
<size value="0" when="equal"/>
</fileset>
<replaceregexp match=".*">
<fileset refid="empty.test.reports"/>
<substitution expression="<?xml version='1.0'
encoding='UTF-8' ?><testsuite errors='1' failures='0'
name='@@@@@' tests='1' time='0.01'><testcase classname='@@@@@'
name='testUnknow' time='0.0'><error
message='crash?'/></testcase></testsuite>"/>
</replaceregexp>
</target>
But I can't find a way to replace '@@@@@' with the name of failed test
class using only core ant tasks (see Vladimir's patch). Of course I
can be not good enough in it. If there is such way could you please
give us a hint?
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 line
> 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.xmlis
> > > not a valid XML document. It is possibly corrupted.
> > >
> > >
> > >
> > > This crash change the build status to 'FAILED' but no report file were
> > > generated so junit- reporter miss this crash.
--
Alexei Zakharov,
Intel ESSD