testTarget

Test the features of the target using the supported hardware

Syntax

testTarget(targetObj)
testTarget(targetObj,featureName)
testTarget(targetObj,testOptions)
testTarget(targetObj,featureName,testOptions)

Description

testTarget(targetObj) tests all features provided by the target represented by the matlabshared.targetsdk.Target (Target) object, targetObj.

testTarget(targetObj,featureName) tests only the specified feature, featureName, provided by the target represented by the Target object, targetObj.

testTarget(targetObj,testOptions) tests all features provided by the target represented by the Target object, targetObj, by applying the test options, testOptions.

testTarget(targetObj,featureName,testOptions) tests only the specified feature, featureName, provided by the target represented by the Target object, targetObj, by applying the test options, testOptions.

This function tests the features of the target by running a series of tests for the features that the target provides and the hardware that it supports. This function reports the outcome in the variable <HardwareName>_TestResults in the MATLAB® workspace, where <HardwareName> is the name of the tested hardware. <HardwareName>_TestResults variable is a structure with the fields named after the features, where each field has the following subfields: Status, Message, and Logs. If the target does not support any hardware yet, the variable name is unspecified_TestResults.

Input Arguments

expand all

Handle to the mapped object representing your target.

Target feature to test, specified as one of the strings 'framework', 'hardware', 'deployer', 'scheduler', 'externalmode', 'pil', 'profiler', or 'codeoptimization'.

Data Types: char

Target-specific options to test, specified as a structure. Fields of the structure are:

NameDescription
ModelName

Name of the model for which to test the 'codeoptimization' feature, specified as a string. Ignored for testing other features. Default is ''.

CRLName

Name of the code replacement library to use to test the 'codeoptimization' feature, specified as a string. Ignored for other testing features. Default is ''.

ExpectedCodePattern

Code pattern to use to test the 'codeoptimization' feature, specified as a string. Ignored for testing other features. Default is ''.

NetworkProtocolNetwork protocol being used by the target, specified as one of the strings 'ssh', 'telnet', or 'serial'. Default is 'ssh'.
HardwareNameFor a target mapped to multiple Hardware objects, the name of the hardware device for which to test features, specified as a string. Default is ''.
OperatingSystemFor a target mapped to multiple OperatingSystem objects, the operating system for which to test features, specified as one of the strings 'Linux', 'vxworks', or 'baremetal'. Default is ''.
IsModelRunning

Handle of a MATLAB function that checks whether a model is running on hardware and is on the MATLAB path, specified as a string. Default is ''.

Applies only if the hardware under test uses network protocol 'telnet' or 'serial' or operating system 'vxworks' or 'baremetal'. This function returns an error when you do not specify this field and the hardware under test uses a nondefault network protocol or operating system. The function must take a model name as an input argument and have a logical output argument.

TestConcurrentExecution

Enable the concurrent execution testpoint in the profiler feature test for targets with multiple cores. This testpoint can only be used with targets designed for hardware with multiple cores capable of concurrent execution. Default is 'false'.

Note

The CRLName and ExpectedCodePattern test options must be explicitly provided by the user otherwise the test returns Incomplete.

Data Types: struct

Examples

Test All features of a Target.

Execute the following commands to construct and save an object, hTgt, that represents the target.

hTgt = createTarget('My Target','ARM Cortex-M','c:/mytarget');
saveTarget(hTgt);

Test all the features of the target object, hTgt.

testTarget(hTgt);

Test a Single Feature of a Target.

Execute the following commands to construct and save an object, hTgt, that represents the target.

hTgt = createTarget('My Target','ARM Cortex-M','c:/mytarget');
saveTarget(hTgt);

Test the deployer feature of the target object, hTgt.

testTarget(hTgt,'deployer');

Introduced in R2015a