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