[gdb/testsuite] Add have_host_locale
authorTom de Vries <tdevries@suse.de>
Wed, 21 Jun 2023 14:29:04 +0000 (16:29 +0200)
committerTom de Vries <tdevries@suse.de>
Wed, 21 Jun 2023 14:29:04 +0000 (16:29 +0200)
commit83aa25512de00bbbc469d3bf2414e99c8374e0d7
treed71d4cca955f3b821cd7de2539daac87fcc25183
parentb96cac16078d282ee0924296817c6eee52196669
[gdb/testsuite] Add have_host_locale

With test-case gdb.tui/pr30056.exp, I run into:
...
sh: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)^M
...
and then subsequently into:
...
WARNING: timeout in accept_gdb_output
FAIL: gdb.tui/pr30056.exp: Control-C
...

This is on a CentOS 7 distro for powerpc64le.

Either it has no C.UTF-8 support, or it's not installed:
...
$ locale -a | grep ^C
C
$
...

Fix this by:
- adding a new proc have_host_locale, and
- using it in all test-cases using setenv LC_ALL.

Tested on powerpc64le-linux and x86_64-linux.
gdb/testsuite/gdb.ada/non-ascii-latin-1.exp
gdb/testsuite/gdb.ada/non-ascii-latin-3.exp
gdb/testsuite/gdb.ada/non-ascii-utf-8.exp
gdb/testsuite/gdb.base/utf8-identifiers.exp
gdb/testsuite/gdb.rust/unicode.exp
gdb/testsuite/gdb.tui/pr30056.exp
gdb/testsuite/lib/gdb.exp