Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.python / py-error.exp
CommitLineData
88b9d363 1# Copyright (C) 2010-2022 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
19set testfile "py-error"
20
21load_lib gdb-python.exp
22
23# Start with a fresh gdb.
24gdb_exit
25gdb_start
26
27# Skip all tests if Python scripting is not enabled.
28if { [skip_python_tests] } { continue }
29
30set charset "IBM1047"
31
32set test2 "main reached"
33
34set test "set host-charset $charset"
35set test_regex [string_to_regexp $test]
36gdb_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
47if {$test2 == ""} {
48 return 0
49}
50
8448e842
TT
51set remote_python_file [gdb_remote_download host \
52 ${srcdir}/${subdir}/${testfile}.py]
8dc78533
JK
53
54# argc=LookupError: unknown encoding: IBM1047
55gdb_test "source $remote_python_file" "Traceback.*ClassName.*\r\nLookupError: unknown encoding: $charset" $test2
56
57gdb_test "p 1" " = 1" "no delayed error"
This page took 1.891089 seconds and 4 git commands to generate.