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/fvp-r-yocto.exp b/expect/fvp-r-yocto.exp
index ae1de8b..a7ac912 100644
--- a/expect/fvp-r-yocto.exp
+++ b/expect/fvp-r-yocto.exp
@@ -1,5 +1,5 @@
 #

-# Copyright (c) 2021 Arm Limited. All rights reserved.

+# Copyright (c) 2021-2022 Arm Limited. All rights reserved.

 #

 # SPDX-License-Identifier: BSD-3-Clause

 #

@@ -13,18 +13,12 @@
 	"Booting Trusted Firmware" {

 		puts "<<Booting Trusted Firmware>>"

 	}

-	timeout {

-		exit_uart -1

-	}

 }

 

 expect {

 	"BL1: Booting BL33" {

 		puts "<<Booting BL33>>"

 	}

-	timeout {

-		exit_uart -1

-	}

 }

 

 # Uboot

@@ -32,9 +26,6 @@
 	"U-Boot" {

 		puts "<<Entered Uboot>>"

 	}

-	timeout {

-		exit_uart -1

-	}

 }

 

 # Yocto

@@ -42,9 +33,6 @@
 	"Booting Linux on physical CPU" {

 		puts "<<Booting Linux>>"

 	}

-	timeout {

-		exit_uart -1

-	}

 }

 

 expect {

@@ -52,16 +40,10 @@
 		puts "<<Yocto Login Prompt Received>>"

 		send "root\n"

 	}

-	timeout {

-		exit_uart -1

-	}

 }

 

 expect {

 	"#" {

 		puts "<<Successfully Reached Yocto Shell>>"

 	}

-	timeout {

-		exit_uart -1

-	}

 }