Sync expect scripts with internal CI

Sync expect scripts with platform-ci commit:
539c151d0cd99a5e6ca6c0e6966f6d8579fe864e

Signed-off-by: Zelalem <zelalem.aweke@arm.com>
Change-Id: I4b0ed80659aaad1f3b05f8891009238f51400546
diff --git a/expect/trusted-firmware-aarch32.inc b/expect/trusted-firmware-aarch32.inc
index 378e581..8d309c9 100644
--- a/expect/trusted-firmware-aarch32.inc
+++ b/expect/trusted-firmware-aarch32.inc
@@ -1,20 +1,35 @@
 #
-# Copyright (c) 2019, Arm Limited. All rights reserved.
+# Copyright (c) 2019-2020, Arm Limited. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
-
-#
-# Script to interact with Trusted Firmware when resetting to BL1.
+# Script to interact with AArch32 Trusted Firmware-A.
 #
 # This script is not standalone and should be sourced by a top expect script.
 #
 
+# Initial boot message won't be present if we're starting at SP_MIN. Skip
+# waiting for them by inspecting the environment variable
+# 'skip_early_boot_msgs'.
 if {![info exists ::env(skip_early_boot_msgs)]} {
 	expect_string "Booting Trusted Firmware"
-	expect_string "BL1: Booting BL2"
+
+	expect {
+		"BL1: Booting BL2" { puts "<<BL2 booting>>" }
+
+		# Catch all 3 possible BL2 loading error messages, namely:
+		#   "Failure in pre image load handling of BL2"
+		#   "Failed to load BL2 firmware."
+		#   "Failure in post image load handling of BL2"
+		-re "Fail.*load.*BL2" {
+			puts "<<BL2 loading error>>"
+			exit_uart -1
+		}
+	    }
+
 	expect_string "BL1: Booting BL32"
-	expect_string "SP_MIN:" "Booting SP_MIN"
 } else {
 	puts "<<Skipping early boot messages from BL1 and BL2>>"
 }
+
+expect_string "SP_MIN:" "Booting SP_MIN"