1
# Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software
4
# This file is part of DejaGnu.
6
# DejaGnu is free software; you can redistribute it and/or modify it
7
# under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 2 of the License, or
9
# (at your option) any later version.
11
# DejaGnu is distributed in the hope that it will be useful, but
12
# WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
# General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with DejaGnu; if not, write to the Free Software Foundation,
19
# When using the simulator (-n iss) and running nice'd, things can naturally
20
# take a little longer, so increase the timeout.
23
# udi_load -- load the program and execute it
25
# See default.exp for explanation of arguments and results.
28
proc udi_load { dest prog args } {
29
set shell_prompt [board_info $dest shell_prompt]
32
if ![file exists $prog] then {
33
perror "$prog does not exist."
34
verbose -log "$prog does not exist." 3
35
return [list "untested" ""]
39
if ![board_info $dest exists fileid] then {
41
if ![board_info $dest exists fileid] then {
42
verbose -log "$prog not executed, couldn't connect to $dest." 3
47
if { [remote_ld $dest $prog] == "" } {
48
verbose -log "$prog not executed, load failed." 3
49
return [list "unresolved" ""]
57
verbose "Executing $prog." 2
58
remote_send $dest "g\n"
59
# FIXME: The value 300 below should be a parameter.
60
remote_expect $dest 300 {
61
-re "(.*)Process exited with 0x0\[^\r\n\]*\[\r\n\]" {
62
append output $expect_out(1,string)
63
verbose "$prog executed successfully" 2
68
-re "(.*)Halt instruction encountered" {
69
append output $expect_out(1,string)
70
verbose "$prog got a HALT instruction" 2
75
-re "(^|\[\r\n\])$shell_prompt" {
76
if { $result == -1 } {
80
-re "(^|\[\r\n\]+)g\[\r\n\]+" {
85
append output $expect_out(buffer)
86
if { [string length $output] < 512000 } {
96
warning "$prog timed out."
103
set status [check_for_board_status output]
114
warning "Resetting $dest."
115
remote_send $dest "r\n"
116
remote_expect $dest 5 {
117
-re "r.*$shell_prompt.*" {
118
verbose "Target reset." 2
121
# Get nastier. We want to leave the system in a state
122
# ready to run the next testcase.
123
remote_send $dest "q\n"
125
set udi_shell_id [remote_open $dest]
126
if { $udi_shell_id < 0 } {
127
perror "Couldn't reset $dest."
131
if { $result == 1 } {
134
set result "unresolved"
138
set result "unresolved"
141
return [list $result $output]
145
# udi_exit -- shutdown the connection (or simulator)
152
set_board_info protocol "udi"
153
set_board_info connect "mondfe"
154
set_board_info shell_prompt "mondfe>"