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