Commit | Line | Data |
---|---|---|
ecd75fc8 | 1 | # Copyright 2002-2014 Free Software Foundation, Inc. |
54951bd7 AC |
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 | |
e22f8b7c | 5 | # the Free Software Foundation; either version 3 of the License, or |
54951bd7 | 6 | # (at your option) any later version. |
e22f8b7c | 7 | # |
54951bd7 AC |
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. | |
e22f8b7c | 12 | # |
54951bd7 | 13 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
54951bd7 | 15 | |
54951bd7 AC |
16 | # This file was written by Andrew Cagney (cagney at redhat dot com), |
17 | # derived from xfullpath.exp (written by Joel Brobecker), derived from | |
18 | # selftest.exp (written by Rob Savoye). | |
19 | ||
c95aea6b | 20 | load_lib selftest-support.exp |
54951bd7 | 21 | |
c0b9f2c6 PA |
22 | if [target_info exists gdb,noinferiorio] { |
23 | verbose "Skipping because of no inferiorio capabilities." | |
24 | return | |
25 | } | |
26 | ||
9dd34b2b | 27 | proc test_initial_complaints { } { |
54951bd7 AC |
28 | |
29 | global gdb_prompt | |
30 | ||
31 | # Unsupress complaints | |
32 | gdb_test "set stop_whining = 2" | |
33 | ||
34 | # Prime the system | |
35 | gdb_test "call complaint (&symfile_complaints, \"Register a complaint\")" \ | |
36 | "During symbol reading, Register a complaint." | |
37 | ||
38 | # Check that the complaint was inserted and where | |
39 | gdb_test "print symfile_complaints->root->fmt" \ | |
40 | ".\[0-9\]+ =.*\"Register a complaint\"" | |
41 | ||
42 | # Re-issue the first message #1 | |
43 | gdb_test "call complaint (&symfile_complaints, symfile_complaints->root->fmt)" \ | |
44 | "During symbol reading, Register a complaint." | |
45 | ||
46 | # Check that there is only one thing in the list | |
47 | gdb_test "print symfile_complaints->root->next == &complaint_sentinel" \ | |
48 | ".\[0-9\]+ = 1" "list has one entry" | |
49 | ||
50 | # Add a second complaint, expect it | |
51 | gdb_test "call complaint (&symfile_complaints, \"Testing! Testing! Testing!\")" \ | |
52 | "During symbol reading, Testing. Testing. Testing.." | |
53 | ||
54 | return 0 | |
55 | } | |
56 | ||
57 | proc test_serial_complaints { } { | |
58 | ||
59 | global gdb_prompt | |
60 | ||
61 | gdb_test_exact "call clear_complaints (&symfile_complaints, 1, 0)" "" "serial start" | |
62 | ||
63 | # Prime the system | |
a127f7b4 MS |
64 | gdb_test_multiple "call complaint (&symfile_complaints, \"serial line 1\")" "serial line 1" { |
65 | -re "During symbol reading...serial line 1...$gdb_prompt $" { | |
54951bd7 AC |
66 | pass "serial line 1" |
67 | } | |
54951bd7 AC |
68 | } |
69 | ||
70 | # Add a second complaint, expect it | |
a127f7b4 | 71 | gdb_test_multiple "call complaint (&symfile_complaints, \"serial line 2\")" "serial line 2" { |
54951bd7 AC |
72 | -re "serial line 2...$gdb_prompt " { |
73 | pass "serial line 2" | |
74 | } | |
54951bd7 AC |
75 | } |
76 | ||
a127f7b4 | 77 | gdb_test_multiple "call clear_complaints (&symfile_complaints, 1, 0)" "serial end" { |
54951bd7 AC |
78 | -re "\r\n\r\n$gdb_prompt " { |
79 | pass "serial end" | |
80 | } | |
54951bd7 AC |
81 | } |
82 | ||
83 | return 0 | |
84 | } | |
85 | ||
86 | # For short complaints, all are the same | |
87 | ||
88 | proc test_short_complaints { } { | |
89 | ||
90 | global gdb_prompt | |
91 | ||
92 | gdb_test_exact "call clear_complaints (&symfile_complaints, 1, 1)" "" "short start" | |
93 | ||
94 | # Prime the system | |
a127f7b4 | 95 | gdb_test_multiple "call complaint (&symfile_complaints, \"short line 1\")" "short line 1" { |
54951bd7 AC |
96 | -re "short line 1...$gdb_prompt " { |
97 | pass "short line 1" | |
98 | } | |
54951bd7 AC |
99 | } |
100 | ||
101 | # Add a second complaint, expect it | |
a127f7b4 | 102 | gdb_test_multiple "call complaint (&symfile_complaints, \"short line 2\")" "short line 2" { |
54951bd7 AC |
103 | -re "short line 2...$gdb_prompt " { |
104 | pass "short line 2" | |
105 | } | |
54951bd7 AC |
106 | } |
107 | ||
a127f7b4 | 108 | gdb_test_multiple "call clear_complaints (&symfile_complaints, 1, 0)" "short end" { |
54951bd7 AC |
109 | -re "\r\n\r\n$gdb_prompt " { |
110 | pass "short end" | |
111 | } | |
54951bd7 AC |
112 | } |
113 | ||
114 | return 0 | |
115 | } | |
116 | ||
9dd34b2b AC |
117 | # Check that nothing comes out when there haven't been any real |
118 | # complaints. Note that each test is really checking the previous | |
119 | # command. | |
120 | ||
121 | proc test_empty_complaint { cmd msg } { | |
122 | global gdb_prompt | |
a127f7b4 MS |
123 | gdb_test_multiple $cmd $msg { |
124 | -re "\r\n\r\n$gdb_prompt $" { | |
9dd34b2b AC |
125 | fail $msg |
126 | } | |
a127f7b4 | 127 | "\r\n$gdb_prompt $" { |
9dd34b2b AC |
128 | pass $msg |
129 | } | |
9dd34b2b | 130 | } |
9dd34b2b AC |
131 | } |
132 | ||
133 | proc test_empty_complaints { } { | |
134 | ||
38979823 | 135 | test_empty_complaint "call clear_complaints(&symfile_complaints,0,0)" \ |
9dd34b2b | 136 | "empty non-verbose non-noisy clear" |
38979823 | 137 | test_empty_complaint "call clear_complaints(&symfile_complaints,1,0)" \ |
9dd34b2b | 138 | "empty verbose non-noisy clear" |
38979823 | 139 | test_empty_complaint "call clear_complaints(&symfile_complaints,1,1)" \ |
9dd34b2b | 140 | "empty verbose noisy clear" |
38979823 | 141 | test_empty_complaint "call clear_complaints(&symfile_complaints,0,1)" \ |
9dd34b2b AC |
142 | "empty non-verbose noisy clear" |
143 | ||
144 | return 0 | |
145 | } | |
146 | ||
c95aea6b TT |
147 | do_self_tests captured_command_loop { |
148 | test_initial_complaints | |
149 | test_serial_complaints | |
150 | test_short_complaints | |
151 | test_empty_complaints | |
54951bd7 | 152 | } |