Test variables

Introduction [edit section]

When Fuego executes a test, shell environment variables are used to provide information about the test environment, test execution parameters, communications methods and parameters, and other items.

These pieces of information are originate from numerous different places. An initial set of test variables comes in the shell environment from either Jenkins or ftc (depending on which one is used to invoke the test).

The information about the board being tested comes primarily from two sources:

Additional information comes from the testplan and test spec that are used for this particular test run.

Test variables can be simple strings, or they may be shell functions.

When a test is run, Fuego gathers information from all these sources, and makes them available to the test (and uses them itself) to control test execution.

Board file [edit section]

The board file contains static information about a board. It is processed by the overlay system, and the values inside it appear as variables in the environment of a test, during test execution.

The board file resides in:

There are a number of variables which are used by the Fuego system itself, and there may also be variables that are used by individual tests.

Common board variables [edit section]

Here is a list of the variables which might be found in a board file:

See Adding a board for more details about these variables.

A board may also have additional variables, including variables that are used for results evaluation for specific tests.

Overlay system [edit section]

The overlay system gathers variables from several places, and puts them all together into a single file which is then source'ed into the running test's environment.

It takes information from:

The overlay system is described in greater detail here: Overlay_Generation

Dynamic variables [edit section]

Dynamic board variables are test variables that are defined on a per-board basis, and can be modified and managed under program control.

Dynamic variables allow the Fuego system, a test, or a user to store information that can be used by tests. This essentially creates an information cache about the board, that can be both manually and programmatically generated and managed.

The information that needs to be held for a particular board depends on the tests that are installed in the system. Thus the system needs to support ad-hoc collections of variables. Just putting everything into the static board file would not scale, as the number of tests increases.

Note: the LAVA test framework has a similar concept called a "board dictionary".

One use case for this to have a "board setup" test, that scans for lots of different items, and populates the dynamic variables with values that are used by other tests. Some items that are useful to know about a board take time to discover (using e.g. 'find' on the target board), and using a board dynamic variable can help reduce the time required to check these items.

The board dynamic variables are kept in the file:

These variables are included in the test by the overlay generator.

Commands for interacting with dynamic variables [edit section]

A user or a test can manipulate a board dynamic variable using the ftc command. The following commands can be used to set, query and delete variables:

ftc query-board [edit section]

'ftc query-board' is used to view the variables associated with a Fuego board. You can use the command to see all the variables, or just a single variable.

Note that 'ftc query-board' shows the variables for a test that come from both the board file and board dynamic variables file (that is, both 'static' board variables and dynamic variables). It does not show variables which come from testplans or spec files, as those are specific to a test.

The usage is:

Examples: $ ftc query-board myboard $ ftc query-board myboard -n PROGRAM_BC

The first example would show all board variables, including functions. The second example would show only the variable PROGRAM_BC, if it existed, for board 'myboard'.

ftc set-var [edit section]

'ftc set-var' allows setting or updating the value of a board dynamic variable.

The usage is:

By convention, variable names are all uppercase, and function names are lowercase, with words separated by underscores.

Example: $ ftc set-var PROGRAM_BC=/usr/bin/bc

ftc delete-var [edit section]

'ftc delete-var' removes a variable from the dynamic variables file.

Example: $ ftc delete-var PROGRAM_BC

Example usage [edit section]

Functional.fuego_board_check could detect the path for the 'foo' binary, (e.g. is_on_target foo PROGRAM_FOO) and call 'ftc set-var $NODE_NAME PROGRAM_FOO=$PROGRAM_FOO'. This would stay persistently defined as a test variable, so other tests could use $PROGRAM_FOO (with assert_defines, or in 'report' or 'cmd' function calls.)

Example Dynamic variables [edit section]

Here are some examples of variables that can be kept as dynamic variables, rather than static variables from the board file: