1 # Copyright 2002-2014 Free Software Foundation, Inc.
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.
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.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
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).
20 load_lib selftest-support.exp
22 if [target_info exists gdb,noinferiorio] {
23 verbose "Skipping because of no inferiorio capabilities."
27 proc test_initial_complaints { } {
31 # Unsupress complaints
32 gdb_test "set stop_whining = 2"
35 gdb_test "call complaint (&symfile_complaints, \"Register a complaint\")" \
36 "During symbol reading, Register a complaint."
38 # Check that the complaint was inserted and where
39 gdb_test "print symfile_complaints->root->fmt" \
40 ".\[0-9\]+ =.*\"Register a complaint\""
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."
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"
50 # Add a second complaint, expect it
51 gdb_test "call complaint (&symfile_complaints, \"Testing! Testing! Testing!\")" \
52 "During symbol reading, Testing. Testing. Testing.."
57 proc test_serial_complaints { } {
61 gdb_test_exact "call clear_complaints (&symfile_complaints, 1, 0)" "" "serial start"
64 gdb_test_multiple "call complaint (&symfile_complaints, \"serial line 1\")" "serial line 1" {
65 -re "During symbol reading...serial line 1...$gdb_prompt $" {
70 # Add a second complaint, expect it
71 gdb_test_multiple "call complaint (&symfile_complaints, \"serial line 2\")" "serial line 2" {
72 -re "serial line 2...$gdb_prompt " {
77 gdb_test_multiple "call clear_complaints (&symfile_complaints, 1, 0)" "serial end" {
78 -re "\r\n\r\n$gdb_prompt " {
86 # For short complaints, all are the same
88 proc test_short_complaints { } {
92 gdb_test_exact "call clear_complaints (&symfile_complaints, 1, 1)" "" "short start"
95 gdb_test_multiple "call complaint (&symfile_complaints, \"short line 1\")" "short line 1" {
96 -re "short line 1...$gdb_prompt " {
101 # Add a second complaint, expect it
102 gdb_test_multiple "call complaint (&symfile_complaints, \"short line 2\")" "short line 2" {
103 -re "short line 2...$gdb_prompt " {
108 gdb_test_multiple "call clear_complaints (&symfile_complaints, 1, 0)" "short end" {
109 -re "\r\n\r\n$gdb_prompt " {
117 # Check that nothing comes out when there haven't been any real
118 # complaints. Note that each test is really checking the previous
121 proc test_empty_complaint { cmd msg } {
123 gdb_test_multiple $cmd $msg {
124 -re "\r\n\r\n$gdb_prompt $" {
127 "\r\n$gdb_prompt $" {
133 proc test_empty_complaints { } {
135 test_empty_complaint "call clear_complaints(&symfile_complaints,0,0)" \
136 "empty non-verbose non-noisy clear"
137 test_empty_complaint "call clear_complaints(&symfile_complaints,1,0)" \
138 "empty verbose non-noisy clear"
139 test_empty_complaint "call clear_complaints(&symfile_complaints,1,1)" \
140 "empty verbose noisy clear"
141 test_empty_complaint "call clear_complaints(&symfile_complaints,0,1)" \
142 "empty non-verbose noisy clear"
147 do_self_tests captured_command_loop {
148 test_initial_complaints
149 test_serial_complaints
150 test_short_complaints
151 test_empty_complaints