avocado icon indicating copy to clipboard operation
avocado copied to clipboard

exec-test: allow setting of the working directory

Open clebergnu opened this issue 9 months ago • 2 comments

Is your feature request related to a problem? Please describe. The exec-test test type allows users to run an executable given by absolute path, or more commonly by relative path. In both cases, the current working directory inherited by Avocado or the specific test runner (say avocado-runner-exec-test) may not be appropriate to the executable.

One common situation is when using an executable that will depend on files located somewhere else in the filesystem. For instance, having a runnable's uri of make, together with a make target as an argument given to args, will depend on the location of the Makefile containing that target.

The goal here is to implement a way to control how exec-tests can set their current working directory, so that use cases such as make <target> can be defined with uri and args in a way that makes the execution relocatable (that is, does not depend on running from a specific location).

Describe the solution you'd like A configuration option such as runner.exectest.cwd can take a number of options that will control the current working for the executables themselves. For instance:

  • DIR_OF_URI: would set the executable current working directory to the directory name of the URI
  • $ARGS[0]: would set the current working directory to the same directory given as the first argument
  • $KWARGS["WORKING_DIR"]: would set the executable current working directory to the location of the WORKING_DIR keyword argument.

Describe alternatives you've considered None.

Additional information None

clebergnu avatar May 21 '24 19:05 clebergnu