Cuica Module
Definition and usage of the Cuica Module
Description
The cuica
module is the method by which scripts return information
back to the Cuica and provides hooks to the Cuica for controlling execution flow.
It must be explicitly imported with import cuica
.
Buffers
The standard output buffer, i.e. print()
buffer, is written to during
the execution of the test script and then retrieved and stored after
execution by the Cuica.
The results buffer, used for storing raw data results from the test script is also retrieved and stored after execution by the Cuica, however it is treated as binary data and not echoed to the execution console like the standard output buffer.
Exceeding either buffer size will raise an exception.
Constants
The following constants are provided by the cuica
module:
-
cuica.STDOUT_BUFFER_SIZE: int
A constant containing the maximum number of bytes available for stdout.
-
cuica.RESULTS_BUFFER_SIZE: int
A constant containing the maximum number of bytes available for results.
Methods
The following methods are provided by the cuica
module:
-
cuica.get_fw_version() -> str
Get the fixture firmware version.
-
cuica.get_fw_dev_version() -> str
Get the fixture firmware development version.
-
cuica.get_fw_type() -> str
Get the fixture firmware type.
-
cuica.record_results(data: Union[bytes, str], append: bool)
If
append
isTrue
, record results data starting at the current results pointer and advance the results pointer up to a maximum ofcuica.RESULTS_BUFFER_SIZE
total bytes; ifappend
isFalse
, record results data at the start of the results buffer, replacing any existing results. -
cuica.set_max_checkpoint(iterations: int)
Set the maximum number of checkpoints.
-
cuica.checkpoint(current_checkpoint: int)
Set the current checkpoint. This method also serves as the point at which a script may exit gracefully via a
SystemExit
exception, which is treated as a Pass (Early Exit) test condition within a Test Suite. The progress is continuously calculated for display purposes only by the Cuica based on the formula:(current_checkpoint / max_checkpoint) * 100.0
. -
cuica.get_current_checkpoint() -> int
Get the current checkpoint.
-
cuica.set_dut_reset(reset_high: int)
Set the DUT reset line to 3.3V if
reset_high
is 1, 0V ifreset_high
is 0.
Basic Cuica Example
Example script exercising the informational methods and constants
on the cuica
module:
Results Example
Basic Checkpoint Example
This script echos the state of the Squeak Board debugging switch input and sets the debugging LED output correspondingly while also advancing the checkpoint:
Note that when testing this the Squeak Board PCB jumpers on
JP1
, JP2
, JP3
, and JP4
must be set to PCB
and SRC
.