The terp BoundsChecker task is provided to run an instrumented executable from within an ANT build and fail the build if the executable contains errors. BoundsChecker is a commercial error detection tool produced by Compuware Corp. and is not part of terp. You need to purchase a BoundsChecker license to use it.

Using the <terp.boundschecker> task requires that the ant-terp.jar file be available to ANT and that the task be registered via a <taskdef> statement:

<taskdef name="terp.boundschecker" 

Please note that you could use any value for the name attribute that you wish; you are not limited to terp.boundschecker. All our examples and documentation use the terp.boundschecker name and use a name prefix of terp. to signal that they originate with and rely on the terp framework.

While you can easily invoke the BoundsChecker tool using a standard ANT process executor, the terp task offers several advantages:

  • automatic discovery of BoundsChecker.
  • convenient, high-level configuration elements.
  • result XML file parsing and optional build failure if errors were detected.

A simple build might look this:

<terp.cpp 	compiler="^msvc(14)"
<target name="test" type="exe" /> <sources dir="" includes="*.cpp" /> </terp.cpp>

<terp.fail if="!^file(@'/testBoundsCheck/test.exe').exists()"/>

<batch file="/testBoundsCheck/test.exe.DPbcl"/>
<xml file="test.exe.xml" />
<executable file="/testBoundsCheck/test.exe"/>

BoundsChecker task attributes

The <terp.boundschecker> compiler task supports the attributes listed in the following table.

terp.cpp attributes
Name Type Description
failonerror boolean Optional attribute governing behavior when compilation fails. Default value is true.
parsexml boolean Optional attribute governing whether the resulting XML file is to be parsed or not. If parsed, the failonerror attribute governs whether the build is failed if BoundsChecker detected any errors.
if String Optional attribute specifying a boolean terp expression. The expression represents a condition that must be satisfied for the task to be executed.
unless String Optional attribute specifying a boolean terp expression. The expression represents a condition that must not be satisfied for the task to be executed.

Compiler task nested elements (Overview)

The <terp.boundschecker> task supports a number of nested elements, listed in the table below. All nested elements support the if and unless attributes that allow you to add tool switches conditionally.

terp.cpp nested elements
Name Attributes Description


Provides the BoundsChecker logfile that can be converted to XML format or opened and viewed interactively. Results in a /B option.

Example:      <batch file="/test.DPbcl"/>



Provides the BoundsChecker configuration file that contains rules that govern which error checking rules are enabled and which errors should be suppressed. Results in a /C option.

Example:      <config file="/test.DPbcc" />



Provides the process to run under BoundsChecker, including optional arguments that are provided as nested elements..


<executable file="/test.exe">
<arg value="-info"/> </executable>


Run in minimized mode. Results in a /M option.

Example:      <minimize/>



Run without displaying the logo. Results in a /NOLOGO option.

Example:      <nologo/>



Optional destination file for BoundsChecker output. Results in a /OUT option.

Example:      <out file="/test.bc.out" />



Run without interrupting execution for every error. Results in a /S option.

Example:      <silent/>



Optional working directory for the process that is run under BoundsChecker.

Example:      <workingdir dir="" />



Provide name of target XML file. Optionally specify what is to be included: "all", "summary", or "detail" information.

Example:      <xml file="/test.bc.out" />


Copyright 2006-2016 by Codemesh, Inc., ALL RIGHTS RESERVED

codemesh.com home expressions templates ant about us contact us download