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

Subversion Repositories or1k

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

Go to most recent revision | 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
global EXPECT
23
if ![info exists EXPECT] then {
24
    set EXPECT $objdir/expect
25
}
26
 
27
set eprompt "expect\[0-9.\-\]*> "
28
global eprompt
29
 
30
#
31
# expect_version -- extract and print the version number of expect
32
#
33
proc expect_version { } {
34
    global EXPECT
35
 
36
    catch {exec echo "puts \[exp_version\]\n" | $EXPECT} version
37
    if [info exists version] then {
38
        clone_output "[which $EXPECT] version is $version\n"
39
    unset version
40
}
41
}
42
 
43
#
44
# expect_exit -- exit the test driver for expect
45
#
46
proc expect_exit {} {
47
}
48
 
49
#
50
# expect_start -- start expect
51
#
52
proc expect_start { } {
53
    global spawn_id
54
    global srcdir
55
    global EXPECT
56
    global eprompt
57
    global objdir
58
 
59
    set defs    "$srcdir/../tests/defs"
60
 
61
    if {[which $EXPECT] != 0} then {
62
    spawn $EXPECT
63
    } else {
64
        error "Can't find $EXPECT"
65
    }
66
 
67
    expect {
68
        -re "expect.*> " {
69
            verbose "Started the child expect shell"
70
        }
71
        timeout {
72
            error "Timed out starting the child expect shell."
73
        }
74
    }
75
 
76
    exp_send "set objdir $objdir\r"
77
    verbose "Sourcing $defs..."
78
    exp_send "source $defs\r"
79
    expect {
80
        -re ".*source $defs.*$" {
81
            verbose "Sourced $defs"
82
        }
83
        "Error: couldn't read file*" {
84
            error "Couldn't source $defs"
85
            return -1
86
        }
87
        -re "$eprompt" {
88
            verbose "Got prompt, sourced $defs"
89
            }
90
        timeout {
91
            error "Timed out sourcing $defs."
92
            return 1
93
        }
94
    }
95
 
96
    sleep 2
97
    exp_send "set VERBOSE 1\r"
98
    expect {
99
        -re "set VERBOSE 1\[\r\n\]*1\[\r\n\]*$eprompt" {
100
            verbose "Set verbose flag for tests"
101
        }
102
        timeout {
103
            perror "Timed out setting verbose flag."
104
        }
105
    }
106
    return $spawn_id
107
}

powered by: WebSVN 2.1.0

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