Closed ddiss closed 1 year ago
One thing I forgot to mention - converting existing _rt_require_X
helpers to use this new pass-by-reference pattern would mean breaking out-of-tree testcases, so we should at the very least print a helpful message if the parameter is missing.
Merged
A common cut script pattern that we currently have is something like:
With each new component tested via cut / autorun, we tend to gather new
_rt_require_X()
helpers, and corresponding global variables. To avoid these global variables getting too out of control, I think it makes sense to use Bash pass-by-reference functionality instead, i.e.:The corresponding helper functions then look something like:
I think It's much cleaner, as it's clearer by looking at the caller where the binary paths will end up and it reduces the number of variables needed - the
req_bins
pass-by-ref variable above is appended withfoo
andbar
paths.We're already using Bash pass-by-reference functionality elsewhere, so it shouldn't change our (recent) version dependency.