construct test_groups from test_group and tf_config if present
If the environment variable 'test_groups' is not present, then check
if 'test_group' and 'tf_config' are present, then construct the
test_groups from the latter and default the rest of the configs,
'tftf_config', 'scp_config', 'scp_tools' and 'run_config'.
This change would allow Jenkins jobs (see [1]) to specify the above
parameters, thus allowing a more flexible way to construct the
test_groups variable.
[1] https://review.trustedfirmware.org/c/ci/tf-a-job-configs/+/4917
Change-Id: I3f0e5f2f107160b6b0a485139f43488245f5ec9e
Signed-off-by: Leonardo Sandoval <leonardo.sandoval@linaro.org>
diff --git a/script/run_local_ci.sh b/script/run_local_ci.sh
index a482157..6404560 100755
--- a/script/run_local_ci.sh
+++ b/script/run_local_ci.sh
@@ -241,6 +241,28 @@
export minus_x="-x"
fi
+# if test_groups variable is not present, check if it can be formed at least from 'test_group' and 'tf_config'
+# environment variables
+if [ -z "${test_groups}" ]; then
+ if [ -n "${test_group}" -a -n "${tf_config}" ]; then
+
+ # default the rest to nil if not present
+ tftf_config="${tftf_config:-nil}"
+ scp_config="${scp_config:-nil}"
+ scp_tools="${scp_tools:-nil}"
+ run_config="${run_config:-nil}"
+
+ # constuct the 'long form' so it takes into account all possible configurations
+ tg=$(printf "%s/%s,%s,%s,%s:%s" "${test_group}" "${tf_config}" "${tftf_config}" "${scp_config}" "${scp_tools}" "${run_config}")
+
+ # trim any ',nil:' from it
+ tg="${tg/,nil:/:}" tg="${tg/,nil:/:}"; tg="${tg/,nil:/:}"
+
+ # finally exported
+ export test_groups="${tg}"
+ fi
+fi
+
# For a local run, when some variables as specified as "?", launch zenity to
# prompt for test config via. GUI. If it's "??", then choose a directory.
if [ "$test_groups" = "?" -o "$test_groups" = "??" ]; then