style(expect): normalize debugging messages
A minor style cleanup to the messages printed by the Expect scripts to
make them a bit more consistent and descriptive.
Signed-off-by: Chris Kay <chris.kay@arm.com>
Change-Id: Ibd8ccb4423bd5aaeffc99c2f3602123794dc6200
(cherry picked from commit 78ea2c38582da41eb8f9509a2130e702cdf0f1c9)
diff --git a/expect/busybox.inc b/expect/busybox.inc
index a7f781d..8110bc8 100644
--- a/expect/busybox.inc
+++ b/expect/busybox.inc
@@ -8,6 +8,6 @@
# This script is not standalone and should be sourced by a top expect script.
#
-expect_string "init.sh" "Init"
-expect_re ".* # " "TEST SUCCESS"
+expect_string "init.sh" "Linux is booting"
+expect_re ".* # " "Linux reached the root prompt"
exit_uart 0
diff --git a/expect/disable_dyn_auth.inc b/expect/disable_dyn_auth.inc
index 73e7497..d0d8264 100644
--- a/expect/disable_dyn_auth.inc
+++ b/expect/disable_dyn_auth.inc
@@ -10,8 +10,8 @@
# 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_string "BL1: Booting BL2" "BL2 is booting"
+expect_string "Disabling authentication of images dynamically" "dynamic authentication was disabled"
expect {
# Catch all loading of authentication certificates i.e.,
# TRUSTED_BOOT_FW_CERT_ID U(6)
@@ -26,10 +26,10 @@
# 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>>"
+ message "dynamic authentication is still enabled"
exit_uart -1
}
"BL1: Booting BL31" {
- puts "BL31 Booting"
+ message "BL31 is booting"
}
}
diff --git a/expect/disable_dyn_auth_tftf.exp b/expect/disable_dyn_auth_tftf.exp
index 6a61112..7e223c4 100644
--- a/expect/disable_dyn_auth_tftf.exp
+++ b/expect/disable_dyn_auth_tftf.exp
@@ -8,20 +8,20 @@
source [file join [file dirname [info script]] disable_dyn_auth.inc]
-expect_string "Booting trusted firmware test framework" "Starting TFTF"
+expect_string "Booting trusted firmware test framework" "TFTF is booting"
expect_re "Running at NS-EL(1|2)"
expect {
"Tests Failed : 0" {
- expect_string "Exiting tests." "<<TFTF Success>>"
+ expect_string "Exiting tests." "all TFTF tests passed"
exit_uart 0
}
"Tests Passed : 0" {
- puts "<<TFTF no tests passed>>"
+ expect_string "Exiting tests." "no TFTF tests passed"
exit_uart -1
}
-re "Tests Failed : \[^0]" {
- puts "<<TFTF Fail>>"
+ expect_string "Exiting tests." "one or more TFTF tests failed"
exit_uart -1
}
}
diff --git a/expect/el3-test-payload.exp b/expect/el3-test-payload.exp
index 9ba4d57..e101552 100644
--- a/expect/el3-test-payload.exp
+++ b/expect/el3-test-payload.exp
@@ -15,6 +15,6 @@
source [file join [file dirname [info script]] utils.inc]
-expect_string "Booting the EL3 test payload" "EL3 Test Payload: Started"
-expect_string "All CPUs booted!" "EL3 Test Payload: SUCCESS!"
+expect_string "Booting the EL3 test payload" "the EL3 test payload is booting"
+expect_string "All CPUs booted!" "the EL3 test payload booted successfully"
exit_uart 0
diff --git a/expect/ffa_test_driver.exp b/expect/ffa_test_driver.exp
index eb98e4b..92adbb1 100644
--- a/expect/ffa_test_driver.exp
+++ b/expect/ffa_test_driver.exp
@@ -9,7 +9,7 @@
expect {
"buildroot login:" {
send "\n\nroot\n"
- puts "<<Linux Booted>>"
+ message "Linux Booted"
}
}
@@ -32,9 +32,8 @@
expect {
"Total Failures: 0" {
- puts "<<SUCCESS>>"
+ message "SUCCESS"
}
}
exit_uart 0
-
diff --git a/expect/fvp-r-yocto.exp b/expect/fvp-r-yocto.exp
index a7ac912..34117a4 100644
--- a/expect/fvp-r-yocto.exp
+++ b/expect/fvp-r-yocto.exp
@@ -11,39 +11,39 @@
# FVP-R BL1
expect {
"Booting Trusted Firmware" {
- puts "<<Booting Trusted Firmware>>"
+ message "Booting Trusted Firmware"
}
}
expect {
"BL1: Booting BL33" {
- puts "<<Booting BL33>>"
+ message "Booting BL33"
}
}
# Uboot
expect {
"U-Boot" {
- puts "<<Entered Uboot>>"
+ message "Entered Uboot"
}
}
# Yocto
expect {
"Booting Linux on physical CPU" {
- puts "<<Booting Linux>>"
+ message "Booting Linux"
}
}
expect {
"fvp-baser-aemv8r64 login:" {
- puts "<<Yocto Login Prompt Received>>"
+ message "Yocto Login Prompt Received"
send "root\n"
}
}
expect {
"#" {
- puts "<<Successfully Reached Yocto Shell>>"
+ message "Successfully Reached Yocto Shell"
}
}
diff --git a/expect/handle-arguments.inc b/expect/handle-arguments.inc
index 1fe03d5..83d067f 100644
--- a/expect/handle-arguments.inc
+++ b/expect/handle-arguments.inc
@@ -23,12 +23,12 @@
}
trap {
- puts "<<test not yet complete, ignoring SIGINT>>"
+ message "test not yet complete, ignoring SIGINT"
} SIGINT
expect_after {
eof {
- puts "<<stream closed prematurely, exiting>>"
+ message "stream closed prematurely, exiting"
exit -1
}
diff --git a/expect/linux-bl33.exp b/expect/linux-bl33.exp
index 2de23bd..6ab721e 100644
--- a/expect/linux-bl33.exp
+++ b/expect/linux-bl33.exp
@@ -14,14 +14,14 @@
source [file join [file dirname [info script]] trusted-firmware.inc]
# Linux kernel boot section
-expect_string "Booting Linux on physical CPU" "Booting Linux"
-expect_string "Linux version" "Linux starting"
+expect_string "Booting Linux on physical CPU" "Linux is booting"
+expect_string "Linux version" "Linux printed its version"
# The kernel prints some information it takes from the preloaded DTB.
# Check for following information to see that we actually got the right DTB.
# 1. Machine model
# 2. Command line passed via the "/chosen" node
-expect_re "Machine model: FVP (Base|Foundation)" "Machine identified"
-expect_string "Kernel command line: console=ttyAMA0" "Kernel command line"
+expect_re "Machine model: FVP (Base|Foundation)" "Linux successfully identified the machine model"
+expect_string "Kernel command line: console=ttyAMA0" "Linux received the correct command line"
exit_uart 0
diff --git a/expect/linux.inc b/expect/linux.inc
index 329493f..b7e89fe 100644
--- a/expect/linux.inc
+++ b/expect/linux.inc
@@ -15,6 +15,6 @@
set num_cpus 8
}
-expect_string "Linux version" "Linux starting"
-expect_re "SMP: Total of $num_cpus processors activated" "Brought up secondary CPUs"
-expect_string "Freeing unused kernel memory" "End of Linux boot"
+expect_string "Linux version" "Linux printed its version"
+expect_re "SMP: Total of $num_cpus processors activated" "Linux successfully brought up all secondary cores"
+expect_string "Freeing unused kernel memory" "Linux booted successfully"
diff --git a/expect/openembedded.inc b/expect/openembedded.inc
index 1dd39ab..fb112e9 100644
--- a/expect/openembedded.inc
+++ b/expect/openembedded.inc
@@ -8,9 +8,9 @@
# This script is not standalone and should be sourced by a top expect script.
#
-expect_string "INIT:" "Init"
-expect_string "root@genericarmv8:~#" "Linux prompt"
+expect_string "INIT:" "Linux is booting"
+expect_string "root@genericarmv8:~#" "Linux reached the root prompt"
send "shutdown -h now\r"
-expect_re "(Power down|System halted)" "TEST SUCCESS"
+expect_re "(Power down|System halted)" "Linux shut down successfully"
exit_uart 0
diff --git a/expect/spm-cactus-sp-uart1.exp b/expect/spm-cactus-sp-uart1.exp
index 2ddefb9..98767d3 100644
--- a/expect/spm-cactus-sp-uart1.exp
+++ b/expect/spm-cactus-sp-uart1.exp
@@ -11,7 +11,7 @@
expect {
"Booting Secure Partition" {
- puts "<<SP entry>>"
+ message "SP entry"
}
}
diff --git a/expect/spm-edk2-uart0.exp b/expect/spm-edk2-uart0.exp
index ce854df..843372e 100644
--- a/expect/spm-edk2-uart0.exp
+++ b/expect/spm-edk2-uart0.exp
@@ -16,13 +16,13 @@
# EDK2 section
expect {
"UEFI firmware" {
- puts "<<EDK2 starting>>"
+ message "EDK2 starting"
}
}
expect {
"UEFI Interactive Shell" {
- puts "<<EDK2 shell starting>>"
+ message "EDK2 shell starting"
}
}
@@ -41,19 +41,19 @@
expect {
"FS0:" {
send "UefiInfo.efi\r"
- puts "<<Loading UEFI application>>"
+ message "Loading UEFI application"
}
}
expect {
-re "Loading driver at .* UefiInfo.efi" {
- puts "<<UEFI application is being loaded>>"
+ message "UEFI application is being loaded"
}
}
expect {
"FS0:" {
- puts "<<UEFI application loaded>>"
+ message "UEFI application loaded"
}
}
diff --git a/expect/spm-edk2-uart2.exp b/expect/spm-edk2-uart2.exp
index 74480bd..e91efb4 100644
--- a/expect/spm-edk2-uart2.exp
+++ b/expect/spm-edk2-uart2.exp
@@ -12,25 +12,25 @@
expect {
"SPM Version" {
- puts "<<Secure Partition booting>>"
+ message "Secure Partition booting"
}
}
expect {
"MmMain Done!" {
- puts "<<Secure Partition booted>>"
+ message "Secure Partition booted"
}
}
expect {
"Received event - 0xC4000041 on cpu" {
- puts "<<Received event>>"
+ message "Received event"
}
}
expect {
"MmEntryPoint Done" {
- puts "<<Secure Partition done>>"
+ message "Secure Partition done"
}
}
diff --git a/expect/spm-linux-uart0.exp b/expect/spm-linux-uart0.exp
index 1895bd8..beec5c1 100644
--- a/expect/spm-linux-uart0.exp
+++ b/expect/spm-linux-uart0.exp
@@ -8,7 +8,7 @@
expect {
"Please press Enter to activate this console." {
- puts "<<Linux PVM booted>>"
+ message "Linux PVM booted"
send "\r"
}
}
@@ -21,7 +21,7 @@
expect {
"Hafnium successfully loaded with 1 VMs:" {
- puts "<<Hafnium driver started>>"
+ message "Hafnium driver started"
}
}
diff --git a/expect/spm-optee-sp-uart1.exp b/expect/spm-optee-sp-uart1.exp
index 289c91d..6ba7755 100644
--- a/expect/spm-optee-sp-uart1.exp
+++ b/expect/spm-optee-sp-uart1.exp
@@ -8,13 +8,13 @@
expect {
"OP-TEE version: " {
- puts "<<OP-TEE version>>"
+ message "OP-TEE version"
}
}
expect {
"Primary CPU switching to normal world boot" {
- puts "<<OP-TEE initialized>>"
+ message "OP-TEE initialized"
}
}
diff --git a/expect/spm-uart2.exp b/expect/spm-uart2.exp
index f9b22eb..fac256e 100644
--- a/expect/spm-uart2.exp
+++ b/expect/spm-uart2.exp
@@ -8,7 +8,7 @@
expect {
"Booting Secure Partition" {
- puts "<<SP entry>>"
+ message "SP entry"
}
}
diff --git a/expect/terminable.inc b/expect/terminable.inc
index a96d51a..7c8ca17 100644
--- a/expect/terminable.inc
+++ b/expect/terminable.inc
@@ -5,6 +5,6 @@
#
trap {
- puts "<<received SIGINT, exiting>>"
+ message "received SIGINT, exiting"
exit_uart 0
} SIGINT
diff --git a/expect/tftf-aarch32.exp b/expect/tftf-aarch32.exp
index 12a8bb3..0717428 100644
--- a/expect/tftf-aarch32.exp
+++ b/expect/tftf-aarch32.exp
@@ -10,20 +10,20 @@
source [file join [file dirname [info script]] trusted-firmware-aarch32.inc]
-expect_string "Booting trusted firmware test framework" "Starting TFTF"
+expect_string "Booting trusted firmware test framework" "TFTF is booting"
expect_string "Running in AArch32 HYP mode"
expect {
"Tests Failed : 0" {
- expect_string "Exiting tests." "<<TFTF Success>>"
+ expect_string "Exiting tests." "all TFTF tests passed"
exit_uart 0
}
"Tests Passed : 0" {
- expect_string "Exiting tests." "<<TFTF no tests passed>>"
+ expect_string "Exiting tests." "no TFTF tests passed"
exit_uart -1
}
-re "Tests Failed : \[^0]" {
- expect_string "Exiting tests." "<<TFTF Fail>>"
+ expect_string "Exiting tests." "one or more TFTF tests failed"
exit_uart -1
}
}
diff --git a/expect/tftf-non-primary.exp b/expect/tftf-non-primary.exp
index 8bf23f8..41e15b1 100644
--- a/expect/tftf-non-primary.exp
+++ b/expect/tftf-non-primary.exp
@@ -8,20 +8,20 @@
source [file join [file dirname [info script]] handle-arguments.inc]
-expect_string "Booting trusted firmware test framework" "Starting TFTF"
+expect_string "Booting trusted firmware test framework" "TFTF is booting"
expect_re "Running at NS-EL(1|2)"
expect {
"Tests Failed : 0" {
- expect_string "Exiting tests." "<<TFTF Success>>"
+ expect_string "Exiting tests." "all TFTF tests passed"
exit_uart 0
}
"Tests Passed : 0" {
- puts "<<TFTF no tests passed>>"
+ expect_string "Exiting tests." "no TFTF tests passed"
exit_uart -1
}
-re "Tests Failed : \[^0]" {
- puts "<<TFTF Fail>>"
+ expect_string "Exiting tests." "one or more TFTF tests failed"
exit_uart -1
}
}
diff --git a/expect/tftf-sgi.exp b/expect/tftf-sgi.exp
index 63626e9..80390ee 100644
--- a/expect/tftf-sgi.exp
+++ b/expect/tftf-sgi.exp
@@ -8,20 +8,20 @@
source [file join [file dirname [info script]] handle-arguments.inc]
-expect_string "Booting trusted firmware test framework" "Starting TFTF"
+expect_string "Booting trusted firmware test framework" "TFTF is booting"
expect_re "Running at NS-EL(1|2)"
expect {
"Tests Failed : 0" {
- expect_string "Exiting tests." "<<TFTF Success>>"
+ expect_string "Exiting tests." "all TFTF tests passed"
exit_uart 0
}
"Tests Passed : 0" {
- expect_string "Exiting tests." "<<TFTF no tests passed>>"
+ expect_string "Exiting tests." "no TFTF tests passed"
exit_uart -1
}
-re "Tests Failed : \[^0]" {
- expect_string "Exiting tests." "<<TFTF Fail>>"
+ expect_string "Exiting tests." "one or more TFTF tests failed"
exit_uart -1
}
}
diff --git a/expect/tftf.exp b/expect/tftf.exp
index 2b1ed24..161c171 100644
--- a/expect/tftf.exp
+++ b/expect/tftf.exp
@@ -10,20 +10,20 @@
source [file join [file dirname [info script]] trusted-firmware.inc]
-expect_string "Booting trusted firmware test framework" "Starting TFTF"
+expect_string "Booting trusted firmware test framework" "TFTF is booting"
expect_re "Running at NS-EL(1|2)"
expect {
"Tests Failed : 0" {
- expect_string "Exiting tests." "<<TFTF Success>>"
+ expect_string "Exiting tests." "all TFTF tests passed"
exit_uart 0
}
"Tests Passed : 0" {
- expect_string "Exiting tests." "<<TFTF no tests passed>>"
+ expect_string "Exiting tests." "no TFTF tests passed"
exit_uart -1
}
-re "Tests Failed : \[^0]" {
- expect_string "Exiting tests." "<<TFTF Fail>>"
+ expect_string "Exiting tests." "one or more TFTF tests failed"
exit_uart -1
}
}
diff --git a/expect/tftf_fault.exp b/expect/tftf_fault.exp
index 32aa41a..0288f03 100644
--- a/expect/tftf_fault.exp
+++ b/expect/tftf_fault.exp
@@ -10,7 +10,7 @@
# Expect the test to have set a fault message
if {![info exists ::env(tftf_fault_msg)]} {
- puts "Fault message not set"
+ message "Fault message not set"
exit_uart -1
}
diff --git a/expect/timeout.inc b/expect/timeout.inc
index 7e07ff6..6d5d0de 100644
--- a/expect/timeout.inc
+++ b/expect/timeout.inc
@@ -4,32 +4,32 @@
# SPDX-License-Identifier: BSD-3-Clause
#
-puts "<<test completed, waiting for EOF or timeout>>"
+message "test completed, waiting for EOF or timeout"
expect {
"Exiting tests." {
- puts "<<expected hang, found TFTF completion>>"
+ message "expected hang, found TFTF completion"
}
"PANIC in EL3." {
- puts "<<expected hang, found crash dump>>"
+ message "expected hang, found crash dump"
}
"Unhandled Exception in EL3." {
- puts "<<expected hang, found crash dump>>"
+ message "expected hang, found crash dump"
}
"Unhandled Exception from EL" {
- puts "<<expected hang, found crash dump>>"
+ message "expected hang, found crash dump"
}
eof {
- puts "<<stream closed as expected, exiting>>"
+ message "stream closed as expected, exiting"
exit 0
}
timeout {
- puts "<<timeout triggered as expected, exiting>>"
+ message "timeout triggered as expected, exiting"
exit_uart 0
}
}
diff --git a/expect/timeout_test.exp b/expect/timeout_test.exp
index 11fb0c5..d68a13d 100644
--- a/expect/timeout_test.exp
+++ b/expect/timeout_test.exp
@@ -8,6 +8,6 @@
source [file join [file dirname [info script]] handle-arguments.inc]
-expect_string "Booting trusted firmware test framework" "Starting TFTF"
+expect_string "Booting trusted firmware test framework" "TFTF is booting"
source [file join [file dirname [info script]] timeout.inc]
diff --git a/expect/trusted-firmware-aarch32.inc b/expect/trusted-firmware-aarch32.inc
index 8d309c9..ad57f56 100644
--- a/expect/trusted-firmware-aarch32.inc
+++ b/expect/trusted-firmware-aarch32.inc
@@ -15,21 +15,21 @@
expect_string "Booting Trusted Firmware"
expect {
- "BL1: Booting BL2" { puts "<<BL2 booting>>" }
+ "BL1: Booting BL2" { message "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>>"
+ message "BL2 loading error"
exit_uart -1
}
}
expect_string "BL1: Booting BL32"
} else {
- puts "<<Skipping early boot messages from BL1 and BL2>>"
+ message "Skipping early boot messages from BL1 and BL2"
}
-expect_string "SP_MIN:" "Booting SP_MIN"
+expect_string "SP_MIN:" "SP_MIN is booting"
diff --git a/expect/trusted-firmware.inc b/expect/trusted-firmware.inc
index fc5af71..d19d7e7 100644
--- a/expect/trusted-firmware.inc
+++ b/expect/trusted-firmware.inc
@@ -14,19 +14,19 @@
expect_string "Booting Trusted Firmware"
expect {
- "BL1: Booting BL2" { puts "<<BL2 booting>>" }
+ "BL1: Booting BL2" { message "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>>"
+ message "BL2 loading error"
exit_uart -1
}
}
expect_string "BL1: Booting BL31"
} else {
- puts "<<Skipping early boot messages from BL1 and BL2>>"
+ message "Skipping early boot messages from BL1 and BL2"
}
diff --git a/expect/tsp.exp b/expect/tsp.exp
index f65b389..f152335 100644
--- a/expect/tsp.exp
+++ b/expect/tsp.exp
@@ -22,7 +22,7 @@
set tsp_resp_proof [get_param tsp_resp_proof 1000]
set tsp_resp_count 0
-expect_string "TSP: Built" "TSP booted"
+expect_string "TSP: Built" "TSP booted successfully"
# TSPD prints more messages only when built with INFO or above.
set tsp_debug [get_param tsp_debug]
@@ -35,7 +35,7 @@
"TSP: cpu" {
incr tsp_resp_count
if {$tsp_resp_count >= $tsp_resp_proof} {
- puts "<<TSP $tsp_resp_count responses; sufficient>>"
+ message "TSP $tsp_resp_count responses; sufficient"
break
}
}
diff --git a/expect/uart-hold.inc b/expect/uart-hold.inc
index e03a83a..40adea1 100644
--- a/expect/uart-hold.inc
+++ b/expect/uart-hold.inc
@@ -16,5 +16,5 @@
source [file join [file dirname [info script]] terminable.inc]
-puts "<<test complete, waiting for EOF or SIGINT>>"
+message "test complete, waiting for EOF or SIGINT"
expect eof
diff --git a/expect/utils.inc b/expect/utils.inc
index fc63529..48f72de 100644
--- a/expect/utils.inc
+++ b/expect/utils.inc
@@ -36,31 +36,47 @@
}
proc exit_timeout {} {
- # Allow UART output to flush
- sleep 1
- puts "<<TIMEOUT>>"
+ message "timeout exceeded, exiting"
exit_uart -1
}
+proc message {string} {
+ puts "<<$string>>"
+}
+
+proc found {value {message ""}} {
+ if {$message eq ""} {
+ message "found: \"$value\""
+ } else {
+ message "found: \"$value\" ($message)"
+ }
+}
+
+proc not_found {value {message ""}} {
+ if {$message eq ""} {
+ message "not found: \"$value\""
+ } else {
+ message "not found: \"$value\" ($message)"
+ }
+}
+
# Expect a given string, and an optional message to be output when it's found.
# If not supplied, the message defaults to the string itself.
proc expect_string {the_string {the_message ""}} {
- if {$the_message eq ""} {
- set the_message $the_string
- }
+ message "waiting for: \"$the_string\""
expect {
$the_string {
- puts "<<$the_message>>"
+ found "$the_string" "$the_message"
}
eof {
- puts "<<not found: \"$the_string\">>"
+ not_found "$the_string"
exit -1
}
timeout {
- puts "<<Not found: $the_string>>"
+ not_found "$the_string"
exit_timeout
}
}
@@ -70,22 +86,20 @@
# it's found. If not supplied, the message defaults to the regular expression
# itself.
proc expect_re {the_re {the_message ""}} {
- if {$the_message eq ""} {
- set the_message $the_re
- }
+ message "waiting for: \"$the_re\""
expect {
-re $the_re {
- puts "<<$the_message>>"
+ found "$the_re" "$the_message"
}
eof {
- puts "<<not found: \"$the_re\">>"
+ not_found "$the_re"
exit -1
}
timeout {
- puts "<<Not found: $the_re>>"
+ not_found "$the_re"
exit_timeout
}
}