function get program path

NAME [edit section]

get_program_path

SYNOPSIS [edit section]

DESCRIPTION [edit section]

This function searches for the indicated program on the target board. It checks for the program in the board test dir, then in the directories specified by the PATH on the board. If a second parameter is provided, the directories in that parameter are searched as well, BEFORE the directories in the PATH.

So the overall search order is:

If the program is not found, then a default path is returned, of $BOARD_TESTDIR/fuego.$TESTDIR/<program_name>

This function sets an environment variable with with the path to the program, which can be used to execute it. The variable name is the program name, in upper case, prefixed with the string 'PROGRAM_'.

For example, if the following call were made:

get_program_path ls

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

If the program is not found, then a path is returned that would execute the program if it were located in the test's directory on the target board.

The purpose of this function is to allow tests to use previously installed test programs on the target board. Some labs install test programs prior to running Fuego tests, and skip the 'deploy' phase when running each test. This function allows tests to run more easily in those labs.

EXAMPLES [edit section]

Here are some sample invocations:

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


Search with an alternate directory:

In this example, search directories in the following order:

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

ENVIRONMENT and ARGUMENTS [edit section]

The positional arguments to get_program_path are:

RETURN [edit section]

PROGRAM_<prog_name> is set to the path on the target board where the program should be expected. Note that when the program is not found, the default value of '$BOARD_TESTDIR/fuego.$TESTDIR/<program>' is returned. Thus, just because the program returns with the PROGRAM_* variable set, the program has not been verified to be present at the indicated path. In that case, the report or report_append function will report an error.

SOURCE [edit section]

Located in scripts/functions.sh

SEE ALSO [edit section]