blob: 83d067f7ea877e9580525e1ba3c88ad630c80607 [file] [log] [blame]
Fathi Boudra422bf772019-12-02 11:10:16 +02001#
Chris Kay395d49d2022-10-17 13:31:21 +01002# Copyright (c) 2019-2022, Arm Limited. All rights reserved.
Fathi Boudra422bf772019-12-02 11:10:16 +02003#
4# SPDX-License-Identifier: BSD-3-Clause
5#
Fathi Boudra422bf772019-12-02 11:10:16 +02006# Script to handle the arguments and initialise the expect session.
7#
8# This script is not standalone and should be sourced by a top expect script.
9
10source [file join [file dirname [info script]] utils.inc]
11
12# Store environment variables into local variables
Chris Kay395d49d2022-10-17 13:31:21 +010013set timeout [get_param timeout 30]
Fathi Boudra422bf772019-12-02 11:10:16 +020014
Chris Kay395d49d2022-10-17 13:31:21 +010015if { [postprocessing] != 1 } {
16 # Open a Telnet connection to the required UART port
17 set uart_port [get_param uart_port]
18 set telnet_pid [spawn telnet localhost $uart_port]
19} else {
20 # Read directly from the UART log file
21 set uart_log_file [get_param uart_log_file]
22 set telnet_pid [spawn cat $uart_log_file]
23}
Chris Kay581893e2022-11-15 11:32:03 +000024
Chris Kayd4d95f72022-11-15 11:59:01 +000025trap {
Chris Kayc4f00722022-11-15 12:24:24 +000026 message "test not yet complete, ignoring SIGINT"
Chris Kayd4d95f72022-11-15 11:59:01 +000027} SIGINT
28
Chris Kay581893e2022-11-15 11:32:03 +000029expect_after {
30 eof {
Chris Kayc4f00722022-11-15 12:24:24 +000031 message "stream closed prematurely, exiting"
Chris Kay581893e2022-11-15 11:32:03 +000032 exit -1
33 }
34
35 timeout {
36 exit_timeout
37 }
38}