ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Jan.Mate...@rzf.fin-nrw.de>
Subject AW: trying to grep in file for a certain string
Date Mon, 21 Nov 2005 17:06:24 GMT
<?xml version="1.0" encoding="UTF-8"?>
<project name="changeme" default="regression_status" basedir=".">

    <target name="regression_status">
      
       <property name="msg" value="Number of failures = 0"/>
       <property name="reg.test.file" value="TestSummary.txt"/>
       <echo message="Checking File ${reg.test.file}"/>
       <echo message="For string ${msg}"/>

       <loadfile property="test.status.notfailed" srcfile="${reg.test.file}">
           <filterchain>
               <linecontainsregexp>
                   <regexp pattern="${msg}"/>
               </linecontainsregexp>
           </filterchain>
       </loadfile>
      
       <fail unless="test.status.notfailed" message="Regression tests failed!"/>

    </target>
</project>



Jan 

>-----Urspr√ľngliche Nachricht-----
>Von: Mikael Petterson (KI/EAB) [mailto:mikael.petterson@ericsson.com] 
>Gesendet: Montag, 21. November 2005 17:46
>An: user@ant.apache.org
>Betreff: trying to grep in file for a certain string
>
>Hi,
>
>I am trying to check if a file called TestSummary.txt does NOT 
>contains the string "Number of failures = 0".
>If it does not contain "Number of failures = 0" then I need to 
>set a property called test.status.failed.
>When I try to test the ant script below I get:
>
> <fileset> type doesn't support the nested "condition" element.
>
>What am I doing wrong?
>
>cheers,
>
>//mikael
>
><?xml version="1.0" encoding="UTF-8"?>
><project name="changeme" default="all" basedir=".">
>
>    <target name="regression_status">
>      
>       <property name="msg" value="Number of failures = 0"/>
>       <property name="reg.test.file" value="TestSummary.txt"/>
>       <echo message="Checking File ${reg.test.file}"/>
>       <echo message="For string ${msg}"/>
>       <!-- Set reg test failed -->
>        <fileset file="${res_file}" includes="*.txt">
>       <condition property="test.status.failed">
>        <not>
>        <contains text="${msg}" casesensitive="no"/> 
>       </not>
>       </condition>
>       </fileset>
>      
>       <fail if="test.status.failed" message="Regression tests 
>failed!"/>
>
>
>    </target>
></project>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For 
>additional commands, e-mail: user-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message