tests: replace xargs workaround with bash array expansion
Bash has a nice feature called 'Quoted array expansion' which we can
use to pass parameters between functions without convoluted quote
escaping. The syntax might not be extremmely clear at first though,
for example:
"${myarray[@]}"
will be expanded to:
"${myarray[1]}" "${myarray[2]}" ... "${myarray[n]}"
Which can be passed as a series of parameters to a function and then
converted back to a array for further use with :
local params=("$@")
This uses the special '$@' variable which is an array of all the
parameters to a function, 'shift' can be used to skip some parameters at
the beginning of the array.
An array can also be expanded as a single string with the members
separated by a space, with this syntax:
"${myarray[*]}"
Using this, I reworked the bt_diff functions to get rid of the xargs
call, I had to move the expected file parameter to the beginning so it
could be shifted and the rest of the parameters passed directly to CLI
executable.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: Ie107c5259c9561fe158f923a53eeb0eaf7ee8b00
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1627
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
This page took 0.027106 seconds and 4 git commands to generate.