refactor(expect): also capture EOF when using expectation helpers
In the OpenCI there's no possibility of a timeout when running Expect
scripts, but there can be an EOF. This change modifies the
`expect_string` and `expect_re` functions to report that a match was not
found when an early EOF is detected.
Signed-off-by: Chris Kay <chris.kay@arm.com>
Change-Id: I12fbfc86456d20e058f46b388f389d057b9d734c
diff --git a/expect/utils.inc b/expect/utils.inc
index 3d5a7f5..fc63529 100644
--- a/expect/utils.inc
+++ b/expect/utils.inc
@@ -53,6 +53,12 @@
$the_string {
puts "<<$the_message>>"
}
+
+ eof {
+ puts "<<not found: \"$the_string\">>"
+ exit -1
+ }
+
timeout {
puts "<<Not found: $the_string>>"
exit_timeout
@@ -72,6 +78,12 @@
-re $the_re {
puts "<<$the_message>>"
}
+
+ eof {
+ puts "<<not found: \"$the_re\">>"
+ exit -1
+ }
+
timeout {
puts "<<Not found: $the_re>>"
exit_timeout