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

Subversion Repositories or1k

[/] [or1k/] [tags/] [start/] [insight/] [dejagnu/] [config/] [udi.exp] - Blame information for rev 579

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
# DejaGnu@cygnus.com
19
 
20
# This file was originally written by Rob Savoye. (rob@cygnus.com)
21
# and modified by Bob Manson (manson@cygnus.com)
22
 
23
# When using the simulator (-n iss) and running nice'd, things can naturally
24
# take a little longer, so increase the timeout.
25
 
26
#
27
# udi_load -- load the program and execute it
28
#
29
# See default.exp for explanation of arguments and results.
30
#
31
 
32
proc udi_load { dest prog args } {
33
    set shell_prompt [board_info $dest shell_prompt];
34
    set output "";
35
 
36
    if ![file exists $prog] then {
37
        perror "$prog does not exist."
38
        verbose -log "$prog does not exist." 3
39
        return [list "untested" ""];
40
    }
41
 
42
    # Load the program.
43
    if ![board_info $dest exists fileid] then {
44
        remote_open $dest;
45
        if ![board_info $dest exists fileid] then {
46
            verbose -log "$prog not executed, couldn't connect to $dest." 3
47
            return "untested"
48
        }
49
    }
50
 
51
    if { [remote_ld $dest $prog] == "" } {
52
        verbose -log "$prog not executed, load failed." 3
53
        return [list "unresolved" ""];
54
    }
55
 
56
    # Execute it.
57
    set result -1
58
    set output "";
59
    set noappend 0;
60
 
61
    verbose "Executing $prog." 2
62
    remote_send $dest "g\n"
63
    # FIXME: The value 300 below should be a parameter.
64
    remote_expect $dest 300 {
65
        -re "(.*)Process exited with 0x0\[^\r\n\]*\[\r\n\]" {
66
            append output $expect_out(1,string);
67
            verbose "$prog executed successfully" 2
68
            set noappend 1;
69
            set result 0;
70
            exp_continue;
71
        }
72
        -re "(.*)Halt instruction encountered" {
73
            append output $expect_out(1,string);
74
            verbose "$prog got a HALT instruction" 2
75
            set result 1;
76
            set noappend 1;
77
            exp_continue;
78
        }
79
        -re "(^|\[\r\n\])$shell_prompt" {
80
            if { $result == -1 } {
81
                exp_continue;
82
            }
83
        }
84
        -re "(^|\[\r\n\]+)g\[\r\n\]+" {
85
            exp_continue;
86
        }
87
        -re "\[\r\n\]+" {
88
            if { ! $noappend } {
89
                append output $expect_out(buffer);
90
                if { [string length $output] < 512000 } {
91
                    exp_continue;
92
                } else {
93
                    set result 1;
94
                }
95
            } else {
96
                exp_continue;
97
            }
98
        }
99
        timeout {
100
            warning "$prog timed out."
101
        }
102
    }
103
 
104
    # See what happened.
105
    switch -- $result {
106
 
107
            set status [check_for_board_status output];
108
            if { $status < 0 } {
109
                blammo
110
            }
111
            if { $status > 0 } {
112
                set result "fail";
113
            } else {
114
                set result "pass"
115
            }
116
        }
117
        1 - -1 {
118
            warning "Resetting $dest."
119
            remote_send $dest "r\n"
120
            remote_expect $dest 5 {
121
                -re "r.*$shell_prompt.*" {
122
                    verbose "Target reset." 2
123
                }
124
                timeout {
125
                    # Get nastier.  We want to leave the system in a state
126
                    # ready to run the next testcase.
127
                    remote_send $dest "q\n"
128
                    remote_close $dest;
129
                    set udi_shell_id [remote_open $dest]
130
                    if { $udi_shell_id < 0 } {
131
                        perror "Couldn't reset $dest."
132
                    }
133
                }
134
            }
135
            if { $result == 1 } {
136
                set result "fail"
137
            } else {
138
                set result "unresolved"
139
            }
140
        }
141
        default {
142
            set result "unresolved"
143
        }
144
    }
145
    return [list $result $output];
146
}
147
 
148
#
149
# udi_exit -- shutdown the connection (or simulator)
150
#
151
 
152
proc udi_exit {} {
153
    remote_close target;
154
}
155
 
156
set_board_info protocol "udi";
157
set_board_info connect "mondfe";
158
set_board_info shell_prompt "mondfe>";

powered by: WebSVN 2.1.0

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