refactor(expect): wait for SIGINT or EOF when holding UARTs
This change allows any Expect scripts that include the `uart-hold.inc`
to terminate with success upon reception of either EOF or the SIGINT
(Ctrl+C) signal. The former is necessary for the OpenCI, and the latter
for the on-premises CI.
This change also introduces the `terminable.inc` Expect script fragment,
which adds a trap handler for the SIGINT signal (Ctrl+C) which will exit
the Expect script with success. This is useful for scripts that work
around SDDKW-43675, where the model hangs if UARTs which generate a lot
of output are not flushed frequently.
The `handle-arguments.inc` fragment has been updated to ignore SIGINT so
that other terms are not terminated prematurely.
See: https://jira.arm.com/browse/SDDKW-43675
Signed-off-by: Chris Kay <chris.kay@arm.com>
Change-Id: Icb106b60409c4e3be2b025fa1d4550af3acb57be
(cherry picked from commit 5e3449fb519a603c7000c9bf76261fe4fe415c33)
diff --git a/expect/handle-arguments.inc b/expect/handle-arguments.inc
index 53ee95b..1fe03d5 100644
--- a/expect/handle-arguments.inc
+++ b/expect/handle-arguments.inc
@@ -22,6 +22,10 @@
set telnet_pid [spawn cat $uart_log_file]
}
+trap {
+ puts "<<test not yet complete, ignoring SIGINT>>"
+} SIGINT
+
expect_after {
eof {
puts "<<stream closed prematurely, exiting>>"