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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.xml/] [tdesc-arch.exp] - Blame information for rev 833

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

Line No. Rev Author Line
1 227 jeremybenn
# Copyright 2007, 2008, 2009, 2010 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 3 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, see .
15
 
16
if {[gdb_skip_xml_test]} {
17
    unsupported "tdesc-arch.exp"
18
    return -1
19
}
20
 
21
gdb_start
22
 
23
# Find some valid architectures - we just need legitimate values
24
# to put in our  elements.
25
set arch1 ""
26
set arch2 ""
27
set msg "read valid architectures"
28
gdb_test_multiple "set architecture" $msg {
29
    -re "Requires an argument. Valid arguments are (\[^ \]*), (\[^ \]*), .*auto\\.\r\n$gdb_prompt $" {
30
        set arch1 $expect_out(1,string)
31
        set arch2 $expect_out(2,string)
32
        pass $msg
33
    }
34
    -re "Requires an argument. Valid arguments are (\[^ \]*), auto\\.\r\n$gdb_prompt $" {
35
        # If there is just one supported architecture, we can't do this test.
36
        unsupported "tdesc-arch.exp"
37
        return -1
38
    }
39
}
40
 
41
set default_arch ""
42
set msg "read default architecture"
43
gdb_test_multiple "show architecture" $msg {
44
    -re "The target architecture is set automatically \\(currently (\[^ \]*)\\)\r\n$gdb_prompt $" {
45
        set default_arch $expect_out(1,string)
46
        pass $msg
47
    }
48
}
49
 
50
# If that did not work, no point running further tests.
51
if { "$arch1" == "" || "$arch2" == "" || "$default_arch" == "" } {
52
    unresolved "architecture XML tests"
53
    return -1
54
}
55
 
56
# Run these tests twice, once for $arch1 and once for $arch2, to
57
# make sure that the tdesc file overrides the global default.
58
 
59
proc set_arch { arch which } {
60
    global gdb_prompt
61
    global subdir
62
 
63
    set fd [open "$subdir/tdesc-arch.xml" w]
64
    puts $fd \
65
        "
66
            $arch
67
         "
68
    close $fd
69
    remote_download host "${subdir}/tdesc-arch.xml" "tdesc-arch.xml"
70
 
71
    # Anchor the test output, so that error messages are detected.
72
    set cmd "set tdesc filename tdesc-arch.xml"
73
    set msg "$cmd ($which architecture)"
74
    set cmd_regex [string_to_regexp $cmd]
75
    gdb_test_multiple $cmd $msg {
76
        -re "^$cmd_regex\r\n$gdb_prompt $" {
77
            pass $msg
78
        }
79
        -re "^$cmd_regex\r\nwarning: A handler for the OS ABI.*\r\n$gdb_prompt $" {
80
            kfail gdb/2225 $msg
81
        }
82
    }
83
 
84
    set cmd "show architecture"
85
    gdb_test $cmd \
86
        "The target architecture is set automatically \\(currently $arch\\)" \
87
        "$cmd ($which architecture)"
88
 
89
    file delete "${subdir}/tdesc-arch.xml"
90
    remote_file host delete "tdesc-arch.xml"
91
}
92
 
93
set_arch $arch1 first
94
set_arch $arch2 second
95
 
96
# Check an invalid architecture setting.
97
set fd [open "${subdir}/tdesc-arch.xml" w]
98
puts $fd \
99
    "
100
       invalid
101
     "
102
close $fd
103
remote_download host "$subdir/tdesc-arch.xml" "tdesc-arch.xml"
104
 
105
set cmd "set tdesc filename tdesc-arch.xml"
106
gdb_test $cmd \
107
    "warning:.*Target description specified unknown architecture.*" \
108
    "$cmd (invalid architecture)"
109
 
110
set cmd "show architecture"
111
gdb_test $cmd \
112
    "The target architecture is set automatically \\(currently $default_arch\\)" \
113
    "$cmd (invalid architecture)"
114
 
115
file delete "${subdir}/tdesc-arch.xml"
116
remote_file host delete "tdesc-arch.xml"

powered by: WebSVN 2.1.0

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