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
(cherry picked from commit 3d2ae3340a4d3682ced971185a14873c03ff3b18)
diff --git a/expect/spm-edk2-uart0.exp b/expect/spm-edk2-uart0.exp
index 72b0f11..ce854df 100644
--- a/expect/spm-edk2-uart0.exp
+++ b/expect/spm-edk2-uart0.exp
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2019-2020 Arm Limited. All rights reserved.
+# Copyright (c) 2019-2022 Arm Limited. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -18,36 +18,24 @@
 	"UEFI firmware" {
 		puts "<<EDK2 starting>>"
 	}
-	timeout {
-		exit_uart -1
-	}
 }
 
 expect {
 	"UEFI Interactive Shell" {
 		puts "<<EDK2 shell starting>>"
 	}
-	timeout {
-		exit_uart -1
-	}
 }
 
 expect {
 	"any other key to continue." {
 		send "\r"
 	}
-	timeout {
-		exit_uart -1
-	}
 }
 
 expect {
 	"Shell>" {
 		send "fs0:\r"
 	}
-	timeout {
-		exit_uart -1
-	}
 }
 
 expect {
@@ -55,27 +43,18 @@
 		send "UefiInfo.efi\r"
 		puts "<<Loading UEFI application>>"
 	}
-	timeout {
-		exit_uart -1
-	}
 }
 
 expect {
 	-re "Loading driver at .* UefiInfo.efi" {
 		puts "<<UEFI application is being loaded>>"
 	}
-	timeout {
-		exit_uart -1
-	}
 }
 
 expect {
 	"FS0:" {
 		puts "<<UEFI application loaded>>"
 	}
-	timeout {
-		exit_uart -1
-	}
 }
 
 exit_uart 0