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/busybox.inc b/expect/busybox.inc
index de9acb6..4744311 100644
--- a/expect/busybox.inc
+++ b/expect/busybox.inc
@@ -3,8 +3,6 @@
#
# SPDX-License-Identifier: BSD-3-Clause
#
-
-#
# Script to interact with a Busybox filesystem
#
# This script is not standalone and should be sourced by a top expect script.
diff --git a/expect/cactus.exp b/expect/cactus.exp
index 4086c5d..011f2c2 100644
--- a/expect/cactus.exp
+++ b/expect/cactus.exp
@@ -3,8 +3,6 @@
#
# SPDX-License-Identifier: BSD-3-Clause
#
-
-#
# Expect script for the test Secure Partition Cactus
#
diff --git a/expect/crash_panic.exp b/expect/crash_panic.exp
new file mode 100644
index 0000000..645410b
--- /dev/null
+++ b/expect/crash_panic.exp
@@ -0,0 +1,11 @@
+#
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+# Expect script for Trusted Firmware Test Framework
+#
+
+source [file join [file dirname [info script]] handle-arguments.inc]
+
+expect_string "PANIC at PC :"
diff --git a/expect/crash_roxlattables_unhandled_exception_at_el3.exp b/expect/crash_roxlattables_unhandled_exception_at_el3.exp
new file mode 100644
index 0000000..7c87b21
--- /dev/null
+++ b/expect/crash_roxlattables_unhandled_exception_at_el3.exp
@@ -0,0 +1,92 @@
+#
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+# Expect script for Trusted Firmware Test Framework
+#
+
+source [file join [file dirname [info script]] handle-arguments.inc]
+
+expect_string "Translation tables are now read-only at EL3."
+expect_string "Unhandled Exception in EL3."
+expect_string "x30"
+expect_string "x0"
+expect_string "x1"
+expect_string "x2"
+expect_string "x3"
+expect_string "x4"
+expect_string "x5"
+expect_string "x6"
+expect_string "x7"
+expect_string "x8"
+expect_string "x9"
+expect_string "x10"
+expect_string "x11"
+expect_string "x12"
+expect_string "x13"
+expect_string "x14"
+expect_string "x15"
+expect_string "x16"
+expect_string "x17"
+expect_string "x18"
+expect_string "x19"
+expect_string "x20"
+expect_string "x21"
+expect_string "x22"
+expect_string "x23"
+expect_string "x24"
+expect_string "x25"
+expect_string "x26"
+expect_string "x27"
+expect_string "x28"
+expect_string "x29"
+expect_string "scr_el3"
+expect_string "sctlr_el3"
+expect_string "cptr_el3"
+expect_string "tcr_el3"
+expect_string "daif"
+expect_string "mair_el3"
+expect_string "spsr_el3"
+expect_string "elr_el3"
+expect_string "ttbr0_el3"
+expect_string "esr_el3"
+expect_string "far_el3"
+expect_string "spsr_el1"
+expect_string "elr_el1"
+expect_string "spsr_abt"
+expect_string "spsr_und"
+expect_string "spsr_irq"
+expect_string "spsr_fiq"
+expect_string "sctlr_el1"
+expect_string "actlr_el1"
+expect_string "cpacr_el1"
+expect_string "csselr_el1"
+expect_string "sp_el1"
+expect_string "esr_el1"
+expect_string "ttbr0_el1"
+expect_string "ttbr1_el1"
+expect_string "mair_el1"
+expect_string "amair_el1"
+expect_string "tcr_el1"
+expect_string "tpidr_el1"
+expect_string "tpidr_el0"
+expect_string "tpidrro_el0"
+expect_string "par_el1"
+expect_string "mpidr_el1"
+expect_string "afsr0_el1"
+expect_string "afsr1_el1"
+expect_string "contextidr_el1"
+expect_string "vbar_el1"
+expect_string "cntp_ctl_el0"
+expect_string "cntp_cval_el0"
+expect_string "cntv_ctl_el0"
+expect_string "cntv_cval_el0"
+expect_string "cntkctl_el1"
+expect_string "sp_el0"
+expect_string "isr_el1"
+expect_string "dacr32_el2"
+expect_string "ifsr32_el2"
+expect_string "icc_hppir0_el1"
+expect_string "icc_hppir1_el1"
+expect_string "icc_ctlr_el3"
diff --git a/expect/crash_test.exp b/expect/crash_test.exp
new file mode 100644
index 0000000..3ebd7e0
--- /dev/null
+++ b/expect/crash_test.exp
@@ -0,0 +1,94 @@
+#
+# Copyright (c) 2019, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+# Expect script for Trusted Firmware Test Framework
+#
+
+source [file join [file dirname [info script]] handle-arguments.inc]
+
+expect_string "Unhandled External Abort received"
+expect_string "BACKTRACE: START: plat_ea_handler"
+expect_string "BACKTRACE: END: plat_ea_handler"
+expect_string "PANIC in EL3"
+expect_string "x30"
+expect_string "x0"
+expect_string "x1"
+expect_string "x2"
+expect_string "x3"
+expect_string "x4"
+expect_string "x5"
+expect_string "x6"
+expect_string "x7"
+expect_string "x8"
+expect_string "x9"
+expect_string "x10"
+expect_string "x11"
+expect_string "x12"
+expect_string "x13"
+expect_string "x14"
+expect_string "x15"
+expect_string "x16"
+expect_string "x17"
+expect_string "x18"
+expect_string "x19"
+expect_string "x20"
+expect_string "x21"
+expect_string "x22"
+expect_string "x23"
+expect_string "x24"
+expect_string "x25"
+expect_string "x26"
+expect_string "x27"
+expect_string "x28"
+expect_string "x29"
+expect_string "scr_el3"
+expect_string "sctlr_el3"
+expect_string "cptr_el3"
+expect_string "tcr_el3"
+expect_string "daif"
+expect_string "mair_el3"
+expect_string "spsr_el3"
+expect_string "elr_el3"
+expect_string "ttbr0_el3"
+expect_string "esr_el3"
+expect_string "far_el3"
+expect_string "spsr_el1"
+expect_string "elr_el1"
+expect_string "spsr_abt"
+expect_string "spsr_und"
+expect_string "spsr_irq"
+expect_string "spsr_fiq"
+expect_string "sctlr_el1"
+expect_string "actlr_el1"
+expect_string "cpacr_el1"
+expect_string "csselr_el1"
+expect_string "sp_el1"
+expect_string "esr_el1"
+expect_string "ttbr0_el1"
+expect_string "ttbr1_el1"
+expect_string "mair_el1"
+expect_string "amair_el1"
+expect_string "tcr_el1"
+expect_string "tpidr_el1"
+expect_string "tpidr_el0"
+expect_string "tpidrro_el0"
+expect_string "par_el1"
+expect_string "mpidr_el1"
+expect_string "afsr0_el1"
+expect_string "afsr1_el1"
+expect_string "contextidr_el1"
+expect_string "vbar_el1"
+expect_string "cntp_ctl_el0"
+expect_string "cntp_cval_el0"
+expect_string "cntv_ctl_el0"
+expect_string "cntv_cval_el0"
+expect_string "cntkctl_el1"
+expect_string "sp_el0"
+expect_string "isr_el1"
+expect_string "dacr32_el2"
+expect_string "ifsr32_el2"
+expect_string "icc_hppir0_el1"
+expect_string "icc_hppir1_el1"
+expect_string "icc_ctlr_el3"
diff --git a/expect/disable_dyn_auth.exp b/expect/disable_dyn_auth.exp
new file mode 100644
index 0000000..50dd5be
--- /dev/null
+++ b/expect/disable_dyn_auth.exp
@@ -0,0 +1,33 @@
+#
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+# Script to interact with an TF-A built with Trusted Board Boot
+#
+source [file join [file dirname [info script]] handle-arguments.inc]
+
+# This script tries to catch if dynamic authentication of images is enabled
+# during trusted board boot(BL2). The authentication is done using certificates.
+
+expect_string "BL1: Booting BL2" "BL2 booting"
+expect_string "Disabling authentication of images dynamically" "Authentication disabled dynamically"
+expect {
+ # Catch all loading of authentication certificates i.e.,
+ # TRUSTED_BOOT_FW_CERT_ID U(6)
+ # TRUSTED_KEY_CERT_ID U(7)
+ # SCP_FW_KEY_CERT_ID U(8)
+ # SOC_FW_KEY_CERT_ID U(9)
+ # TRUSTED_OS_FW_KEY_CERT_ID U(10)
+ # NON_TRUSTED_FW_KEY_CERT_ID U(11)
+ # SCP_FW_CONTENT_CERT_ID U(12)
+ # SOC_FW_CONTENT_CERT_ID U(13)
+ # TRUSTED_OS_FW_CONTENT_CERT_ID U(14)
+ # NON_TRUSTED_FW_CONTENT_CERT_ID U(15)
+
+ -re "Loading image id=(6|7|8|9|10|11|12|13|14|15) at address " {
+ puts "<<Dynamic Authentication not disabled>>"
+ exit_uart -1
+ }
+ }
+exit_uart 0
diff --git a/expect/el3-test-payload.exp b/expect/el3-test-payload.exp
index d3145ab..2c47dc4 100644
--- a/expect/el3-test-payload.exp
+++ b/expect/el3-test-payload.exp
@@ -3,8 +3,6 @@
#
# SPDX-License-Identifier: BSD-3-Clause
#
-
-#
# Expect script for Trusted Firmware + EL3 Test Payload
#
# Refer to handle-arguments.inc for the list of parameters.
diff --git a/expect/handle-arguments.inc b/expect/handle-arguments.inc
index 4f06309..4a7ed16 100644
--- a/expect/handle-arguments.inc
+++ b/expect/handle-arguments.inc
@@ -3,8 +3,6 @@
#
# SPDX-License-Identifier: BSD-3-Clause
#
-
-#
# Script to handle the arguments and initialise the expect session.
#
# This script is not standalone and should be sourced by a top expect script.
diff --git a/expect/hold_uart.exp b/expect/hold_uart.exp
index a96fa2a..91f9187 100644
--- a/expect/hold_uart.exp
+++ b/expect/hold_uart.exp
@@ -3,8 +3,6 @@
#
# SPDX-License-Identifier: BSD-3-Clause
#
-
-#
# Expect script
#
diff --git a/expect/ivy.exp b/expect/ivy.exp
index 220ba19..d6c5ef4 100644
--- a/expect/ivy.exp
+++ b/expect/ivy.exp
@@ -3,8 +3,6 @@
#
# SPDX-License-Identifier: BSD-3-Clause
#
-
-#
# Expect script for the test Secure Partition Ivy
#
diff --git a/expect/linux-oe-rst-bl31.exp b/expect/linux-oe-rst-bl31.exp
index 4198295..ae7966e 100644
--- a/expect/linux-oe-rst-bl31.exp
+++ b/expect/linux-oe-rst-bl31.exp
@@ -3,8 +3,6 @@
#
# SPDX-License-Identifier: BSD-3-Clause
#
-
-#
# Expect script for Trusted Firmware + U-Boot + Linux boot process with
# OpenEmbedded rootfs in /dev/vda2
# TF with reset to BL3-1
diff --git a/expect/linux-oe.exp b/expect/linux-oe.exp
index 50cbc5f..1469028 100644
--- a/expect/linux-oe.exp
+++ b/expect/linux-oe.exp
@@ -3,8 +3,6 @@
#
# SPDX-License-Identifier: BSD-3-Clause
#
-
-#
# Expect script for Trusted Firmware + U-Boot + Linux boot process with
# OpenEmbedded rootfs in /dev/vda2
#
diff --git a/expect/linux-rd-aarch32-rst-sp-min.exp b/expect/linux-rd-aarch32-rst-sp-min.exp
deleted file mode 100644
index d15b1bd..0000000
--- a/expect/linux-rd-aarch32-rst-sp-min.exp
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# Copyright (c) 2019, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-#
-# Expect script for AArch32 Trusted Firmware + U-Boot + Linux boot process
-# with a AArch32 minimal initrd. The linux image must be a zImage and the
-# initrd must include the U-boot header.
-# TF with reset to SP_MIN
-#
-# Refer to handle-arguments.inc for the list of parameters.
-#
-
-source [file join [file dirname [info script]] handle-arguments.inc]
-
-# Trusted Firmware boot section
-source [file join [file dirname [info script]] trusted-firmware-aarch32-rst-to-sp-min.inc]
-
-# Linux kernel boot section
-source [file join [file dirname [info script]] linux.inc]
-
-# Busybox filesystem section
-source [file join [file dirname [info script]] busybox.inc]
-
-exit_uart -1
diff --git a/expect/linux-rd-busybox-aarch32.exp b/expect/linux-rd-busybox-aarch32.exp
index b6aa630..07dde87 100644
--- a/expect/linux-rd-busybox-aarch32.exp
+++ b/expect/linux-rd-busybox-aarch32.exp
@@ -3,8 +3,6 @@
#
# SPDX-License-Identifier: BSD-3-Clause
#
-
-#
# Expect script for AArch32 Trusted Firmware + U-Boot + Linux boot process
# with a AArch32 minimal initrd. The linux image must be a zImage and the
# initrd must include the U-boot header.
diff --git a/expect/linux-rd-busybox.exp b/expect/linux-rd-busybox.exp
index 986c009..6526407 100644
--- a/expect/linux-rd-busybox.exp
+++ b/expect/linux-rd-busybox.exp
@@ -3,8 +3,6 @@
#
# SPDX-License-Identifier: BSD-3-Clause
#
-
-#
# Expect script for Trusted Firmware + UEFI + Linux boot process with RAM Disk
#
# Refer to handle-arguments.inc for the list of parameters.
diff --git a/expect/linux.inc b/expect/linux.inc
index 7c4f00d..09d4252 100644
--- a/expect/linux.inc
+++ b/expect/linux.inc
@@ -3,8 +3,6 @@
#
# SPDX-License-Identifier: BSD-3-Clause
#
-
-#
# Script to interact with a Linux kernel
#
# This script is not standalone and should be sourced by a top expect script.
diff --git a/expect/openembedded.inc b/expect/openembedded.inc
index 801a810..1d784f4 100644
--- a/expect/openembedded.inc
+++ b/expect/openembedded.inc
@@ -3,8 +3,6 @@
#
# SPDX-License-Identifier: BSD-3-Clause
#
-
-#
# Script to interact with an OpenEmbedded file system
#
# This script is not standalone and should be sourced by a top expect script.
diff --git a/expect/readonly_el1_xlat_tables.exp b/expect/readonly_el1_xlat_tables.exp
new file mode 100644
index 0000000..1f82d41
--- /dev/null
+++ b/expect/readonly_el1_xlat_tables.exp
@@ -0,0 +1,11 @@
+#
+# Copyright (c) 2019, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+# Expect script for Trusted Firmware Test Framework
+#
+
+source [file join [file dirname [info script]] handle-arguments.inc]
+
+expect_string "Translation tables are now read-only at EL1."
diff --git a/expect/spm-edk2-uart0.exp b/expect/spm-edk2-uart0.exp
index 7947fa1..47c2b6c 100644
--- a/expect/spm-edk2-uart0.exp
+++ b/expect/spm-edk2-uart0.exp
@@ -3,8 +3,6 @@
#
# SPDX-License-Identifier: BSD-3-Clause
#
-
-#
# Expect script for Trusted Firmware + EDK2 UART0
#
# Refer to handle-arguments.inc for the list of parameters.
diff --git a/expect/spm-edk2-uart2.exp b/expect/spm-edk2-uart2.exp
index 8462333..66887bd 100644
--- a/expect/spm-edk2-uart2.exp
+++ b/expect/spm-edk2-uart2.exp
@@ -3,8 +3,6 @@
#
# SPDX-License-Identifier: BSD-3-Clause
#
-
-#
# Expect script for Standalone MM partition UART2
#
# Refer to handle-arguments.inc for the list of parameters.
diff --git a/expect/tftf-aarch32.exp b/expect/tftf-aarch32.exp
new file mode 100644
index 0000000..2ac07c3
--- /dev/null
+++ b/expect/tftf-aarch32.exp
@@ -0,0 +1,34 @@
+#
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+# Expect script for Trusted Firmware Test Framework
+#
+
+source [file join [file dirname [info script]] handle-arguments.inc]
+
+source [file join [file dirname [info script]] trusted-firmware-aarch32.inc]
+
+expect_string "Booting trusted firmware test framework" "Starting TFTF"
+expect_string "Running in AArch32 HYP mode"
+
+expect {
+ "Tests Failed : 0" {
+ puts "<<TFTF Success>>"
+ exit_uart 0
+ }
+ "Tests Passed : 0" {
+ puts "<<TFTF no tests passed>>"
+ exit_uart -1
+ }
+ -re "Tests Failed : \[^0]" {
+ puts "<<TFTF Fail>>"
+ exit_uart -1
+ }
+ timeout {
+ exit_timeout
+ }
+}
+
+exit_uart -1
diff --git a/expect/tftf.exp b/expect/tftf.exp
index 8d5d611..3152579 100644
--- a/expect/tftf.exp
+++ b/expect/tftf.exp
@@ -3,14 +3,16 @@
#
# SPDX-License-Identifier: BSD-3-Clause
#
-
-#
# Expect script for Trusted Firmware Test Framework
#
source [file join [file dirname [info script]] handle-arguments.inc]
+source [file join [file dirname [info script]] trusted-firmware.inc]
+
expect_string "Booting trusted firmware test framework" "Starting TFTF"
+expect_re "Running at NS-EL(1|2)"
+
expect {
"Tests Failed : 0" {
puts "<<TFTF Success>>"
diff --git a/expect/tftf_fault.exp b/expect/tftf_fault.exp
index c8181ee..d05ec6e 100644
--- a/expect/tftf_fault.exp
+++ b/expect/tftf_fault.exp
@@ -3,8 +3,6 @@
#
# SPDX-License-Identifier: BSD-3-Clause
#
-
-#
# Expect script
#
diff --git a/expect/tftf_no_ttst.exp b/expect/tftf_no_ttst.exp
index df09a03..3081b36 100644
--- a/expect/tftf_no_ttst.exp
+++ b/expect/tftf_no_ttst.exp
@@ -3,8 +3,6 @@
#
# SPDX-License-Identifier: BSD-3-Clause
#
-
-#
# Expect script for Trusted Firmware Test Framework
#
diff --git a/expect/tftf_ttst.exp b/expect/tftf_ttst.exp
index 675cc75..74659a3 100644
--- a/expect/tftf_ttst.exp
+++ b/expect/tftf_ttst.exp
@@ -3,8 +3,6 @@
#
# SPDX-License-Identifier: BSD-3-Clause
#
-
-#
# Expect script for Trusted Firmware Test Framework
#
diff --git a/expect/timeout.exp b/expect/timeout.exp
new file mode 100644
index 0000000..276244c
--- /dev/null
+++ b/expect/timeout.exp
@@ -0,0 +1,18 @@
+#
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+# Expect script for Trusted Firmware Test Framework
+#
+
+source [file join [file dirname [info script]] handle-arguments.inc]
+
+expect {
+ timeout {
+ puts "<<Timeout expected - Success>>"
+ exit_uart 0
+ }
+}
+
+exit_uart -1
diff --git a/expect/timeout_spmin_roxlattables.exp b/expect/timeout_spmin_roxlattables.exp
new file mode 100644
index 0000000..64a54ef
--- /dev/null
+++ b/expect/timeout_spmin_roxlattables.exp
@@ -0,0 +1,19 @@
+#
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+# Expect script for Trusted Firmware Test Framework
+#
+
+source [file join [file dirname [info script]] handle-arguments.inc]
+
+expect_string "Translation tables are now read-only at EL3."
+expect {
+ timeout {
+ puts "<<Timeout expected - Success>>"
+ exit_uart 0
+ }
+}
+
+exit_uart -1
diff --git a/expect/timeout_test.exp b/expect/timeout_test.exp
new file mode 100644
index 0000000..292edbd
--- /dev/null
+++ b/expect/timeout_test.exp
@@ -0,0 +1,19 @@
+#
+# Copyright (c) 2019, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+# Expect script for Trusted Firmware Test Framework
+#
+
+source [file join [file dirname [info script]] handle-arguments.inc]
+
+expect_string "Booting trusted firmware test framework" "Starting TFTF"
+expect {
+ timeout {
+ puts "<<Timeout expected - Success>>"
+ exit_uart 0
+ }
+}
+
+exit_uart -1
diff --git a/expect/trusted-firmware-aarch32-rst-to-sp-min.inc b/expect/trusted-firmware-aarch32-rst-to-sp-min.inc
deleted file mode 100644
index af7c343..0000000
--- a/expect/trusted-firmware-aarch32-rst-to-sp-min.inc
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# Copyright (c) 2019, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-#
-# Script to interact with Trusted Firmware when resetting to SP_MIN.
-#
-# This script is not standalone and should be sourced by a top expect script.
-#
-
-expect_string "SP_MIN:" "Booting SP_MIN"
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"
diff --git a/expect/trusted-firmware-load-error.exp b/expect/trusted-firmware-load-error.exp
new file mode 100644
index 0000000..ebf36f1
--- /dev/null
+++ b/expect/trusted-firmware-load-error.exp
@@ -0,0 +1,14 @@
+#
+# Copyright (c) 2019, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+source [file join [file dirname [info script]] handle-arguments.inc]
+
+# Expect an error while loading BL2 image.
+expect {
+ "Loading of FW_CONFIG failed" { exit_uart 0 }
+ "BL1: Booting BL2" { exit_uart -1 }
+ timeout { exit_timeout }
+}
diff --git a/expect/trusted-firmware-rst-to-bl31.inc b/expect/trusted-firmware-rst-to-bl31.inc
index b413a3f..82b0404 100644
--- a/expect/trusted-firmware-rst-to-bl31.inc
+++ b/expect/trusted-firmware-rst-to-bl31.inc
@@ -3,8 +3,6 @@
#
# SPDX-License-Identifier: BSD-3-Clause
#
-
-#
# Script to interact with Trusted Firmware when resetting to BL31.
#
# This script is not standalone and should be sourced by a top expect script.
diff --git a/expect/trusted-firmware.inc b/expect/trusted-firmware.inc
index 5e98ac2..fc5af71 100644
--- a/expect/trusted-firmware.inc
+++ b/expect/trusted-firmware.inc
@@ -1,21 +1,32 @@
#
-# 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 AArch64 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 BL31. Skip waiting
-# for them by inspecting the environment variable 'skip_early_boot_msgs'
+# 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_re "BL1: Booting BL3-?1" "BL1: Booting BL31"
+
+ 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 BL31"
} else {
puts "<<Skipping early boot messages from BL1 and BL2>>"
}
diff --git a/expect/tsp.exp b/expect/tsp.exp
index 45b648f..b697bfd 100644
--- a/expect/tsp.exp
+++ b/expect/tsp.exp
@@ -3,8 +3,6 @@
#
# SPDX-License-Identifier: BSD-3-Clause
#
-
-#
# Expect script for TSP
#
diff --git a/expect/uart-hold.inc b/expect/uart-hold.inc
index 8c876ba..124e61e 100644
--- a/expect/uart-hold.inc
+++ b/expect/uart-hold.inc
@@ -3,7 +3,6 @@
#
# 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.
diff --git a/expect/ubsan-test-trap.exp b/expect/ubsan-test-trap.exp
new file mode 100644
index 0000000..ec3b35c
--- /dev/null
+++ b/expect/ubsan-test-trap.exp
@@ -0,0 +1,24 @@
+#
+# Copyright (c) 2019, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+# Expect script for Trusted Firmware Test Framework
+#
+
+source [file join [file dirname [info script]] handle-arguments.inc]
+
+# Value for trap BRK instruction
+set trap_value 0x00003e8
+
+expect {
+ "Unexpected BRK instruction with value $trap_value" {
+ exit_uart 0
+ }
+
+ timeout {
+ exit_uart -1
+ }
+}
+
+exit_uart -1
diff --git a/expect/utils.inc b/expect/utils.inc
index 5c13f00..94dc4ff 100644
--- a/expect/utils.inc
+++ b/expect/utils.inc
@@ -3,8 +3,6 @@
#
# SPDX-License-Identifier: BSD-3-Clause
#
-
-
# Retrieve script parameters from environment variables. If they don't exist,
# return empty string
proc get_param {name {default ""}} {