* gdb.cp/abstract-origin.exp: Use standard_testfile.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.cp / ctti.exp
1 # Copyright 1998-1999, 2001, 2003-2004, 2007-2012 Free Software
2 # Foundation, Inc.
3
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17 # This file is part of the gdb testsuite
18 # file written by Elena Zannoni (ezannoni@cygnus.com)
19 # rewritten by Michael Chastain (mec.gnu@mindspring.com)
20 #
21 # source files cttiadd.cc, cttiadd1.cc, cttiadd2.cc, cttiadd3.cc
22
23 # Call to template instantiations.
24
25 if { [skip_cplus_tests] } { continue }
26
27 standard_testfile cttiadd.cc cttiadd1.cc cttiadd2.cc cttiadd3.cc
28
29 if [get_compiler_info "c++"] {
30 return -1;
31 }
32
33 if {[prepare_for_testing $testfile.exp $testfile \
34 [list $srcfile $srcfile2 $srcfile3 $srcfile4] {debug c++}]} {
35 return -1
36 }
37
38 if ![runto_main] then {
39 perror "couldn't run to breakpoint"
40 continue
41 }
42
43 gdb_breakpoint [gdb_get_line_number "marker add1"]
44 gdb_continue_to_breakpoint "marker add1"
45
46 gdb_test "print c" "\\$\[0-9\]+ = 194 .*"
47 gdb_test "print f" "\\$\[0-9\]+ = 9"
48 gdb_test "print i" "\\$\[0-9\]+ = 4"
49
50 # TODO: this needs more work before actually deploying it.
51 # So bail out here.
52
53 if { [ test_compiler_info gcc-*] } then { continue }
54
55 gdb_test_multiple "print add<int>(2,2)" "print add<int>(2,2)" {
56 -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" {
57 pass "print add<int>(2,2)"
58 }
59 -re "No symbol \"add<int>\" in current context.\r\n$gdb_prompt $" {
60 # TODO: kfail or xfail this
61 fail "print add<int>(2,2)"
62 }
63 }
64
65 # Note: 2.25 and 4.5 are exactly representable in IEEE-ish formats
66 gdb_test_multiple "print add<float>(2.25,2.25)" "print add<float>(2.25,2.25)" {
67 -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" {
68 pass "print add<float>(2.25,2.25)"
69 }
70 -re "No symbol \"add<float>\" in current context.\r\n$gdb_prompt $" {
71 # TODO: kfail or xfail this
72 fail "print add<float>(2.25,2.25)"
73 }
74 }
75
76 gdb_test_multiple "print add<unsigned char>('A','A')" "print add<unsigned char>('A','A')" {
77 -re "\\$\[0-9\]+ = 130 .*\r\n$gdb_prompt $" {
78 pass "print add<unsigned char>('A','A')"
79 }
80 -re "No symbol \"add<unsigned char>\" in current context.\r\n$gdb_prompt $" {
81 # TODO: kfail or xfail this
82 fail "print add<unsigned char>('A','A')"
83 }
84 }
85
86 gdb_test_multiple "print add2<int>(2,2)" "print add2<int>(2,2)" {
87 -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" {
88 pass "print add2<int>(2,2)"
89 }
90 -re "No symbol \"add2<int>\" in current context.\r\n$gdb_prompt $" {
91 # TODO: kfail or xfail this
92 fail "print add2<int>(2,2)"
93 }
94 }
95
96 gdb_test_multiple "print add2<float>(2.25,2.25)" "print add2<float>(2.25,2.25)" {
97 -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" {
98 pass "print add2<float>(2.25,2.25)"
99 }
100 -re "No symbol \"add2<float>\" in current context.\r\n$gdb_prompt $" {
101 # TODO: kfail or xfail this
102 fail "print add2<float>(2.25,2.25)"
103 }
104 }
105
106 gdb_test_multiple "print add2<unsigned char>('A','A')" "print add2<unsigned char>('A','A')" {
107 -re "\\$\[0-9]+ = 130 .*$gdb_prompt $" {
108 pass "print add2<unsigned char>('A','A')"
109 }
110 -re "No symbol \"add2<unsigned char>\" in current context.\r\n$gdb_prompt $" {
111 # TODO: kfail or xfail this
112 fail "print add2<unsigned char>('A','A')"
113 }
114 }
115
116 gdb_test_multiple "print add3<int>(2,2)" "print add3<int>(2,2)" {
117 -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" {
118 pass "print add3<int>(2,2)"
119 }
120 -re "No symbol \"add3<int>\" in current context.\r\n$gdb_prompt $" {
121 # TODO: kfail or xfail this
122 fail "print add3<int>(2,2)"
123 }
124 }
125
126 gdb_test_multiple "print add3<float>(2.25,2.25)" "print add3<float>(2.25,2.25)" {
127 -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" {
128 pass "print add3<float>(2.25,2.25)"
129 }
130 -re "No symbol \"add3<float>\" in current context.\r\n$gdb_prompt $" {
131 # TODO: kfail or xfail this
132 fail "print add3<float>(2.25,2.25)"
133 }
134 }
135
136 gdb_test_multiple "print add3<unsigned char>('A','A')" "print add3<unsigned char>('A','A')" {
137 -re "\\$\[0-9]+ = 130 .*$gdb_prompt $" {
138 pass "print add3<unsigned char>('A','A')"
139 }
140 -re "No symbol \"add3<unsigned char>\" in current context.\r\n$gdb_prompt $" {
141 # TODO: kfail or xfail this
142 fail "print add3<unsigned char>('A','A')"
143 }
144 }
145
146 gdb_test_multiple "print add4<int>(2,2)" "print add4<int>(2,2)" {
147 -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" {
148 pass "print add4<int>(2,2)"
149 }
150 -re "No symbol \"add4<int>\" in current context.\r\n$gdb_prompt $" {
151 # TODO: kfail or xfail this
152 fail "print add4<int>(2,2)"
153 }
154 }
155
156 gdb_test_multiple "print add4<float>(2.25,2.25)" "print add4<float>(2.25,2.25)" {
157 -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" {
158 pass "print add4<float>(2.25,2.25)"
159 }
160 -re "No symbol \"add4<float>\" in current context.\r\n$gdb_prompt $" {
161 # TODO: kfail or xfail this
162 fail "print add4<float>(2.25,2.25)"
163 }
164 }
165
166 gdb_test_multiple "print add4<unsigned char>('A','A')" "print add4<unsigned char>('A','A')" {
167 -re "\\$\[0-9]+ = 130 .*$gdb_prompt $" {
168 pass "print add4<unsigned char>('A','A')"
169 }
170 -re "No symbol \"add4<unsigned char>\" in current context.\r\n$gdb_prompt $" {
171 # TODO: kfail or xfail this
172 fail "print add4<unsigned char>('A','A')"
173 }
174 }
This page took 0.034128 seconds and 5 git commands to generate.