feat: use original Expect scripts for UART validation

To avoid having to implement custom Python post-expect scripts for every
payload that might use a non-primary UART, and to make use of as much
prior art as possible, this change replaces the OpenCI-only post-expect
scripts with the same one uses used by both the local and on-premises CI.

The original Expect scripts have been amended to identify whether they're
being run in the postprocessing step and, if so, load the UART log from a
file rather than connecting to the FVP over Telnet.

Change-Id: I61a5859de4f3f62b50deaffe84580206ec411c99
Signed-off-by: Chris Kay <chris.kay@arm.com>
diff --git a/expect/utils.inc b/expect/utils.inc
index 0100534..3d5a7f5 100644
--- a/expect/utils.inc
+++ b/expect/utils.inc
@@ -1,8 +1,19 @@
 #
-# Copyright (c) 2019-2020 Arm Limited. All rights reserved.
+# Copyright (c) 2019-2022, Arm Limited. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
+
+# Determine whether the script is being run on a live FVP UART terminal or
+# postprocessing a UART log file (probably dumped by LAVA).
+proc postprocessing {} {
+	if { [info exists ::env(uart_log_file)] } {
+		return 1
+	} else {
+		return 0
+	}
+}
+
 # Retrieve script parameters from environment variables. If they don't exist,
 # return empty string
 proc get_param {name {default ""}} {
@@ -14,10 +25,13 @@
 }
 
 proc exit_uart {status} {
-	# Allow UART output to flush
-	sleep 1
-	send "\x1b"
-	send "close\r"
+	if { [postprocessing] != 1 } {
+		# Allow UART output to flush
+		sleep 1
+		send "\x1b"
+		send "close\r"
+	}
+
 	exit $status
 }