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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tcl/] [testsuite/] [config/] [default.exp] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
#   Copyright (C) 1988, 1990, 1991, 1992, 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, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16
 
17
# Please email any bugs, comments, and/or additions to this file to:
18
# bug-dejagnu@prep.ai.mit.edu
19
 
20
# This file was written by Rob Savoye. (rob@cygnus.com)
21
 
22
set testdrv "unix/tcltest"
23
set tprompt "%"
24
 
25
#
26
# tcl_version -- extract and print the version number of tcl
27
#
28
proc tcl_version { } {
29
    global testdrv
30
 
31
    set version ""
32
    catch "exec echo puts \[info tclversion\] > x"
33
    catch "exec $testdrv x" tmp
34
    catch "exec rm -f x"
35
    regexp "\[0-9\]\.\[0-9\.\]+" $tmp version
36
    clone_output "Tcl library is version\t$version\n"
37
    unset tmp
38
    unset version
39
}
40
 
41
#
42
# tcl_load -- loads the program. For tcl, we just execute it
43
#
44
proc tcl_load { arg } {
45
    global subdir
46
    global testdrv
47
    global spawn_id
48
 
49
    if ![file exists $arg] then {
50
        perror "$arg does not exist."
51
        return -1
52
    }
53
 
54
    verbose "Sourcing $arg..."
55
    send "source $arg\n"
56
    return 0
57
}
58
 
59
#
60
# tcl_exit -- exit the test driver for tcl
61
#
62
proc tcl_exit {} {
63
}
64
 
65
#
66
# tcl_start -- start the test driver for tcl
67
#
68
proc tcl_start { } {
69
    global testdrv
70
    global objdir
71
    global subdir
72
    global srcdir
73
    global verbose
74
    global spawn_id
75
    global tprompt
76
 
77
    set testdrv "$objdir/$testdrv"
78
    set defs    "$srcdir/../tests/defs"
79
    set timeout 100
80
    set timetol 0
81
 
82
    spawn $testdrv
83
 
84
    if ![file exists ${srcdir}/../tests] {
85
        perror "The source for the test cases is missing." 0
86
        return -1
87
    }
88
 
89
    send "[list set srcdir ${srcdir}/../tests]\r"
90
    expect {
91
        -re "set VERBOSE 1\[\r\n\]*1\[\r\n\]*%" {
92
            verbose "Set verbose flag for tests"
93
            exp_continue
94
        }
95
        -re "${srcdir}/../tests\[\r\n\]*$tprompt" {
96
            verbose "Set srcdir to $srcdir/../tests" 2
97
        }
98
        -re "no files matched glob pattern" {
99
            warning "Didn't set srcdir to $srcdir/../tests"
100
        }
101
        timeout {
102
            perror "Couldn't set srcdir"
103
            return -1
104
        }
105
    }
106
 
107
    if ![file exists $defs] then {
108
        perror "$defs does not exist."
109
        return -1
110
    }
111
 
112
    verbose "Sourcing $defs..."
113
    send "source $defs\r\n"
114
 
115
    expect {
116
        -re ".*source $defs.*$" {
117
            verbose "Sourced $defs"
118
            }
119
        "Error: couldn't read file*" {
120
            perror "Couldn't source $defs"
121
            return -1
122
        }
123
        "%" {
124
            verbose "Got prompt, sourced $defs"
125
            }
126
        timeout {
127
            warning "Timed out sourcing $defs."
128
            if { $timetol <= 3 } {
129
                incr timetol
130
                exp_continue
131
            } else {
132
                return -1
133
            }
134
        }
135
    }
136
 
137
    set timetol 0
138
    sleep 2
139
    send "set VERBOSE 1\n"
140
    expect {
141
        -re "% 1.*%" {
142
            verbose "Set verbose flag for tests"
143
        }
144
        -re "set VERBOSE 1.*1.*%" {
145
            verbose "Set verbose flag for tests"
146
        }
147
        timeout {
148
            perror "Timed out setting verbose flag."
149
            if { $timetol <= 3 } {
150
                exp_continue
151
            } else {
152
                return -1
153
            }
154
        }
155
    }
156
    return $spawn_id
157
}

powered by: WebSVN 2.1.0

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