35 |
set shell_prompt [board_info $hostname shell_prompt] |
set shell_prompt [board_info $hostname shell_prompt] |
36 |
if ![board_info $hostname exists mondfe,name] { |
if ![board_info $hostname exists mondfe,name] { |
37 |
perror "Must set board_info(${hostname},mondfe,name)" |
perror "Must set board_info(${hostname},mondfe,name)" |
38 |
return -1; |
return -1 |
39 |
} |
} |
40 |
if [board_info $hostname exists mondfe] { |
if [board_info $hostname exists mondfe] { |
41 |
set mondfe [board_info $hostname mondfe]; |
set mondfe [board_info $hostname mondfe] |
42 |
} else { |
} else { |
43 |
set mondfe "mondfe" |
set mondfe "mondfe" |
44 |
} |
} |
45 |
|
|
46 |
set remote_host [board_info $hostname mondfe,name]; |
set remote_host [board_info $hostname mondfe,name] |
47 |
|
|
48 |
if [board_info $hostname exists mondfe_host] { |
if [board_info $hostname exists mondfe_host] { |
49 |
set rh [board_info $hostname mondfe_host]; |
set rh [board_info $hostname mondfe_host] |
50 |
} else { |
} else { |
51 |
verbose "Attempting to connect to $hostname via mondfe." |
verbose "Attempting to connect to $hostname via mondfe." |
52 |
set rh "host"; |
set rh "host" |
53 |
} |
} |
54 |
|
|
55 |
set shell_id [remote_spawn $rh "$mondfe -D -TIP $remote_host"]; |
set shell_id [remote_spawn $rh "$mondfe -D -TIP $remote_host"] |
56 |
|
|
57 |
remote_expect $rh 60 { |
remote_expect $rh 60 { |
58 |
"$shell_prompt" { |
"$shell_prompt" { |
63 |
warning "Socket file already exists." |
warning "Socket file already exists." |
64 |
incr retries |
incr retries |
65 |
if { $retries <= 2 } { |
if { $retries <= 2 } { |
66 |
exp_continue; |
exp_continue |
67 |
} |
} |
68 |
} |
} |
69 |
-indices -re ".*(UDIERROR\[^\r\n\]*)\[\r\n\]" { |
-indices -re ".*(UDIERROR\[^\r\n\]*)\[\r\n\]" { |
70 |
warning "$expect_out(1,string)" |
warning "$expect_out(1,string)" |
71 |
exp_continue; |
exp_continue |
72 |
} |
} |
73 |
-indices -re ".*(DFEERROR\[^\r\n\]*)\[\r\n\]" { |
-indices -re ".*(DFEERROR\[^\r\n\]*)\[\r\n\]" { |
74 |
warning "$expect_out(1,string)" |
warning "$expect_out(1,string)" |
75 |
exp_continue; |
exp_continue |
76 |
} |
} |
77 |
timeout { |
timeout { |
78 |
warning "Timed out trying to connect." |
warning "Timed out trying to connect." |
80 |
incr retries |
incr retries |
81 |
if { $retries <= 2 } { |
if { $retries <= 2 } { |
82 |
remote_send $rh "\n" |
remote_send $rh "\n" |
83 |
exp_continue; |
exp_continue |
84 |
} |
} |
85 |
} |
} |
86 |
} |
} |
87 |
|
|
88 |
if { $result < 0 } { |
if { $result < 0 } { |
89 |
perror "Couldn't connect after $retries retries." |
perror "Couldn't connect after $retries retries." |
90 |
remote_close $rh; |
remote_close $rh |
91 |
return -1 |
return -1 |
92 |
} else { |
} else { |
93 |
set board_info($hostname,fileid) $shell_id; |
set board_info($hostname,fileid) $shell_id |
94 |
return $shell_id; |
return $shell_id |
95 |
} |
} |
96 |
} |
} |
97 |
|
|
112 |
set shell_prompt [board_info $dest_machine shell_prompt] |
set shell_prompt [board_info $dest_machine shell_prompt] |
113 |
|
|
114 |
if [board_info $dest_machine exists mondfe_host] { |
if [board_info $dest_machine exists mondfe_host] { |
115 |
set remote_host [board_info $dest_machine mondfe_host]; |
set remote_host [board_info $dest_machine mondfe_host] |
116 |
set file [remote_download $remote_host $file montest] |
set file [remote_download $remote_host $file montest] |
117 |
} else { |
} else { |
118 |
set remote_host "host"; |
set remote_host "host" |
119 |
} |
} |
120 |
|
|
121 |
verbose "Downloading $file." 2 |
verbose "Downloading $file." 2 |
124 |
remote_send $remote_host "y $file\n" |
remote_send $remote_host "y $file\n" |
125 |
remote_expect $remote_host 60 { |
remote_expect $remote_host 60 { |
126 |
"y $file" { |
"y $file" { |
127 |
exp_continue; |
exp_continue |
128 |
} |
} |
129 |
-re "loading $file\[\r\n\]+" { |
-re "loading $file\[\r\n\]+" { |
130 |
exp_continue; |
exp_continue |
131 |
} |
} |
132 |
-re "Load(ing|ed) *TEXT section from\[^\r\n\]*\[\r\n\]+" { |
-re "Load(ing|ed) *TEXT section from\[^\r\n\]*\[\r\n\]+" { |
133 |
verbose -n "." 2 |
verbose -n "." 2 |
134 |
exp_continue; |
exp_continue |
135 |
} |
} |
136 |
-re "Load(ing|ed) *LIT section from\[^\r\n\]*\[\r\n\]+" { |
-re "Load(ing|ed) *LIT section from\[^\r\n\]*\[\r\n\]+" { |
137 |
verbose -n "." 2 |
verbose -n "." 2 |
138 |
exp_continue; |
exp_continue |
139 |
} |
} |
140 |
-re "Load(ing|ed) *DATA section from\[^\r\n\]*\[\r\n\]+" { |
-re "Load(ing|ed) *DATA section from\[^\r\n\]*\[\r\n\]+" { |
141 |
verbose -n "." 2 |
verbose -n "." 2 |
142 |
exp_continue; |
exp_continue |
143 |
} |
} |
144 |
-re "Clear(ing|ed) *BSS section from\[^\r\n\]*\[\r\n\]+" { |
-re "Clear(ing|ed) *BSS section from\[^\r\n\]*\[\r\n\]+" { |
145 |
verbose -n "." 2 |
verbose -n "." 2 |
146 |
exp_continue; |
exp_continue |
147 |
} |
} |
148 |
-re "(^|\[\r\n\]+)$shell_prompt$" { |
-re "(^|\[\r\n\]+)$shell_prompt$" { |
149 |
verbose "Downloaded $file successfully." 2 |
verbose "Downloaded $file successfully." 2 |
158 |
} |
} |
159 |
-re "Ignoring COMMENT section \($decimal bytes\)\[^\r\n\]*\[\r\n\]+" { |
-re "Ignoring COMMENT section \($decimal bytes\)\[^\r\n\]*\[\r\n\]+" { |
160 |
verbose "Ignoring COMMENT section" 2 |
verbose "Ignoring COMMENT section" 2 |
161 |
exp_continue; |
exp_continue |
162 |
} |
} |
163 |
timeout { |
timeout { |
164 |
perror "Timed out trying to download $file." |
perror "Timed out trying to download $file." |
184 |
global board_info |
global board_info |
185 |
|
|
186 |
if [board_info $hostname exists mondfe_host] { |
if [board_info $hostname exists mondfe_host] { |
187 |
set remote_host [board_info $hostname mondfe_host]; |
set remote_host [board_info $hostname mondfe_host] |
188 |
} else { |
} else { |
189 |
set remote_host "host"; |
set remote_host "host" |
190 |
} |
} |
191 |
|
|
192 |
if ![board_info $hostname exists fileid] { |
if ![board_info $hostname exists fileid] { |
193 |
return 0; |
return 0 |
194 |
} |
} |
195 |
|
|
196 |
if [board_info $remote_host exists fileid] { |
if [board_info $remote_host exists fileid] { |
204 |
} |
} |
205 |
} |
} |
206 |
|
|
207 |
remote_close $remote_host; |
remote_close $remote_host |
208 |
} |
} |
209 |
|
|
210 |
unset board_info($hostname,fileid); |
unset board_info($hostname,fileid) |
211 |
|
|
212 |
return 0; |
return 0 |
213 |
} |
} |