Commit | Line | Data |
---|---|---|
b811d2c2 | 1 | # Copyright 2016-2020 Free Software Foundation, Inc. |
80614914 PA |
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 | gdb_exit | |
29 | if [mi_gdb_start] { | |
30 | continue | |
31 | } | |
32 | ||
33 | standard_testfile | |
34 | ||
35 | # A synchronous execution execution command that errors out. | |
36 | ||
37 | proc failing_sync_execution_command {} { | |
38 | mi_gdb_test "-exec-continue" \ | |
39 | {\^error,msg=\"The program is not being run.\"} \ | |
40 | "failing sync execution command" | |
41 | } | |
42 | ||
43 | # A non-execution command that errors out. | |
44 | ||
45 | proc failing_non_execution_command {} { | |
46 | mi_gdb_test "-invalid-command" \ | |
47 | {\^error,msg=\"Undefined MI command: invalid-command\",code=\"undefined-command\"} \ | |
48 | "failing non-execution command" | |
49 | } | |
50 | ||
51 | # A command that doesn't error out. | |
52 | ||
53 | proc non_failing_command {} { | |
54 | mi_gdb_test "-gdb-show version" \ | |
55 | ".*Free Software Foundation.*\\^done" \ | |
56 | "non-failing command" | |
57 | } | |
58 | ||
59 | # A list of procedures to try. | |
60 | set procs { | |
61 | failing_sync_execution_command | |
62 | failing_non_execution_command | |
63 | non_failing_command | |
64 | } | |
65 | ||
66 | # User-friendly names for procedures above, in the same order. | |
67 | set cmdnames { | |
68 | "failing sync execution command" | |
69 | "failing non-execution command" | |
70 | "non-failing command" | |
71 | } | |
72 | ||
73 | for {set i 0} {$i < [llength $procs]} {incr i} { | |
74 | for {set j 0} {$j < [llength $procs]} {incr j} { | |
75 | with_test_prefix "[lindex $cmdnames $i] first ($i x $j)" { | |
76 | with_test_prefix "1st" [lindex $procs $i] | |
77 | with_test_prefix "2nd" [lindex $procs $j] | |
78 | } | |
79 | } | |
80 | } |