Initial commit for TF-A CI scripts

Signed-off-by: Fathi Boudra <fathi.boudra@linaro.org>
diff --git a/expect/utils.inc b/expect/utils.inc
new file mode 100644
index 0000000..5c13f00
--- /dev/null
+++ b/expect/utils.inc
@@ -0,0 +1,68 @@
+#
+# Copyright (c) 2019, Arm Limited. All rights reserved.
+#
+# 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 ""}} {
+	if {[info exists ::env($name)]} {
+		return $::env($name)
+	} else {
+		return $default
+	}
+}
+
+proc exit_uart {status} {
+	# Allow UART output to flush
+	sleep 1
+	send "\x1b"
+	send "close\r"
+	exit $status
+}
+
+proc exit_timeout {} {
+	# Allow UART output to flush
+	sleep 1
+	puts "<<TIMEOUT>>"
+	exit_uart -1
+}
+
+# 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
+	}
+
+	expect {
+		$the_string {
+			puts "<<$the_message>>"
+		}
+		timeout {
+			puts "<<Not found: $the_string>>"
+			exit_timeout
+		}
+	}
+}
+
+# Expect a given regular expression, and an optional message to be output when
+# 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
+	}
+
+	expect {
+		-re $the_re {
+			puts "<<$the_message>>"
+		}
+		timeout {
+			puts "<<Not found: $the_re>>"
+			exit_timeout
+		}
+	}
+}