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
diff --git a/expect/uart-hold.inc b/expect/uart-hold.inc
index a9e6c90..e03a83a 100644
--- a/expect/uart-hold.inc
+++ b/expect/uart-hold.inc
@@ -1,16 +1,20 @@
 #
-# Copyright (c) 2019-2020 Arm Limited. All rights reserved.
+# Copyright (c) 2019-2022 Arm Limited. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
-# If we exit from a secondary uart, and if that had lots of prints, then the
-# model will stall. See: https://jira.arm.com/browse/SDDKW-43675. So, we wait
-# here expect for something that never arrives.
+
+#
+# If we exit from the UART when any of the model's UARTs receive lots of prints
+# then the model will stall, so we either wait for the UART to close naturally
+# or we wait for somebody to explicitly tell us to exit.
+#
+# https://jira.arm.com/browse/SDDKW-43675
+#
 
 set timeout -1
-puts "<<holding terminal>>"
-expect {
-	"FOOBAR" {
-		exit_uart -1
-	}
-}
+
+source [file join [file dirname [info script]] terminable.inc]
+
+puts "<<test complete, waiting for EOF or SIGINT>>"
+expect eof