Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 1 | # |
Chris Kay | 395d49d | 2022-10-17 13:31:21 +0100 | [diff] [blame] | 2 | # Copyright (c) 2019-2022, Arm Limited. All rights reserved. |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 6 | # 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 | |
| 10 | source [file join [file dirname [info script]] utils.inc] |
| 11 | |
| 12 | # Store environment variables into local variables |
Chris Kay | 395d49d | 2022-10-17 13:31:21 +0100 | [diff] [blame] | 13 | set timeout [get_param timeout 30] |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 14 | |
Chris Kay | 395d49d | 2022-10-17 13:31:21 +0100 | [diff] [blame] | 15 | if { [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 Kay | 3d2ae33 | 2022-11-15 11:32:03 +0000 | [diff] [blame] | 24 | |
Chris Kay | 5e3449f | 2022-11-15 11:59:01 +0000 | [diff] [blame] | 25 | trap { |
Chris Kay | 78ea2c3 | 2022-11-15 12:24:24 +0000 | [diff] [blame] | 26 | message "test not yet complete, ignoring SIGINT" |
Chris Kay | 5e3449f | 2022-11-15 11:59:01 +0000 | [diff] [blame] | 27 | } SIGINT |
| 28 | |
Chris Kay | 3d2ae33 | 2022-11-15 11:32:03 +0000 | [diff] [blame] | 29 | expect_after { |
| 30 | eof { |
Chris Kay | 78ea2c3 | 2022-11-15 12:24:24 +0000 | [diff] [blame] | 31 | message "stream closed prematurely, exiting" |
Chris Kay | 3d2ae33 | 2022-11-15 11:32:03 +0000 | [diff] [blame] | 32 | exit -1 |
| 33 | } |
| 34 | |
| 35 | timeout { |
| 36 | exit_timeout |
| 37 | } |
| 38 | } |