function assert has program

NAME [edit section]

assert_has_program

SYNOPSIS [edit section]

DESCRIPTION [edit section]

This function checks that the indicated program is present on the target board. It checks for the program in the directories specified by the PATH on the board. If the program is not found the currently running test is aborted, with a message indicating that the program is missing.

If this function is successful, it sets an environment variable with the path to the program. The variable name is the program name, in upper case, prefixed with the string 'PROGRAM_'.

For example, if the following call were made:

assert_has_program ls

and ls was found on the target board in the PATH (specifically, at /bin/ls), then assert_has_program would return success (0), and would set the shell environment variable PROGRAM_LS with the value '/bin/ls'.

EXAMPLES [edit section]

Here are some sample invocations:

If found, the environment variable PROGRAM_ATQ will be set, with the path on the target board where 'atq' is found.

If found, the environment variable PROGRAM_EXPECT will be set, with the path on the target board where 'expect' is found.

ENVIRONMENT and ARGUMENTS [edit section]

The positional arguments to assert_has_program are:

RETURN [edit section]

Returns non-zero on error.

PROGRAM_<prog_name> is set to the path on the target board where the program is found.

SOURCE [edit section]

Located in scripts/functions.sh

SEE ALSO [edit section]