feat: allow UART expectations written in LAVA job YAML format
This change introduces the ability to use the LAVA job YAML format
directly instead of the existing Bash Expect-like scripts, which saves
us from having to invent a new syntax to deal with anything that is
currently unsupported (like timeouts).
Change-Id: I6df4663c847daadbee40b8205df2c9a0f657c8c9
Signed-off-by: Chris Kay <chris.kay@arm.com>
diff --git a/expect-lava/README.md b/expect-lava/README.md
index 9fd5821..09c3760 100644
--- a/expect-lava/README.md
+++ b/expect-lava/README.md
@@ -1,9 +1,23 @@
-# Expect Scripts
+# LAVA Expectation Scripts
-The project tracks two set of expect scripts under two different folders, `expect` and
-`expect-lava`, the former required for local (non-LAVA) or Internal CI (Arm CI) and
-the latter for Open CI (LAVA). Note that any contribution into the expect scripts
-**must be done in both folders**, otherwise expect test coverage will differ.
+This repository contains two sets of scripts under two different folders - `expect` and
+`expect-lava` - which specify the expected UART output of tests run on the on-premises CI, and
+OpenCI. The on-premises CI utilizes the `expect` utility to test UART output from FVP jobs, whilst
+OpenCI utilizes LAVA in all cases (both CIs utilize LAVA for physical board tests).
+
+To aid with migration from the on-premises CI to OpenCI, expectations in `expect-lava` may be
+written in Bash utilizing a set of common Bash infrastructure designed to emulate `expect`'s
+functionality. These scripts end with `.exp`, and the infrastructure is described in the next
+section.
+
+Alternatively, test fragments may be written directly in LAVA's test description format, documented
+[here][1]. These expectations will be picked up if the file ends in `.yaml` and there is no
+corresponding `.exp` file. These files may contain Bash expressions (such as variable expansion).
+
+Note that any contribution into the expect scripts **must be done in both folders**, otherwise test
+expectations will differ.
+
+[1]: https://validation.linaro.org/static/docs/v2/developing-tests.html
## LAVA Test Actions
@@ -28,7 +42,7 @@
Monitor actions are used in the following scenario
-* regex matching through the log, i.e. 'Digest(\s|\w):\s(\w{2}\s){16}'.
+* regex matching through the log, i.e. 'Digest(\s|\w):\s(\w{2}\s){16}'.
The following sections go in detail providing syntactic details for each scenario.
diff --git a/fvp_utils.sh b/fvp_utils.sh
index 2621156..8ee9a7f 100644
--- a/fvp_utils.sh
+++ b/fvp_utils.sh
@@ -560,9 +560,21 @@
fi
# Get all expect strings
- expect_file=$ci_root/expect-lava/${expect_file}
- source $expect_file
+ expect_dir="${ci_root}/expect-lava"
+ expect_file="${expect_dir}/${expect_file}"
+ # Allow the expectations to be provided directly in LAVA's job YAML
+ # format, rather than converting it from a pseudo-Expect Bash script in
+ # the block below.
+ if [ -f "${expect_file/.exp/.yaml}" ]; then
+ pushd "${expect_dir}"
+ expand_template "${expect_file/.exp/.yaml}"
+ popd
+
+ continue
+ else
+ source "${expect_file}"
+ fi
if [ ${#expect_string[@]} -gt 0 ]; then