Commit | Line | Data |
---|---|---|
b811d2c2 | 1 | # Copyright (C) 2010-2020 Free Software Foundation, Inc. |
8dc78533 JK |
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 error while loading *-gdb.py. IBM1047 is chosen as possibly supported | |
17 | # by glibc but unsupported by Python | |
18 | ||
19 | set testfile "py-error" | |
20 | ||
21 | load_lib gdb-python.exp | |
22 | ||
23 | # Start with a fresh gdb. | |
24 | gdb_exit | |
25 | gdb_start | |
26 | ||
27 | # Skip all tests if Python scripting is not enabled. | |
28 | if { [skip_python_tests] } { continue } | |
29 | ||
30 | set charset "IBM1047" | |
31 | ||
32 | set test2 "main reached" | |
33 | ||
34 | set test "set host-charset $charset" | |
35 | set test_regex [string_to_regexp $test] | |
36 | gdb_test_multiple $test $test { | |
37 | -re "^$test_regex\r\n$gdb_prompt $" { | |
38 | pass $test | |
39 | } | |
40 | -re "^$test_regex\r\nUndefined item: \"$charset\"\\.\r\n$gdb_prompt $" { | |
41 | xfail $test | |
42 | untested $test2 | |
43 | set test2 "" | |
44 | } | |
45 | } | |
46 | ||
47 | if {$test2 == ""} { | |
48 | return 0 | |
49 | } | |
50 | ||
8448e842 TT |
51 | set remote_python_file [gdb_remote_download host \ |
52 | ${srcdir}/${subdir}/${testfile}.py] | |
8dc78533 JK |
53 | |
54 | # argc=LookupError: unknown encoding: IBM1047 | |
55 | gdb_test "source $remote_python_file" "Traceback.*ClassName.*\r\nLookupError: unknown encoding: $charset" $test2 | |
56 | ||
57 | gdb_test "p 1" " = 1" "no delayed error" |