<terp.boundschecker>
Introduction
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"
classname="com.codemesh.terp.ant.devpartner.boundschecker.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)"
targetDir="/testBoundsCheck"
tempDir="/testBoundsCheck"
>
<boundscheck/>
<debug/>
<target name="test" type="exe" /> <sources dir="" includes="*.cpp" /> </terp.cpp>
<terp.fail if="!^file(@'/testBoundsCheck/test.exe').exists()"/>
<terp.boundschecker>
<silent/>
<nologo/>
<batch file="/testBoundsCheck/test.exe.DPbcl"/>
<xml file="test.exe.xml" />
<executable file="/testBoundsCheck/test.exe"/>
</terp.boundschecker>
BoundsChecker task attributes
The <terp.boundschecker> compiler task supports the attributes listed in the following table.
| 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.
| Name | Attributes | Description |
|---|---|---|
| <batch> | file |
Provides the BoundsChecker logfile that can be converted to XML format or opened and viewed interactively. Results in a Example: <batch file="/test.DPbcl"/> |
<config> |
file |
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 Example: <config file="/test.DPbcc" /> |
<executable> |
file |
Provides the process to run under BoundsChecker, including optional arguments that are provided as nested elements.. Example: <executable file="/test.exe"> |
| <minimize> | boolean |
Run in minimized mode. Results in a Example: <minimize/> |
| <nologo> | boolean |
Run without displaying the logo. Results in a Example: <nologo/> |
<out> |
file |
Optional destination file for BoundsChecker output. Results in a Example: <out file="/test.bc.out" /> |
| <silent> | boolean |
Run without interrupting execution for every error. Results in a Example: <silent/> |
<workingdir> |
dir |
Optional working directory for the process that is run under BoundsChecker. Example: <workingdir dir="" /> |
<xml> |
file |
Provide name of target XML file. Optionally specify what is to be included: "all", "summary", or "detail" information. Example: <xml file="/test.bc.out" /> |
