Craig,

We use a slightly modified version of NUnit, and often we wrap it in 
NCover.Console.exe, so we run it using an <exec/> task, rather than using 
NAnt's <nunit/> task. However, even if NUnit returns with a non-zero error 
code, we don't allow this to immediately fail the build (the <exec/> task for 
NUnit has failonerror="false"), as we usually want to continue the build 
process in order perform subsequent analysis. For example, we run a tool that 
converts the NCover analysis files into a pretty set of HTML files, and we 
subsequently run FxCop, too.

The real issue for me is being able to cause NAnt itself to terminate with a 
non-zero error code. It's only at the end of the build, where we can determine 
whether or not there were any issues that arose during the build, that I want 
to cause a build failure. Performing this check in a target defined by 
nant.onsuccess is the ideal place to do this check, except that calling <fail/> 
in this target doesn't cause NAnt to terminate with a non-zero exit code, as 
would be the case if <fail/> was called in any other target.

Hmm, perhaps this is really an issue for the nant-developers mailing list? It 
definitely feels like a bug to me.


Chris




-----Original Message-----
From: Craig Beck [mailto:[EMAIL PROTECTED] 
Sent: 09 November 2007 16:23
To: Chris Lambrou
Subject: RE: [NAnt-users] Bug? <fail/> task doesn't cause a non-zero exit 
codefrom within a nant.onsuccess target

Are you using the NUnit task? We also use CC.Net but we had been running our 
unit tests with nunit-console being started from an <exec> task which works as 
you would expect (i.e. nunit-console returns non-zero exit code and the project 
fails)

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Chris Lambrou
Sent: Friday, November 09, 2007 2:53 AM
To: nant-users@lists.sourceforge.net
Subject: [NAnt-users] Bug? <fail/> task doesn't cause a non-zero exit codefrom 
within a nant.onsuccess target

Hi,
 
I'm using NAnt as part of a continuous build process managed by 
CruiseControl.NET. CCNET determines whether or not a build is a success or a 
failure on the basis of the exit code of the NAnt process that carries out the 
build. If my NAnt build script fails to execute any tasks (e.g. if any of my 
solutions don't compile), then NAnt terminates with a non-zero exit code - 
that's all well and good, as CCNET recognises this as a build failure. However, 
I also want to explicitly cause a build failure even if all the NAnt tasks 
execute successfully.
For example, if there are any NUnit tests failures or FxCop rule violations, 
the NAnt script won't actually fail (because the NUnit and FxCop tasks executed 
successfully). In order to cause the build to fail when such non-fatal build 
errors are encountered, I have added a nant.onsuccess target that executes a 
<fail/> task if any such errors were detected.
 

No virus found in this incoming message.
Checked by AVG Free Edition. 
Version: 7.5.503 / Virus Database: 269.15.26/1119 - Release Date: 08/11/2007 
17:55
 

No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.503 / Virus Database: 269.15.26/1119 - Release Date: 08/11/2007 
17:55
 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to