Skip gdb.mi/list-thread-groups-available.exp if no xml support
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.mi / list-thread-groups-available.exp
1 # Copyright 2017 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 -list-thread-groups --available works.
17
18 load_lib mi-support.exp
19 set MIFLAGS "-i=mi"
20
21 standard_testfile
22
23 # Support for XML is needed to run this test.
24 if [gdb_skip_xml_test] then {
25 unsupported "list-thread-groups-available.exp"
26 return -1
27 }
28
29 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
30 untested "failed to compile"
31 return -1
32 }
33
34 if [mi_gdb_start] {
35 continue
36 }
37
38 if ![can_spawn_for_attach] {
39 continue
40 }
41
42 set string_re {(?:[^\\"]|\\.)*}
43
44 set id_re "id=\"$decimal\""
45 set type_re "type=\"process\""
46 set description_re "description=\"$string_re\""
47 set user_re "user=\"$string_re\""
48 set cores_re "cores=\[\"$decimal\"(,\"$decimal\")*\]"
49
50 # List all available processes.
51 set process_entry_re "{${id_re},${type_re}(,$description_re)?(,$user_re)?(,$cores_re)?}"
52
53 mi_gdb_test \
54 "-list-thread-groups --available" \
55 "\\^done,groups=\\\[${process_entry_re}(,$process_entry_re)*\\\]" \
56 "list available thread groups"
57
58 # List specific processes, make sure there are two entries.
59 set spawn_id_1 [remote_spawn target $binfile]
60 set pid_1 [spawn_id_get_pid $spawn_id_1]
61 set id_re_1 "id=\"$pid_1\""
62
63 set spawn_id_2 [remote_spawn target $binfile]
64 set pid_2 [spawn_id_get_pid $spawn_id_2]
65 set id_re_2 "id=\"$pid_2\""
66
67 set process_entry_re_1 "{${id_re_1},${type_re}(,$description_re)?(,$user_re)?(,$cores_re)?}"
68 set process_entry_re_2 "{${id_re_2},${type_re}(,$description_re)?(,$user_re)?(,$cores_re)?}"
69
70 set process_list_re "(${process_entry_re_1},${process_entry_re_2}|${process_entry_re_2},${process_entry_re_1})"
71
72 mi_gdb_test \
73 "-list-thread-groups --available i${pid_1} i${pid_2}" \
74 "\\^done,groups=\\\[${process_list_re}\\\]" \
75 "list available thread groups with filter"
76
77 kill_wait_spawned_process $spawn_id_1
78 kill_wait_spawned_process $spawn_id_2
This page took 0.032911 seconds and 4 git commands to generate.