function_test_snapshot 

Fuego wiki

Login or create account

function test snapshot

NAME [edit section]

test_snapshot

SYNOPSIS [edit section]

  • test_snapshot

DESCRIPTION [edit section]

This function can be defined in the base test script for a test (fuego_test.sh), and executes commands to gather snapshot data from the host or board, to put into the machine-snapshot.txt file.

This function is called from snapshot, which implements the 'snapshot' phase of test processing. This is done right before the 'run' phase, and is intended to be used to capture information about the state of the machine that might help diagnose any errors found during a test.

If a test does not have have a test_snapshot function, then a default set of data is collected from the board (by calling the ov_rootfs_state function). If desired, ov_rootfs_state (the default status-gathering function) may be called to get the default information, and then additional commands may be executed (usually using the cmd function, to retrieve additional snapshot data from the target.

method of saving snapshot data [edit section]

The variable $SNAPSHOT_FILENAME has the filename of the snapshot log file, and this log file has been created before entry into this function.

This function can perform any operations on the host or board that are desired, to gather state information that might be relevant to the test. Each operation should append it's output to the file named by $SNAPSHOT_FILENAME.

location of results [edit section]

The snapshot data will reside in the log directory for this run, in a file called machine-snapshot.txt

EXAMPLES [edit section]

Some sample contents are:
    function test_snapshot {
        echo "============================================================" >>$SNAPSHOT_FILENAME
        echo "Board state information (custom snapshot):" >>$SNAPSHOT_FILENAME
        ov_rootfs_state >>$SNAPSHOT_FILENAME
        echo "network devices status:" >>$SNAPSHOT_FILENANME
        cmd "cat /proc/net/dev" >>$SNAPSHOT_FILENAME
        return 0
    }

ENVIRONMENT and ARGUMENTS [edit section]

A number of environment variables are set (see Core interfaces and Variables)

$SNAPSHOT_FILENAME has the name of the snapshot file.

There are no arguments to this function.

RETURN [edit section]

returns non-zero for error. However, this routine should not return an error.

SOURCE [edit section]

Located in the base script (fuego_test.sh) for each test. The base test scripts are located in /fuego-core/engine/tests/<test_name>.

An example path would be: /fuego-core/engine/tests/Functional.hello_world/fuego_test.sh (inside the Docker container)

SEE ALSO [edit section]

TBWiki engine 1.8.3 by Tim Bird