Executes test unit (TU) bound into a Diagnostic Application (DA).
#include <diag/tucb.h> ulong exectu ( TU_TYPE *tucb_ptr, TU_INFO_HANDLE *tu_handle, TU_RETURN_TYPE *tu_rc)
The exectu subroutine runs an TU referenced by the test unit control block. The test units are normally built and packaged as a loadable library. The device to be tested by the test unit is referenced by a character-string designator indicating the device instance.
Parameter | Description |
---|---|
tucb_ptr | Pointer to the test-unit control block. This structure is defined
in diag/tucb.h file.
typedef struct tucb_t { char *resource_name; TU_INPUT_TYPE parms; } TU_TYPE; where TU_INPUT_TYPE is as follows: typedef struct tucb_in_t { ulong tu; ulong loop; OUTPUT_DATA *data_log; ulong data_log_length; INPUT_DATA *tu_data; ulong tu_data_length; FILE *msg_file; } TU_INPUT_TYPE; |
tu | Test-unit number of the test unit to run. |
loop | Indicates the number of times the test unit should be run provided that an error does not occur. |
data_log | Error details log and or output data log. This log is device specific and is defined by the {device}_output_data.h file. It should point to an empty array of structures and then filled in with output or error detail data by the test unit(s). This parameter should be initialized by the calling application if intended to be used. |
data_log_length | Size of the data_log structure. This field is used when passing the tucb data to a remote managing application. This number is initialized by the calling application by calculating the size of the data structure to be filled in and multiplying it by the number of records to be logged. The test unit calculates the number of records by dividing this number by the size of the intended OUTPUT_DATA structure to be used. A data_log_length value of zero results in no data being logged to the data_log. |
tu_data | Input parameter to be used to pass extra input data to the test units. This parameter must only be used as special case scenarios. It is intended for special applications such as manufacturing or hardware exercisers. |
tu_data_length | Size of the tu_data structure. This field is used when passing the tucb data to a remote managing application. This number is initialized by the calling application by calculating the size of the data structure to be filled in and multiplying it by the number of records to be logged. The test unit calculates the number of data records by dividing this number by the size of the intended INPUT_DATA structure to be used. |
tu_handle | Pointer to a block of data that the TUs need to have persist between subsequent calls to the TU library. Content and layout of the persistent data is a decision left to the TU writer, but there are certain data structures which should be kept here, as described in the next section. Pointer variable is defined in the diagnostic application, but it is set by TU_OPEN to point to a memory buffer allocated by the TU_OPEN code. This structure is defined in diag/tucb.h file. |
tu_rc | Pointer to the test-unit control block return code structure. This
structure is defined in diag/tucb.h file.
typedef struct tucb_out_t { ulong major_rc; ulong minor_rc; ulong actual_loop; ulong data_log_length; ulong severity; } TU_RETURN_TYPE;
|
The major_rc return code is defined as the output from a test unit. This is the same value contained in the TU_RETURN_TYPE structure.
Upon successful completion with no failure, a value of 0 should be returned in the major_rc field.