7. Reactis Harness Library - General#

7.1. rcRshOpen#

Open an existing .rsh file or create a new .rsh file.

7.1.1. Syntax#

rshId = rcRshOpen(rsmFileName,rshFileName)

7.1.2. Description#

rshId = rcRshOpen(rsmFileName,rshFileName)

If file rshFileName exists, rcRshOpen opens the existing file. rsmFileName must refer to an .rsm file which is compatible with the .rsh file.

If file rshFileName does not exist, this function creates the file on disk and pre-populates the list of input ports as specified in rsmFileName.

rshId is a scalar integer-valued double that identifies the .rsh file when calling other rcRsh* API functions.

7.1.3. Examples#

rsh = rcRshOpen('cruise.rsm','cruise.rsh');

7.1.4. See Also#

rcRshClose, rcRshSave

7.2. rcRshClose#

Close an .rsh file.

7.2.1. Syntax#

rcRshClose(rshId)

7.2.2. Description#

rcRshClose(rshId)

closes the file identified by rshId. Any changes since the last call to rcRshSave will be discarded.

7.2.3. See Also#

rcRshOpen, rcRshSave

7.3. rcRshSave#

Save changes to an .rsh file.

7.3.1. Syntax#

rcRshSave(rshId)
rcRshSave(rshId, fileName)

7.3.2. Description#

rcRshSave(rshId)

writes any changes made to the .rsh file to disk, using the same file name as used in the rcRshOpen call that opened the file.

rcRshSave(rshId, fileName)

writes any changes made to the .rsh file to disk, using file name fileName.

7.3.3. See Also#

rcRshOpen, rcRshClose

7.4. rcRshGetParameterValue#

Get the value of a library-specific setting.

7.4.1. Syntax#

value = rcRshGetParameterValue(rsh,paramName)

7.4.2. Description#

value = rcRshGetParameterValue(rsh,paramName)

returns the value of library-specific setting paramName from .rsh file rshId.

Parameters of any data type may be queried by rcRshGetParameterValue. The return value is always a string.

Valid parameters names are listed in the Reactis Parameters section of the API chapter in the Reactis for C User’s Guide.

7.4.3. Examples#

v = rcRshGetParameterValue(rsh,'OnIntegerOverflow');

7.4.4. See Also#

rcRshOpen, rcRshSetParameterValue

7.5. rcRshSetParameterValue#

Set the value of a project-specific setting.

7.5.1. Syntax#

rcRshSetParameterValue(rshId, paramName, Value)

7.5.2. Description#

rcRshSetParameterValue(rshId, paramName, Value)

sets project-specific setting paramName to Value in .rsh file rshId.

Parameters of any data type may be set by rcRshSetParameterValue but the paramValue argument must be given as a string.

Currently supported parameters are:

Parameter Name

Allowed Values

Description

CreateTesterParameterFiles

Boolean

When creating a test suite, also create a parameters file (extension ‘.rtp’).

CoverageCStatement

Boolean

Enable/disable the C Statement coverage metric.

CoverageCFunction

Boolean

Enable/disable the C Function coverage metric.

CoverageCFunctionCall

Boolean

Enable/disable the C Function Call coverage metric.

CoverageDecision

Boolean

Enable/disable the Decision coverage metric.

CoverageCondition

Boolean

Enable/disable the Condition coverage metric.

CoverageMCDC

Boolean

Enable/disable the MC/DC coverage metric.

CoverageMCC

Boolean

Enable/disable the MCC coverage metric.

CoverageMCCMaxNumConditions

Non-negative integer

The maximum number of conditions per decision for which MCC coverage will be tracked.

CoverageBoundary

Boolean

Enable/disable the Boundary coverage metric.

CoverageUserTarget

Boolean

Enable/disable the User Defined Target coverage metric.

CoverageAssertion

Boolean

Enable/disable the Assertion coverage metric.

DoCCaching

Boolean

Create and use cache files (files with extension ‘.rso’, ‘.rsls’, ‘.rsld’, or ‘.rsx’).

CDecisionMetric

possible values: ifwhilefor, branching, nonstatic, all

Specifies the criteria for determining which expressions are decisions.

ifwhilefor

expressions which control if/while/for statements.

branching

expressions which control if/while/for statements or the ? operator.

nonstatic

All non-trivial Boolean expressions except static initializers.

all

Same as ‘nonstatic’ (may change in future).

CLoopDetectionTimeout

double in range 0.0 to 1e300

Maximum time for Reactis to compute a simulation step. If the computation of a simulation step takes longer, Reactis assumes there is an infinite loop; the simulation is then terminated and an error message printed.

OnCUndefinedFunctionCall

possible values: none, error

The action taken when an undefined function is called. When set to ‘none’, Reactis stubs each undefined function that is called with a function that returns zero.

OnCUndefinedExternVar

possible values: none, error

The action taken when an undefined function is accessed. When set to ‘none’, Reactis stubs each undefined variable by creating an instance which is initialized to zero.

CPromoteFloatToDouble

Boolean

Enable/disable the implicit promotion of float values to double before performing calculations. Setting this to true provides greater accuracy and compatibility with many compilers. For strict C99 compliance, this should be set to false.

OnShiftOutOfRange

possible values: none, warning, error, inherit

The action to take when a value is shifted by an amount which is either (a) greater than or equal to the width of the value, or (b) negative.

DeltaExceedsTypeRange

possible values: none, warning, error

The action to take when the delta setting for an input type is larger than the range of the input type.

Tolerance

real

The default relative tolerance to use when comparing actual output values to expected output values.

OnCIntegerOverflow

possible values: none, warning, error

The action to take when a signed integer overflow occurs.

OnCUnsignedIntegerOverflow

possible values: none, warning, error

The action to take when an unsigned integer overflow occurs.

OnCIntegerConversionOverflow

possible values: none, warning, error, inherit

The action to take when an overflow occurs while converting an unsigned integer value to a signed integer value.

OnCFloatToUIntConversionOverflow

possible values: none, warning, error, inherit

The action to take when an overflow occurs while converting an unsigned integer value to a signed integer value.

OnCDetectInfNan

possible values: none, warning, error, inherit

The action to take when the evaluation of an expression produces an infinite (inf) or not-a-number (nan) value, and none of the input values to the expression were inf or nan.

OnCInvalidPointer

possible values: none, warning, error

The action to take when an invalid pointer is created. This can be useful in limited circumstances, but note that it is quite common for C programs to create invalid pointers which are never dereferenced.

OnCEmptyStruct

possible values: none, warning, error

The action to take when a struct is declared with no members. For strict C99 compliance, this should be set to ‘error’.

7.5.3. Examples#

rcRshSetParameterValue(rsh,'OnIntegerOverflow','warning');

7.5.4. See Also#

rcRshOpen, rcRshGetParameterValue

7.6. rcRshGetCoverageEnabled#

Get enabled/disabled status of a coverage metric.

7.6.1. Syntax#

B = rcRshGetCoverageEnabled(rshId, metricName)

7.6.2. Description#

B = rcRshGetCoverageEnabled(rshId, metricName)

returns 1 if coverage metric metricName is enabled and 0 otherwise. rshId is an .rsh file identifier returned by rcRshOpen. metricName is a string which may be any of the following: ‘CStatement’, ‘Decision’, ‘Condition’, ‘MCDC’, ‘MCC’, ‘Boundary’, ‘UserTarget’, ‘Assertion’, ‘CFunction’, ‘CFunctionCall’.

7.6.3. See Also#

rcRshOpen, rcRshSetCoverageEnabled

7.7. rcRshSetCoverageEnabled#

Set enabled/disabled status of a coverage metric.

7.7.1. Syntax#

rcRshSetCoverageEnabled(rshId, metricName, 1)
rcRshSetCoverageEnabled(rshId, metricName, 0)

7.7.2. Description#

rcRshSetCoverageEnabled(rshId, metricName, 1)

enables coverage tracking for metric metricName.

rcRshSetCoverageEnabled(rshId, metricName, 0)

disables coverage tracking for metric metricName.

rshId is an .rsh file identifier returned by rcRshOpen. metricName is a string which may be any of the following: CStatement, Decision, Condition, MCDC, MCC, Boundary, UserTarget, Assertion, CFunction, CFunctionCall.

Note that coverage can also be enabled or disabled by using rcRshSetParameterValue to change the corresponding coverage parameter. For example, rcRshSetCoverageEnabled(rshId, ‘Decision’, 1) has the same effect as rcRshSetParameterValue(rshId, ‘CoverageDecision’, ‘1’).

7.7.3. See Also#

rcRshOpen, rcRshGetCoverageEnabled

7.8. rcRshGetEntryFunCandidates#

Find functions which could potentially be used as an entry function in a test harness.

7.8.1. Syntax#

entries = rcRshGetEntryFunCandidates(rshId)

7.8.2. Description#

entries = rcRshGetEntryFunCandidates(rshId)

returns a cell array of structs containing the name and full name of every entry function candidate.

7.8.3. See Also#

rcRshOpen, rcRshHarnessCreate, rcRshHarnessCopy

7.9. rcRshGetInitFunCandidates#

Find functions which could potentially be used as an initialization function in a test harness.

7.9.1. Syntax#

inits = rcRshGetInitFunCandidates(rshId)

7.9.2. Description#

inits = rcRshGetInitFunCandidates(rshId)

returns a cell array of structs containing the name and full name of every initialization function candidate.

7.9.3. See Also#

rcRshOpen, rcRshHarnessCreate, rcRshHarnessCopy

7.10. rcRshCoverageExcludeWholeFunction#

7.10.1. Syntax#

rcRshCoverageExcludeWholeFunction(rshId,funName,comment)

7.10.2. Description#

rcRshCoverageExcludeWholeFunction(rshId,funName,comment)

Exclude all targets in a function from coverage tracking. rshId is the identifier of the test harness which will be modified. funName is the name of the function to be excluded from coverage. comment is a string which can be used to document the decision to exclude the function from coverage.

7.10.3. See Also#

rcRshOpen, rcRshCoverageIncludeWholeFunction

7.11. rcRshCoverageIncludeWholeFunction#

7.11.1. Syntax#

rcRshCoverageIncludeWholeFunction(rshId,funName)

7.11.2. Description#

rcRshCoverageIncludeWholeFunction

Undo the effects of a previous call to rcRshCoverageExcludeWholeFunction.

7.11.3. See Also#

rcRshOpen, rcRshCoverageExcludeWholeFunction

7.12. rcRshGetFileCoverageTracking#

7.12.1. Syntax#

rcRshGetFileCoverageTracking(rshId,fileName)

7.12.2. Description#

status = rcRshGetFileCoverageTracking(rshId,fileName)

Get the coverage tracking status for a source file. rshId is the id of a test harness. fileName is the name of a source file. status is a string returned by cRshGetFileCoverageTracking, which will have one of the following three values: ‘enabled’, ‘disabled’, or ‘inherit’.

7.12.3. Examples#

status = rcRshGetFileCoverageTracking(rshId,'cruise_validator.c');

7.12.4. See Also#

rcRshOpen, rcRshSetFileCoverageTracking

7.13. rcRshSetFileCoverageTracking#

7.13.1. Syntax#

rcRshSetFileCoverageTracking(rshId,fileName,status)

7.13.2. Description#

rcRshSetFileCoverageTracking(rshId,fileName,status)

Set the coverage tracking status for a source file. rshId is the id of a test harness. fileName is the name of a source file. status is a string which can have one of the following three values: ‘enabled’, ‘disabled’, or ‘inherit’.

7.13.3. Examples#

rcRshSetFileCoverageTracking(rshId,'cruise_validator.c','disabled');

7.13.4. See Also#

rcRshOpen, rcRshGetFileCoverageTracking