From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id 758223858D28 for ; Wed, 21 Jun 2023 14:30:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 758223858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id A00111FEB1 for ; Wed, 21 Jun 2023 14:30:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1687357801; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e/CCdQ0ryHPFhcjLe4eS8IVkpm6aKy9pbuEpjK8yfTA=; b=IqHWNQAATHCAdz6AuY7R9P5dWsy1vnILaGdGcRKgk8DISulRvDCbFDqo0/nhs1LotDRs9J YqJqErmiGFzaroPS82gjRYhHpRVWVQR2Ur+N9THQHTmT3+5Amc9/bnCDyNjbiVK8YgPNnD nWbROEmMlsEkyUL09geQ2VDOCVYM29c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1687357801; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e/CCdQ0ryHPFhcjLe4eS8IVkpm6aKy9pbuEpjK8yfTA=; b=xSrHwIzix6B/bePiK0erKFodA1UYs0zLC9lj9lK242yvMl+6+GcXKEkRuzhMQhUy03a5L8 a/0bKhbRCTiKr5DA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 8E1E3133E6 for ; Wed, 21 Jun 2023 14:30:01 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id RCB5IWkJk2Q4CAAAMHmgww (envelope-from ) for ; Wed, 21 Jun 2023 14:30:01 +0000 Message-ID: <1e32d85e-fae8-50e1-1a1e-173c1eb7ea37@suse.de> Date: Wed, 21 Jun 2023 16:30:03 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH] [gdb/testsuite] Add have_host_locale Content-Language: en-US To: gdb-patches@sourceware.org References: <20230612162946.8923-1-tdevries@suse.de> From: Tom de Vries In-Reply-To: <20230612162946.8923-1-tdevries@suse.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 6/12/23 18:29, Tom de Vries via Gdb-patches wrote: > 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. > Pushed. Thanks, - Tom > Tested on powerpc64le-linux and x86_64-linux. > --- > gdb/testsuite/gdb.ada/non-ascii-latin-1.exp | 1 + > gdb/testsuite/gdb.ada/non-ascii-latin-3.exp | 1 + > gdb/testsuite/gdb.ada/non-ascii-utf-8.exp | 1 + > gdb/testsuite/gdb.base/utf8-identifiers.exp | 1 + > gdb/testsuite/gdb.rust/unicode.exp | 1 + > gdb/testsuite/gdb.tui/pr30056.exp | 1 + > gdb/testsuite/lib/gdb.exp | 36 +++++++++++++++++++++ > 7 files changed, 42 insertions(+) > > diff --git a/gdb/testsuite/gdb.ada/non-ascii-latin-1.exp b/gdb/testsuite/gdb.ada/non-ascii-latin-1.exp > index 3cdf53dcdfc..877a864717b 100644 > --- a/gdb/testsuite/gdb.ada/non-ascii-latin-1.exp > +++ b/gdb/testsuite/gdb.ada/non-ascii-latin-1.exp > @@ -18,6 +18,7 @@ > load_lib "ada.exp" > > require allow_ada_tests > +require {have_host_locale C.UTF-8} > > # Enable basic use of UTF-8. LC_ALL gets reset for each testfile. We > # want this despite the program itself using Latin-1, as this test is > diff --git a/gdb/testsuite/gdb.ada/non-ascii-latin-3.exp b/gdb/testsuite/gdb.ada/non-ascii-latin-3.exp > index 5b5ae292177..285fa23e16a 100644 > --- a/gdb/testsuite/gdb.ada/non-ascii-latin-3.exp > +++ b/gdb/testsuite/gdb.ada/non-ascii-latin-3.exp > @@ -18,6 +18,7 @@ > load_lib "ada.exp" > > require allow_ada_tests > +require {have_host_locale C.UTF-8} > > # Enable basic use of UTF-8. LC_ALL gets reset for each testfile. We > # want this despite the program itself using Latin-1, as this test is > diff --git a/gdb/testsuite/gdb.ada/non-ascii-utf-8.exp b/gdb/testsuite/gdb.ada/non-ascii-utf-8.exp > index c1211619ca8..acf13fc84ce 100644 > --- a/gdb/testsuite/gdb.ada/non-ascii-utf-8.exp > +++ b/gdb/testsuite/gdb.ada/non-ascii-utf-8.exp > @@ -18,6 +18,7 @@ > load_lib "ada.exp" > > require allow_ada_tests > +require {have_host_locale C.UTF-8} > > # Enable basic use of UTF-8. LC_ALL gets reset for each testfile. > setenv LC_ALL C.UTF-8 > diff --git a/gdb/testsuite/gdb.base/utf8-identifiers.exp b/gdb/testsuite/gdb.base/utf8-identifiers.exp > index 48dce3cdc11..54a9a471f26 100644 > --- a/gdb/testsuite/gdb.base/utf8-identifiers.exp > +++ b/gdb/testsuite/gdb.base/utf8-identifiers.exp > @@ -25,6 +25,7 @@ if { [is_c_compiler_gcc] } { > # Gcc fully supports fextended-identifiers starting GCC 5. > require {expr [gcc_major_version] >= 5} > } > +require {have_host_locale C.UTF-8} > > standard_testfile > > diff --git a/gdb/testsuite/gdb.rust/unicode.exp b/gdb/testsuite/gdb.rust/unicode.exp > index 97b37af316a..62619e8e769 100644 > --- a/gdb/testsuite/gdb.rust/unicode.exp > +++ b/gdb/testsuite/gdb.rust/unicode.exp > @@ -18,6 +18,7 @@ > load_lib rust-support.exp > require allow_rust_tests > require {can_compile rust} > +require {have_host_locale C.UTF-8} > > # Non-ASCII identifiers were allowed starting in 1.53. > require {rust_at_least 1.53} > diff --git a/gdb/testsuite/gdb.tui/pr30056.exp b/gdb/testsuite/gdb.tui/pr30056.exp > index 48eaa5735b8..55229dc1965 100644 > --- a/gdb/testsuite/gdb.tui/pr30056.exp > +++ b/gdb/testsuite/gdb.tui/pr30056.exp > @@ -18,6 +18,7 @@ > # This PR is fixed in the in-repo copy of readline. System readline may or > # may not be fixed, so skip this test-case. > require !with_system_readline > +require {have_host_locale C.UTF-8} > > tuiterm_env > > diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp > index 3cdd73b7da3..ba9b265b4c1 100644 > --- a/gdb/testsuite/lib/gdb.exp > +++ b/gdb/testsuite/lib/gdb.exp > @@ -9775,5 +9775,41 @@ proc lappend_include_file { flags file } { > } > } > > +# Return a list of supported host locales. > + > +gdb_caching_proc host_locales { } { > + set result [remote_exec host "locale -a"] > + set status [lindex $result 0] > + set output [lindex $result 1] > + > + if { $status != 0 } { > + return {} > + } > + > + # Split into list. > + set output [string trim $output] > + set l [split $output \n] > + > + # Trim items. > + set l [lmap v $l { string trim $v }] > + > + # Normalize items to lower-case. > + set l [lmap v $l { string tolower $v }] > + > + return $l > +} > + > +# Return 1 if host locale LOCALE is supported. > + > +proc have_host_locale { locale } { > + # Normalize to lower-case. > + set locale [string tolower $locale] > + # Normalize to without dash. > + set locale [string map { "-" "" } $locale] > + > + set idx [lsearch [host_locales] $locale] > + return [expr $idx != -1] > +} > + > # Always load compatibility stuff. > load_lib future.exp > > base-commit: 9f82823f8972fbd4bba0230b27828d87f0548cbc