refactor: use Bash expressions to generate boot arguments
This change removes the final remaining macro used by the LAVA job
template files, which is `BOOT_ARGUMENTS`. In its place, use a simple
Bash expression which loops over the boot arguments and generates the
boot argument array entries.
Signed-off-by: Chris Kay <chris.kay@arm.com>
Change-Id: I688c819179ed0a4dea48d23a222acb1c3ef55625
diff --git a/fvp_utils.sh b/fvp_utils.sh
index 6c7f2e9..f381990 100644
--- a/fvp_utils.sh
+++ b/fvp_utils.sh
@@ -485,9 +485,8 @@
fi
done
- # copied files are the working files
- expand_template "${yaml_template_file}" > "${yaml_file}"
- cp "$archive/model_params" "$lava_model_params"
+ # Derive LAVA model parameters from the non-LAVA ones
+ cp "${archive}/model_params" "${lava_model_params}"
# Ensure braces in the FVP model parameters are not accidentally interpreted
# as LAVA macros.
@@ -501,14 +500,12 @@
"${lava_model_params}"
done
- # include the model parameters
- while read -r line; do
- if [ -n "$line" ]; then
- yaml_line="- $(echo "${line}" | jq -R .)"
- sed -i -e "/{BOOT_ARGUMENTS}/i \ \ \ \ $yaml_line" "$yaml_file"
- fi
- done < "$lava_model_params"
- sed -i -e '/{BOOT_ARGUMENTS}/d' "$yaml_file"
+ # Read boot arguments into an array so that the job template file can
+ # iterate over them.
+ readarray -t boot_arguments < "${lava_model_params}"
+
+ # Generate the LAVA job definition, minus the test expectations
+ expand_template "${yaml_template_file}" > "${yaml_file}"
# Append expect commands into the job definition through test-interactive commands
gen_fvp_yaml_expect >> "$yaml_file"