]> Git Repo - binutils.git/blame - gdb/testsuite/gdb.python/py-charset.exp
Automatic date update in version.in
[binutils.git] / gdb / testsuite / gdb.python / py-charset.exp
CommitLineData
61671e97
AB
1# Copyright 2022 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
16load_lib gdb-python.exp
17
18gdb_exit
19gdb_start
20
21# Skip all tests if Python scripting is not enabled.
22if { [skip_python_tests] } { continue }
23
24# Each test data has 4 parts:
25# 1. The string used in 'show XXX-charset' command,
26# 2. The string expected in the output of the command used in #1,
27# 3. The string used is gdb.XXXX_charset() python function call,
28# 4. A string that is a regexp appended to the result of #1, used to
29# match the output of #3
30foreach test_data { {host host host ""} \
31 {target target target ""} \
32 {target-wide "target wide" \
33 "target_wide" "(LE|BE)?"} } {
34 with_test_prefix "charset=[lindex $test_data 0]" {
35 set charset "unknown"
36 gdb_test_multiple "show [lindex $test_data 0]-charset" "" {
37 -re "The [lindex $test_data 1] character set is \"auto; currently (\[^\"\]*)\".*$gdb_prompt $" {
38 set charset $expect_out(1,string)
39 pass $gdb_test_name
40 }
41 -re "The [lindex $test_data 1] character set is \"(\[^\"\]*)\".*$gdb_prompt $" {
42 set charset $expect_out(1,string)
43 pass $gdb_test_name
44 }
45 }
46 set charset "${charset}[lindex $test_data 3]"
47 gdb_test "python print(gdb.[lindex $test_data 2]_charset())" \
48 "${charset}"
49 }
50}
This page took 0.348692 seconds and 4 git commands to generate.