OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [dejagnu/] [config/] [netware.exp] - Blame information for rev 1776

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
# Copyright (C) 1994, 1996, 1997 Free Software Foundation, Inc.
2
 
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
 
17
# Please email any bugs, comments, and/or additions to this file to:
18
# bug-gcc@prep.ai.mit.edu
19
 
20
# This file was written by J.T. Conklin. (jtc@cygnus.com)
21
 
22
#
23
# load support libraries
24
#
25
load_lib remote.exp
26
 
27
# set target variables only if needed
28
 
29
proc ${board}_init { args } {
30
    global NLMCONV
31
    if ![info exists NLMCONV] then {
32
        set NLMCONV [findfile "$rootme/../binutils/nlmconv"]
33
    }
34
    global LD
35
    if ![info exists LD] then {
36
        set LD [findfile "$rootme/../ld/ld-new" "$rootme/../ld/ld-new" [transform "ld"]]
37
    }
38
 
39
    set shell_prompt "Password:"
40
    set shell_id [remote_open target];
41
    if [target_info exists passwd] {
42
        set passwd [target_info passwd];
43
    } else {
44
        set passwd "";
45
    }
46
    if $shell_id<0 then {
47
        warning "Couldn't connect to target"
48
        return -1
49
    }
50
 
51
    if [string match "" $passwd] then {
52
        stty -echo
53
        send_user "Password: "
54
        expect_user -re "(.*)\n"
55
        send_user "\n"
56
        set passwd "$expect_out(1,string)"
57
        stty echo
58
    }
59
 
60
    send -i $shell_id "$passwd\n"
61
    expect {
62
        -i $shell_id ":" {
63
            verbose "Got termtype prompt" 0
64
        }
65
 
66
        -i $shell_id timeout {
67
            warning "Connection timed out"
68
            return -1
69
        }
70
    }
71
 
72
    # FIXME
73
    set shell_prompt "[string toupper [target_info name]]:"
74
    send -i $shell_id "1\n"
75
 
76
    expect {
77
        -i $shell_id -re "$shell_prompt" {}
78
        -i $shell_id timeout {
79
            warning "Connection timed out"
80
            return -1
81
        }
82
    }
83
}
84
 
85
 
86
#
87
# ${board}_load -- load the program and execute it
88
#
89
# See default.exp for explanation of arguments and results.
90
#
91
 
92
proc ${board}_load { dest prog args } {
93
    global LD NLMCONV
94
    global tmpdir
95
    global errorCode
96
 
97
    if [board_info $dest exists fileid] {
98
        set shell_id [board_info $dest fileid];
99
    } else {
100
        set shell_id -1;
101
    }
102
 
103
    set output ""
104
 
105
    if $shell_id<0 then {
106
        verbose -log "$prog not executed because there is no target" 3
107
        return "untested"
108
    }
109
 
110
    #
111
    set exe [file tail $prog]
112
 
113
    # We can't blindly append a suffix to the object name, because the
114
    # result may not be valid on netware's 8.3 filesystem.
115
    set nlm "$tmpdir/x.nlm"
116
    set lnk "$tmpdir/x.lnk"
117
 
118
    # build *.lnk file
119
    set fd [open $lnk w]
120
    puts $fd "description \"$exe\""
121
    puts $fd "screenname \"System Console\""
122
    puts $fd "module clib.nlm"
123
    puts $fd "module mathlib.nlm"
124
    puts $fd "stack 65536"
125
    puts $fd "debug"
126
    # FIXME: don't hardcode location of prelude.o
127
    puts $fd "input /s1/cygnus/dejagnu/i386-netware/lib/prelude.o"
128
    puts $fd "input $prog"
129
    puts $fd "output $nlm"
130
    close $fd
131
 
132
    # run nlmconv
133
    verbose "Executing: $NLMCONV -l$LD -T$lnk" 1
134
    catch "exec $NLMCONV -l$LD -T$lnk" output
135
    if ![string match "" $output] then {
136
        verbose $output 1
137
    }
138
    if ![string match "NONE" $errorCode] {
139
        verbose -log "Can't link $prog" 3
140
        return "fail"
141
    }
142
 
143
    # download
144
    verbose "Downloading $nlm" 1
145
    catch "exec cp $nlm /.NetWare/[board_info $dest name].nws/sys.nwv/tmp/x.nlm" output
146
    if ![string match "" $output] then {
147
        verbose $output 1
148
        verbose -log "cp failed for $nlm" 3
149
        return "unresolved"
150
    }
151
 
152
    # Wait a second for the file to "settle" on the NetWare server.
153
    # I've encountered unexplained failures without this delay.
154
#    sleep 1
155
 
156
 
157
    # The NetWare remote console expects to be connected to a vt100
158
    # compatible terminal.  It isn't very efficent, and it seems to
159
    # send screen repaints for no reason.  So we have to clear the
160
    # screen as we run each test, otherwise a shell prompt or abort
161
    # message from a previous test could cause incorrect results.
162
    send -i $shell_id "CLS\r\n"
163
    set timeout 1
164
    expect {
165
        -i $shell_id -re "$shell_prompt" {
166
            exp_continue
167
        }
168
    }
169
    set timeout 10
170
 
171
 
172
    # Netware does not support exit status.  The best we can do to
173
    # detect failures is to look for the "ABNORMAL NLM TERMINATION"
174
    # message printed by abort().
175
    set ret 0
176
    send -i $shell_id "LOAD X.NLM\r\n"
177
    expect {
178
        -i $shell_id "ABNORMAL NLM TERMINATION" {
179
            set ret 1
180
            exp_continue
181
        }
182
        -i $shell_id "Unable to find load file" {
183
            perror "Couldn't execute program"
184
            verbose -log "Couldn't execute program" 3
185
            return "unresolved"
186
        }
187
        -i $shell_id timeout {
188
            perror "Couldn't execute program (timed out)"
189
            verbose -log "Couldn't execute program (timed out)" 3
190
            return "unresolved"
191
        }
192
        -i $shell_id -re "[format "%sLOAD" $shell_prompt]" {
193
            exp_continue
194
        }
195
        -i $shell_id -re "$shell_prompt" {}
196
    }
197
 
198
    catch [exec rm -f $lnk]
199
    catch [exec rm -f $nlm]
200
 
201
    if { $ret == 0 } {
202
        return "pass"
203
    } else {
204
        return "fail"
205
    }
206
}
207
 
208
#
209
# ${tool}_exit -- shutdown the connection
210
#
211
 
212
proc ${board}_exit {} {
213
    remote_close target;
214
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.