public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Suppress some FAILs
@ 2023-01-23 22:02 Tom Tromey
  2023-01-23 22:02 ` [PATCH 1/2] Don't let .gdb_history file cause failures Tom Tromey
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Tom Tromey @ 2023-01-23 22:02 UTC (permalink / raw)
  To: gdb-patches

I only see a handful of test failures on my machine.  Some of the
remaining ones are being fixed (e.g., sigterm), some seem to be gdb
bugs (gdb.go), but a couple seemed needless to me.

This series fixes a couple such failures.
Let me know what you think.

Tom



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

* [PATCH 1/2] Don't let .gdb_history file cause failures
  2023-01-23 22:02 [PATCH 0/2] Suppress some FAILs Tom Tromey
@ 2023-01-23 22:02 ` Tom Tromey
  2023-01-23 22:02 ` [PATCH 2/2] Avoid FAILs in gdb.compile Tom Tromey
  2023-02-08 17:18 ` [PATCH 0/2] Suppress some FAILs Tom Tromey
  2 siblings, 0 replies; 5+ messages in thread
From: Tom Tromey @ 2023-01-23 22:02 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

I had a .gdb_history file in my testsuite directory in the build tree,
and this provoked a failure in gdbhistsize-history.exp.  It seems
simple to prevent this file from causing a failure.
---
 gdb/testsuite/gdb.base/gdbhistsize-history.exp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gdb/testsuite/gdb.base/gdbhistsize-history.exp b/gdb/testsuite/gdb.base/gdbhistsize-history.exp
index d3e4a052c6b..f4bf11a10be 100644
--- a/gdb/testsuite/gdb.base/gdbhistsize-history.exp
+++ b/gdb/testsuite/gdb.base/gdbhistsize-history.exp
@@ -39,6 +39,10 @@ proc test_histsize_history_setting { histsize size { env_var "GDBHISTSIZE" } } {
 	unset -nocomplain env(GDBHISTFILE)
 	unset -nocomplain env(GDBHISTSIZE)
 
+	# Ensure we don't accidentally pick up a .gdb_history from the
+	# testsuite directory.
+	set env(GDBHISTFILE) [standard_output_file .gdb_history]
+
 	set env($env_var) $histsize
 
 	with_test_prefix "histsize=$histsize" {
-- 
2.38.1


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

* [PATCH 2/2] Avoid FAILs in gdb.compile
  2023-01-23 22:02 [PATCH 0/2] Suppress some FAILs Tom Tromey
  2023-01-23 22:02 ` [PATCH 1/2] Don't let .gdb_history file cause failures Tom Tromey
@ 2023-01-23 22:02 ` Tom Tromey
  2023-01-24 15:41   ` Alexandra Petlanova Hajkova
  2023-02-08 17:18 ` [PATCH 0/2] Suppress some FAILs Tom Tromey
  2 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2023-01-23 22:02 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

Many gdb.compile C++ tests fail for me on Fedora 36.  I think these
are largely bugs in the plugin, though I didn't investigate too
deeply.  Once one failure is seen, this often cascades and sometimes
there are many timeouts.

For example, this can happen:

    (gdb) compile code var = a->get_var ()
    warning: Could not find symbol "_ZZ9_gdb_exprP10__gdb_regsE1a" for compiled module "/tmp/gdbobj-0xdI6U/out2.o".
    1 symbols were missing, cannot continue.

I think this is probably a plugin bug because, IIRC, in theory these
symbols should be exempt from a lookup via gdb.

This patch arranges to catch any catastrophic failure and then simply
exit the entire .exp file.
---
 gdb/testsuite/gdb.compile/compile-cplus.exp |  4 +-
 gdb/testsuite/lib/compile-support.exp       | 59 ++++++++++++++++++---
 2 files changed, 55 insertions(+), 8 deletions(-)

diff --git a/gdb/testsuite/gdb.compile/compile-cplus.exp b/gdb/testsuite/gdb.compile/compile-cplus.exp
index 0b7cb59727a..1b926844f06 100644
--- a/gdb/testsuite/gdb.compile/compile-cplus.exp
+++ b/gdb/testsuite/gdb.compile/compile-cplus.exp
@@ -113,7 +113,7 @@ gdb_test "compile code *(volatile int *) 0 = 0;" \
     "The program being debugged was signaled while in a function called from GDB\\.\r\nGDB remains in the frame where the signal was received\\.\r\n.*" \
     "compile code segfault first"
 gdb_test "bt" \
-    "\r\n#0  \[^\r\n\]* in _gdb_expr \[^\r\n\]*\r\n#1  <function called from gdb>\r\n.*"
+    "\r\n#0  \[^\r\n\]*_gdb_expr \[^\r\n\]*\r\n#1  <function called from gdb>.*"
 
 set test "p/x \$pc"
 set infcall_pc 0
@@ -242,7 +242,9 @@ gdb_test "print globalvar" " = 20" "print unresolved value"
 
 gdb_test_no_output "compile code globalshadow += 1;"
 gdb_test "print globalshadow" " = 101"
+setup_kfail {no bug filed} *-*-*
 gdb_test_no_output "compile code extern int globalshadow; globalshadow += 5;"
+setup_kfail {fails due to previous test} *-*-*
 gdb_test "print 'compile-cplus.c'::globalshadow" " = 15"
 gdb_test "print globalshadow" " = 101" "print globalshadow second time"
 gdb_test_no_output "compile code staticshadow += 2;"
diff --git a/gdb/testsuite/lib/compile-support.exp b/gdb/testsuite/lib/compile-support.exp
index 64fda8c58a2..a8cf52f1f00 100644
--- a/gdb/testsuite/lib/compile-support.exp
+++ b/gdb/testsuite/lib/compile-support.exp
@@ -41,6 +41,10 @@ proc _do_check_compile {expr} {
 	    # See PR compile/29541.
 	    set result "confused by glibc debuginfo"
 	}
+	-re "$::decimal symbols were missing, cannot continue" {
+	    # This appears to be a bug in the compiler plugin.
+	    set result "apparent compiler plugin bug"
+	}
 	-re "\r\n$gdb_prompt $" {
 	}
     }
@@ -189,17 +193,55 @@ namespace eval ::CompileExpression {
 	    set value $l
 	}
 
+	set ok 1
 	if {!$nocode} {
-	    do_test_ code $exp $result $explicit $name \
-		[list $compile $value $print]
+	    if {![do_test_ code $exp $result $explicit $name \
+		      [list $compile $value $print]]} {
+		set ok 0
+	    }
+	}
+	if {$ok && !$noprint} {
+	    if {![do_test_ print $exp $result $explicit $name \
+		      [list $compile $value $print]]} {
+		set ok 0
+	    }
 	}
-	if {!$noprint} {
-	    do_test_ print $exp $result $explicit $name \
-		[list $compile $value $print]
+	if {!$ok} {
+	    return -code return 0
 	}
     }
 
+    # Invoke a 'compile' command of some form.  COMMAND is the
+    # command, RESULT is the expected output, and NAME is the test
+    # name.  Issues a pass or fail.  Returns 1 on success, 0 if there
+    # is a failure that should result in the entire remaining .exp
+    # being stopped; in this case an 'unsupported' is issued.
+
+    proc compile_command_ {command result name} {
+	global gdb_prompt
+	set this_result 1
+	gdb_test_multiple $command $name {
+	    -re "WARNING .* there are active plugins, do not report this" {
+		# Note that the regexp above does not check for the
+		# prompt.  This avoids a gratuitous timeout.
+		unsupported "GCC compiler plugin crashed"
+		set this_result 0
+	    }
+	    -re "$::decimal symbols were missing, cannot continue" {
+		# This appears to be a bug in the compiler plugin.
+		unsupported "GCC compiler plugin bug"
+		set this_result 0
+	    }
+	    -re -wrap "$result" {
+		pass $name
+	    }
+	}
+	return $this_result
+    }
+
     # Run a compile test for CMD ("print" or "code").
+    # Return 1 on success, 0 if there is some kind of catastrophic
+    # error.
 
     proc do_test_ {cmd exp result is_explicit tst fail_list} {
 	variable varName_
@@ -221,7 +263,7 @@ namespace eval ::CompileExpression {
 	if {[string match $cmd "print"]} {
 	    if {!$is_explicit} {
 		eval setup_failures_ $fail_print
-		gdb_test "compile print $exp" $result $tst
+		return [compile_command_ "compile print $exp" $result $tst]
 	    }
 	} else {
 	    if {$is_explicit} {
@@ -230,10 +272,13 @@ namespace eval ::CompileExpression {
 		set command "compile code $varName_ = $exp"
 	    }
 	    eval setup_failures_ $fail_compile
-	    gdb_test_no_output $command $tst
+	    if {![compile_command_ $command "" $tst]} {
+		return 0
+	    }
 	    eval setup_failures_ $fail_value
 	    gdb_test "p $varName_" "= $result" "result of $tst"
 	}
+	return 1
     }
 
     # A convenience proc used to set up xfail and kfail tests.
-- 
2.38.1


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

* Re: [PATCH 2/2] Avoid FAILs in gdb.compile
  2023-01-23 22:02 ` [PATCH 2/2] Avoid FAILs in gdb.compile Tom Tromey
@ 2023-01-24 15:41   ` Alexandra Petlanova Hajkova
  0 siblings, 0 replies; 5+ messages in thread
From: Alexandra Petlanova Hajkova @ 2023-01-24 15:41 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

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

On Mon, Jan 23, 2023 at 11:03 PM Tom Tromey via Gdb-patches <
gdb-patches@sourceware.org> wrote:

> Many gdb.compile C++ tests fail for me on Fedora 36.  I think these
> are largely bugs in the plugin, though I didn't investigate too
> deeply.  Once one failure is seen, this often cascades and sometimes
> there are many timeouts.
>
> For example, this can happen:
>
>     (gdb) compile code var = a->get_var ()
>     warning: Could not find symbol "_ZZ9_gdb_exprP10__gdb_regsE1a" for
> compiled module "/tmp/gdbobj-0xdI6U/out2.o".
>     1 symbols were missing, cannot continue.
>
> I think this is probably a plugin bug because, IIRC, in theory these
> symbols should be exempt from a lookup via gdb.
>
> This patch arranges to catch any catastrophic failure and then simply
> exit the entire .exp file.
>
>
I think it's great, running make check looks better with this for sure
(tried on Fedora 36)
< # of expected passes 119003
< # of unexpected failures 6
---
> # of expected passes 119023
> # of unexpected failures 43

I like how you handle unknown _ZZ9_gdb_exprP10__gdb_regsE1a symbol with
UNSUPPORTED.
gdb) compile code var = a->get_var ()
warning: Could not find symbol "_ZZ9_gdb_exprP10__gdb_regsE1a" for compiled
module "/tmp/gdbobj-Fa9HOp/out2.o".
1 symbols were missing, cannot continue.
(gdb) UNSUPPORTED: gdb.compile/compile-cplus-method.exp: GCC compiler
plugin bug
testcase
/home/ahajkova/build/gdb/gdb/testsuite/../../../../binutils-gdb/gdb/testsuite/gdb.compile/compile-cplus-method.exp
completed in 1 seconds
Running
/home/ahajkova/build/gdb/gdb/testsuite/../../../../binutils-gdb/gdb/testsuite/gdb.compile/compile-cplus-namespace.exp
...

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

* Re: [PATCH 0/2] Suppress some FAILs
  2023-01-23 22:02 [PATCH 0/2] Suppress some FAILs Tom Tromey
  2023-01-23 22:02 ` [PATCH 1/2] Don't let .gdb_history file cause failures Tom Tromey
  2023-01-23 22:02 ` [PATCH 2/2] Avoid FAILs in gdb.compile Tom Tromey
@ 2023-02-08 17:18 ` Tom Tromey
  2 siblings, 0 replies; 5+ messages in thread
From: Tom Tromey @ 2023-02-08 17:18 UTC (permalink / raw)
  To: Tom Tromey via Gdb-patches; +Cc: Tom Tromey

>>>>> "Tom" == Tom Tromey via Gdb-patches <gdb-patches@sourceware.org> writes:

Tom> I only see a handful of test failures on my machine.  Some of the
Tom> remaining ones are being fixed (e.g., sigterm), some seem to be gdb
Tom> bugs (gdb.go), but a couple seemed needless to me.

Tom> This series fixes a couple such failures.
Tom> Let me know what you think.

I'm checking these in now.

Tom

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

end of thread, other threads:[~2023-02-08 17:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-23 22:02 [PATCH 0/2] Suppress some FAILs Tom Tromey
2023-01-23 22:02 ` [PATCH 1/2] Don't let .gdb_history file cause failures Tom Tromey
2023-01-23 22:02 ` [PATCH 2/2] Avoid FAILs in gdb.compile Tom Tromey
2023-01-24 15:41   ` Alexandra Petlanova Hajkova
2023-02-08 17:18 ` [PATCH 0/2] Suppress some FAILs Tom Tromey

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).