refactor(expect): factor common Expect failure cases into `handle-arguments.inc`
This change factors common Expect failure cases like timeouts and
premature EOFs into the common `handle-arguments.inc` Expect script
fragment.
This fragment now implicitly inserts a timeout handler and an EOF
handler into every expectation introduced after the inclusion of this
fragment. These handlers have the lowest priority, so can be overridden
if necessary.
Signed-off-by: Chris Kay <chris.kay@arm.com>
Change-Id: Ia92f0046ea123d3ed213aa76dc5fce6163471451
diff --git a/expect/handle-arguments.inc b/expect/handle-arguments.inc
index 6a730a5..53ee95b 100644
--- a/expect/handle-arguments.inc
+++ b/expect/handle-arguments.inc
@@ -21,3 +21,14 @@
set uart_log_file [get_param uart_log_file]
set telnet_pid [spawn cat $uart_log_file]
}
+
+expect_after {
+ eof {
+ puts "<<stream closed prematurely, exiting>>"
+ exit -1
+ }
+
+ timeout {
+ exit_timeout
+ }
+}