function check has program

NAME [edit section]

check_has_program

SYNOPSIS [edit section]

The function check_has_program scans for the given program name on the target device's PATH, and if found puts the absolute path of the item into a variable. The variable is an uppercase version of the program name, prefixed by PROGRAM. (So, for example, if you called 'check_has_program ls', then it would return the result in a variable called 'PROGRAM_LS'.

This routine checks for the existence of the program using the 'command -v' shell builtin command on the target board. Note that for most shells, this returns the full path of the program. For busybox ash, this returns just the program name.

NOTE: This function is for use when the test wants to check for a program without aborting if the program is not there. uses of this can now be replaced with assert_has_program. If applicable, please use that function instead of calling this one directly. This function is intended to replace is_on_target_path

EXAMPLES [edit section]

Here are some sample invocations:

ENVIRONMENT and ARGUMENTS [edit section]

RETURN [edit section]

If the item is found, the full path to the item is returned as the value of the variable. If not found, then the variable has the string "<missing>".

SOURCE [edit section]

Located in scripts/functions.sh

SEE ALSO [edit section]