]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.mi/mi-cmd-error.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi-cmd-error.exp
1 # Copyright 2016-2024 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 3 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, see <http://www.gnu.org/licenses/>.
15
16 # Test that after:
17 #
18 # - a failing synchronous execution command, or,
19 # - a failing non-execution command, or,
20 # - a non-failing command,
21 #
22 # ... MI continues processing input. We actually test all
23 # combinations of pairs of the above. See PR mi/20431.
24
25 load_lib mi-support.exp
26 set MIFLAGS "-i=mi"
27
28 if {[mi_clean_restart]} {
29 return
30 }
31
32 # A synchronous execution execution command that errors out.
33
34 proc failing_sync_execution_command {} {
35 mi_gdb_test "-exec-continue" \
36 {\^error,msg=\"The program is not being run.\"} \
37 "failing sync execution command"
38 }
39
40 # A non-execution command that errors out.
41
42 proc failing_non_execution_command {} {
43 mi_gdb_test "-invalid-command" \
44 {\^error,msg=\"Undefined MI command: invalid-command\",code=\"undefined-command\"} \
45 "failing non-execution command"
46 }
47
48 # A command that doesn't error out.
49
50 proc non_failing_command {} {
51 mi_gdb_test "-gdb-show version" \
52 ".*Free Software Foundation.*\\^done" \
53 "non-failing command"
54 }
55
56 # A list of procedures to try.
57 set procs {
58 failing_sync_execution_command
59 failing_non_execution_command
60 non_failing_command
61 }
62
63 # User-friendly names for procedures above, in the same order.
64 set cmdnames {
65 "failing sync execution command"
66 "failing non-execution command"
67 "non-failing command"
68 }
69
70 for {set i 0} {$i < [llength $procs]} {incr i} {
71 for {set j 0} {$j < [llength $procs]} {incr j} {
72 with_test_prefix "[lindex $cmdnames $i] first ($i x $j)" {
73 with_test_prefix "1st" [lindex $procs $i]
74 with_test_prefix "2nd" [lindex $procs $j]
75 }
76 }
77 }