public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH][gdb/testsuite] Fix gdb.base/float128.exp with --with-mpfr=no
@ 2020-12-10 12:53 Tom de Vries
  2020-12-10 13:08 ` Luis Machado
  2020-12-11  9:17 ` Ulrich Weigand
  0 siblings, 2 replies; 4+ messages in thread
From: Tom de Vries @ 2020-12-10 12:53 UTC (permalink / raw)
  To: gdb-patches; +Cc: Kevin Buettner, Ulrich Weigand, Andreas Arnez

Hi,

When configuring gdb using --with-mpfr=no and running test-case
gdb.base/float128.exp, we run into:
...
FAIL: gdb.base/float128.exp: print large128 (GDB may be missing MPFR support!)
...

Fix this by detecting that gdb was build without mpfr using the show
configuration command, and changing the FAIL into UNSUPPORTED.

Tested on x86_64-linux.

Any comments?

Thanks,
- Tom

[gdb/testsuite] Fix gdb.base/float128.exp with --with-mpfr=no

gdb/testsuite/ChangeLog:

2020-12-10  Tom de Vries  <tdevries@suse.de>

	PR testsuite/26954
	* gdb.base/float128.exp: Detect and handle no mprf support.

---
 gdb/testsuite/gdb.base/float128.exp | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.base/float128.exp b/gdb/testsuite/gdb.base/float128.exp
index 40babcadc1..66f4d89c12 100644
--- a/gdb/testsuite/gdb.base/float128.exp
+++ b/gdb/testsuite/gdb.base/float128.exp
@@ -78,13 +78,34 @@ gdb_test "print f128" ".* = 20\\.375.*" "the value of f128 is changed to 20.375"
 # Note: If we get "inf" instead of the correct result, we may have run into
 # an internal overflow.  This typically happens on host platforms without
 # native IEEE-128 support where GDB was built without MPFR support.
+
+set mpfr_supported -1
+gdb_test_multiple "show configuration" "" {
+    -wrap -re "--with-mpfr\r\n.*" {
+       set mpfr_supported 1
+    }
+    -wrap -re "--without-mpfr\r\n.*" {
+       set mpfr_supported 0
+    }
+}
+
 set test "print large128"
 gdb_test_multiple "print large128" "$test" {
     -re ".* = 1\\.18973149535723176508575932662800702e\\+4932.*$gdb_prompt $" {
 	pass "$test"
     }
     -re ".* = inf.*$gdb_prompt $" {
-	fail "$test (GDB may be missing MPFR support!)"
+       if { $mpfr_supported == 0 } {
+	   if { [istarget "s390*-*-*"] || [istarget "powerpc*-*-*"] } {
+	       # Some of these archs have native 128-bit float support, in
+	       # which case this should be passing, even without MPFR support.
+	       fail $test
+	   } else {
+	       unsupported "$test (Missing MPFR support)"
+	   }
+       } else {
+           fail $test
+       }
     }
     -re ".*$gdb_prompt $" {
 	fail "$test"

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][gdb/testsuite] Fix gdb.base/float128.exp with --with-mpfr=no
  2020-12-10 12:53 [PATCH][gdb/testsuite] Fix gdb.base/float128.exp with --with-mpfr=no Tom de Vries
@ 2020-12-10 13:08 ` Luis Machado
  2020-12-11  9:17 ` Ulrich Weigand
  1 sibling, 0 replies; 4+ messages in thread
From: Luis Machado @ 2020-12-10 13:08 UTC (permalink / raw)
  To: Tom de Vries, gdb-patches; +Cc: Ulrich Weigand

On 12/10/20 9:53 AM, Tom de Vries wrote:
> Hi,
> 
> When configuring gdb using --with-mpfr=no and running test-case
> gdb.base/float128.exp, we run into:
> ...
> FAIL: gdb.base/float128.exp: print large128 (GDB may be missing MPFR support!)
> ...
> 
> Fix this by detecting that gdb was build without mpfr using the show
> configuration command, and changing the FAIL into UNSUPPORTED.
> 
> Tested on x86_64-linux.
> 
> Any comments?

Would it be more convenient to turn this into a reusable check across 
all tests? Something like "supports_128_floats"?

Then again, if only this particular test will use it, it may not be 
worth it.

> 
> Thanks,
> - Tom
> 
> [gdb/testsuite] Fix gdb.base/float128.exp with --with-mpfr=no
> 
> gdb/testsuite/ChangeLog:
> 
> 2020-12-10  Tom de Vries  <tdevries@suse.de>
> 
> 	PR testsuite/26954
> 	* gdb.base/float128.exp: Detect and handle no mprf support.
> 
> ---
>   gdb/testsuite/gdb.base/float128.exp | 23 ++++++++++++++++++++++-
>   1 file changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/gdb/testsuite/gdb.base/float128.exp b/gdb/testsuite/gdb.base/float128.exp
> index 40babcadc1..66f4d89c12 100644
> --- a/gdb/testsuite/gdb.base/float128.exp
> +++ b/gdb/testsuite/gdb.base/float128.exp
> @@ -78,13 +78,34 @@ gdb_test "print f128" ".* = 20\\.375.*" "the value of f128 is changed to 20.375"
>   # Note: If we get "inf" instead of the correct result, we may have run into
>   # an internal overflow.  This typically happens on host platforms without
>   # native IEEE-128 support where GDB was built without MPFR support.
> +
> +set mpfr_supported -1
> +gdb_test_multiple "show configuration" "" {
> +    -wrap -re "--with-mpfr\r\n.*" {
> +       set mpfr_supported 1
> +    }
> +    -wrap -re "--without-mpfr\r\n.*" {
> +       set mpfr_supported 0
> +    }
> +}
> +
>   set test "print large128"
>   gdb_test_multiple "print large128" "$test" {
>       -re ".* = 1\\.18973149535723176508575932662800702e\\+4932.*$gdb_prompt $" {
>   	pass "$test"
>       }
>       -re ".* = inf.*$gdb_prompt $" {
> -	fail "$test (GDB may be missing MPFR support!)"
> +       if { $mpfr_supported == 0 } {
> +	   if { [istarget "s390*-*-*"] || [istarget "powerpc*-*-*"] } {
> +	       # Some of these archs have native 128-bit float support, in
> +	       # which case this should be passing, even without MPFR support.
> +	       fail $test
> +	   } else {
> +	       unsupported "$test (Missing MPFR support)"
> +	   }
> +       } else {
> +           fail $test
> +       }
>       }
>       -re ".*$gdb_prompt $" {
>   	fail "$test"
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][gdb/testsuite] Fix gdb.base/float128.exp with --with-mpfr=no
  2020-12-10 12:53 [PATCH][gdb/testsuite] Fix gdb.base/float128.exp with --with-mpfr=no Tom de Vries
  2020-12-10 13:08 ` Luis Machado
@ 2020-12-11  9:17 ` Ulrich Weigand
  2020-12-11 12:56   ` Tom de Vries
  1 sibling, 1 reply; 4+ messages in thread
From: Ulrich Weigand @ 2020-12-11  9:17 UTC (permalink / raw)
  To: Tom de Vries; +Cc: gdb-patches, Kevin Buettner, Andreas Arnez

On Thu, Dec 10, 2020 at 01:53:35PM +0100, Tom de Vries wrote:

> When configuring gdb using --with-mpfr=no and running test-case
> gdb.base/float128.exp, we run into:
> ...
> FAIL: gdb.base/float128.exp: print large128 (GDB may be missing MPFR support!)
> ...
> 
> Fix this by detecting that gdb was build without mpfr using the show
> configuration command, and changing the FAIL into UNSUPPORTED.

That part looks OK to me, but ...

> +       if { $mpfr_supported == 0 } {
> +	   if { [istarget "s390*-*-*"] || [istarget "powerpc*-*-*"] } {
> +	       # Some of these archs have native 128-bit float support, in
> +	       # which case this should be passing, even without MPFR support.
> +	       fail $test
> +	   } else {
> +	       unsupported "$test (Missing MPFR support)"
> +	   }

... the istarget check isn't quite right - if we want a check like that,
it needs to check whether the *host* platform GDB is running on supports
native 128-bit floats; the istarget check tests the target architecture
(which will be different when testing a cross-debugging scenario).

But I'm not sure we really need that check, I'd be fine with just always
returning unsupported here when GDB is compiled explicitly without MPFR
support (and the test fails).

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][gdb/testsuite] Fix gdb.base/float128.exp with --with-mpfr=no
  2020-12-11  9:17 ` Ulrich Weigand
@ 2020-12-11 12:56   ` Tom de Vries
  0 siblings, 0 replies; 4+ messages in thread
From: Tom de Vries @ 2020-12-11 12:56 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: gdb-patches, Kevin Buettner, Andreas Arnez

[-- Attachment #1: Type: text/plain, Size: 1414 bytes --]

On 12/11/20 10:17 AM, Ulrich Weigand wrote:
> On Thu, Dec 10, 2020 at 01:53:35PM +0100, Tom de Vries wrote:
> 
>> When configuring gdb using --with-mpfr=no and running test-case
>> gdb.base/float128.exp, we run into:
>> ...
>> FAIL: gdb.base/float128.exp: print large128 (GDB may be missing MPFR support!)
>> ...
>>
>> Fix this by detecting that gdb was build without mpfr using the show
>> configuration command, and changing the FAIL into UNSUPPORTED.
> 
> That part looks OK to me, but ...
> 
>> +       if { $mpfr_supported == 0 } {
>> +	   if { [istarget "s390*-*-*"] || [istarget "powerpc*-*-*"] } {
>> +	       # Some of these archs have native 128-bit float support, in
>> +	       # which case this should be passing, even without MPFR support.
>> +	       fail $test
>> +	   } else {
>> +	       unsupported "$test (Missing MPFR support)"
>> +	   }
> 
> ... the istarget check isn't quite right - if we want a check like that,
> it needs to check whether the *host* platform GDB is running on supports
> native 128-bit floats; the istarget check tests the target architecture
> (which will be different when testing a cross-debugging scenario).
> 
> But I'm not sure we really need that check, I'd be fine with just always
> returning unsupported here when GDB is compiled explicitly without MPFR
> support (and the test fails).

Ack, updated patch accordingly and committed as attached.

Thanks,
- Tom


[-- Attachment #2: 0001-gdb-testsuite-Fix-gdb.base-float128.exp-with-with-mpfr-no.patch --]
[-- Type: text/x-patch, Size: 2309 bytes --]

[gdb/testsuite] Fix gdb.base/float128.exp with --with-mpfr=no

When configuring gdb using --with-mpfr=no and running test-case
gdb.base/float128.exp, we run into:
...
FAIL: gdb.base/float128.exp: print large128 (GDB may be missing MPFR support!)
...

Fix this by detecting that gdb was build without mpfr using the show
configuration command, and changing the FAIL into UNSUPPORTED.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-12-10  Tom de Vries  <tdevries@suse.de>

	PR testsuite/26954
	* gdb.base/float128.exp: Detect and handle no mpfr support.

---
 gdb/testsuite/gdb.base/float128.exp | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.base/float128.exp b/gdb/testsuite/gdb.base/float128.exp
index 40babcadc1..6fe479bb94 100644
--- a/gdb/testsuite/gdb.base/float128.exp
+++ b/gdb/testsuite/gdb.base/float128.exp
@@ -74,6 +74,16 @@ gdb_test_multiple "set var f128=20.375l" "$test" {
 gdb_test "print ld" ".* = 10\\.375.*" "the value of ld is changed to 10.375"
 gdb_test "print f128" ".* = 20\\.375.*" "the value of f128 is changed to 20.375"
 
+set mpfr_supported -1
+gdb_test_multiple "show configuration" "" {
+    -wrap -re "--with-mpfr\r\n.*" {
+       set mpfr_supported 1
+    }
+    -wrap -re "--without-mpfr\r\n.*" {
+       set mpfr_supported 0
+    }
+}
+
 # Test that we can correctly handle the largest IEEE-128 value
 # Note: If we get "inf" instead of the correct result, we may have run into
 # an internal overflow.  This typically happens on host platforms without
@@ -84,7 +94,17 @@ gdb_test_multiple "print large128" "$test" {
 	pass "$test"
     }
     -re ".* = inf.*$gdb_prompt $" {
-	fail "$test (GDB may be missing MPFR support!)"
+       if { $mpfr_supported == 0 } {
+	   # If the host platform has native 128-bit float support (as is
+	   # the case for some versions of s390 and powerpc), the
+	   # "print large128" test should be passing, even without MPFR
+	   # support.  So, in those cases we should have fail here rather than
+	   # unsupported.  However, given that we don't have a way to readily
+	   # test for this, we fall back to unsupported.
+	   unsupported "$test (Missing MPFR support)"
+       } else {
+           fail $test
+       }
     }
     -re ".*$gdb_prompt $" {
 	fail "$test"

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-12-11 12:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-10 12:53 [PATCH][gdb/testsuite] Fix gdb.base/float128.exp with --with-mpfr=no Tom de Vries
2020-12-10 13:08 ` Luis Machado
2020-12-11  9:17 ` Ulrich Weigand
2020-12-11 12:56   ` Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).