[ping] Different outputs affected by locale

Message ID 539FB99C.4020200@codesourcery.com
State Committed
Headers

Commit Message

Yao Qi June 17, 2014, 3:44 a.m. UTC
  On 06/13/2014 01:23 AM, Pedro Alves wrote:
> So what I'm thinking is indeed going with making the test
> accept the cent, but conditioned, like:

OK, that is more restrict.

> 
> # Fallback to assuming 7-bit ASCII.  Test are ran under LC_CTYPE=C.
> 
> set cent "\\\\242"
> 
> set test "show host-charset"
> gdb_test_multiple $test $test {
>    -re "CP1252\r\n$gdb_prompt $" {

I tweak the pattern to match the output...

>         # With Windows code page 1252 (Latin 1), the cent
>         # is printable.
> 	set cent "\u00A2"
> 	pass $test
>    }
>    -re "$gdb_prompt $" {
> 	pass $test
>    }
> }

... and how about the patch below?
  

Comments

Pedro Alves June 17, 2014, 10:03 a.m. UTC | #1
On 06/17/2014 04:44 AM, Yao Qi wrote:
> On 06/13/2014 01:23 AM, Pedro Alves wrote:
>> So what I'm thinking is indeed going with making the test
>> accept the cent, but conditioned, like:
> 
> OK, that is more restrict.
> 
>>
>> # Fallback to assuming 7-bit ASCII.  Test are ran under LC_CTYPE=C.
>>
>> set cent "\\\\242"
>>
>> set test "show host-charset"
>> gdb_test_multiple $test $test {
>>    -re "CP1252\r\n$gdb_prompt $" {
> 
> I tweak the pattern to match the output...
> 
>>         # With Windows code page 1252 (Latin 1), the cent
>>         # is printable.
>> 	set cent "\u00A2"
>> 	pass $test
>>    }
>>    -re "$gdb_prompt $" {
>> 	pass $test
>>    }
>> }
> 
> ... and how about the patch below?
> 

Looks good to me.

Thanks,
  
Yao Qi June 17, 2014, 11:37 a.m. UTC | #2
On 06/17/2014 06:03 PM, Pedro Alves wrote:
> Looks good to me.

Thanks for the review.  Patch is pushed in.
  

Patch

diff --git a/gdb/testsuite/gdb.base/wchar.exp b/gdb/testsuite/gdb.base/wchar.exp
index 4290478..651bd88 100644
--- a/gdb/testsuite/gdb.base/wchar.exp
+++ b/gdb/testsuite/gdb.base/wchar.exp
@@ -37,6 +37,20 @@  gdb_test "print simple\[2\]" "= 99 L'c'"
 gdb_test "print difficile\[2\]" "= 65261 L'\\\\xfeed'"
 
 set cent "\\\\242"
+
+set test "show host-charset"
+gdb_test_multiple $test $test {
+   -re "CP1252\".*\r\n$gdb_prompt $" {
+       # With Windows code page 1252 (Latin 1), the cent
+       # is printable.
+	set cent "\u00A2"
+	pass $test
+   }
+   -re "$gdb_prompt $" {
+	pass $test
+   }
+}
+
 gdb_test "print repeat" "= L\"A\", '$cent' <repeats 21 times>, \"B.*"
 
 global hex