[3/4] testsuite: Disable tests when logging
Commit Message
Fix up all failures encountered when running the testsuite with
GDB_DEBUG="infrun".
Some tests rely on enabling debugging for various components. With
debugging on, this will be lost to the debug file.
Some tests rely on output which is being sent to the debug stream.
It could be argued this output should instead go to stderr.
disasm.c should send errors to the stderr instead of the logfile.
Note that enabling debug for other components might still cause
additional errors above what has been fixed here.
gdb/ChangeLog:
2019-04-23 Alan Hayward <alan.hayward@arm.com>
* disasm.c (set_disassembler_options): Send errors to stderr.
gdb/testsuite/ChangeLog:
2019-04-23 Alan Hayward <alan.hayward@arm.com>
* gdb.base/breakpoint-in-ro-region.exp: Disable when debugging.
* gdb.base/debug-expr.exp: Likewise.
* gdb.base/foll-fork.exp: Likewise.
* gdb.base/foll-vfork.exp: Likewise.
* gdb.base/fork-print-inferior-events.exp: Likewise.
* gdb.base/gdb-sigterm.exp: Likewise.
* gdb.base/gdbinit-history.exp: Likewise.
* gdb.base/osabi.exp: Likewise.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
* gdb.base/ui-redirect.exp: Likewise.
* gdb.gdb/unittest.exp: Likewise.
* gdb.mi/mi-break.exp: Likewise.
* gdb.python/python.exp: Likewise.
* gdb.threads/check-libthread-db.exp: Likewise.
* gdb.threads/signal-while-stepping-over-bp-other-thread.exp: Likewise.
* gdb.threads/stepi-random-signal.exp: Likewise.
---
gdb/disasm.c | 4 ++--
gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp | 5 +++++
gdb/testsuite/gdb.base/debug-expr.exp | 5 +++++
gdb/testsuite/gdb.base/foll-fork.exp | 5 +++++
gdb/testsuite/gdb.base/foll-vfork.exp | 5 +++++
gdb/testsuite/gdb.base/fork-print-inferior-events.exp | 5 +++++
gdb/testsuite/gdb.base/gdb-sigterm.exp | 5 +++++
gdb/testsuite/gdb.base/gdbinit-history.exp | 5 +++++
gdb/testsuite/gdb.base/osabi.exp | 5 +++++
gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.exp | 5 +++++
gdb/testsuite/gdb.base/ui-redirect.exp | 5 +++++
gdb/testsuite/gdb.gdb/unittest.exp | 5 +++++
gdb/testsuite/gdb.mi/mi-break.exp | 8 +++++++-
gdb/testsuite/gdb.python/python.exp | 5 ++++-
gdb/testsuite/gdb.threads/check-libthread-db.exp | 5 +++++
.../signal-while-stepping-over-bp-other-thread.exp | 5 +++++
gdb/testsuite/gdb.threads/stepi-random-signal.exp | 5 +++++
17 files changed, 83 insertions(+), 4 deletions(-)
--
2.20.1 (Apple Git-117)
Comments
>>>>> "Alan" == Alan Hayward <Alan.Hayward@arm.com> writes:
Alan> * gdb.base/breakpoint-in-ro-region.exp: Disable when debugging.
[...]
My first reaction to this was negative, but after thinking about it a
little I came around. I think my view is that enabling debug logging
for the test suite is primarily a debugging tool, and so it's fine --
especially for tests that are already enabling debugging -- for it not
to work universally.
Alan> +# Do not run if gdb debug is enabled
Normally comments should have a "." at the end.
It would perhaps be good if the comments explained why.
Alan> +# Do not run if gdb debug is enabled - it interferes with the command history.
... like this one. Is that reasonable?
thanks,
Tom
> On 25 Apr 2019, at 15:36, Tom Tromey <tom@tromey.com> wrote:
>
>>>>>> "Alan" == Alan Hayward <Alan.Hayward@arm.com> writes:
>
> Alan> * gdb.base/breakpoint-in-ro-region.exp: Disable when debugging.
> [...]
>
> My first reaction to this was negative, but after thinking about it a
> little I came around. I think my view is that enabling debug logging
> for the test suite is primarily a debugging tool, and so it's fine --
> especially for tests that are already enabling debugging -- for it not
> to work universally.
I went through the same thought process.
If someone really cares about running with debug for a particular test,
then it should be easy enough to change the test to only skip the part
where debug messages are checked. I didn’t think it was worth all the
work to do that to all of them now.
>
> Alan> +# Do not run if gdb debug is enabled
>
> Normally comments should have a "." at the end.
> It would perhaps be good if the comments explained why.
>
> Alan> +# Do not run if gdb debug is enabled - it interferes with the command history.
>
> ... like this one. Is that reasonable?
>
Will do.
> thanks,
> Tom
@@ -943,7 +943,7 @@ set_disassembler_options (char *prospective_options)
valid_options_and_args = gdbarch_valid_disassembler_options (gdbarch);
if (valid_options_and_args == NULL)
{
- fprintf_filtered (gdb_stdlog, _("\
+ fprintf_filtered (gdb_stderr, _("\
'set disassembler-options ...' is not supported on this architecture.\n"));
return;
}
@@ -979,7 +979,7 @@ set_disassembler_options (char *prospective_options)
break;
if (valid_options->name[i] == NULL)
{
- fprintf_filtered (gdb_stdlog,
+ fprintf_filtered (gdb_stderr,
_("Invalid disassembler option value: '%s'.\n"),
opt);
return;
@@ -15,6 +15,11 @@
# This file is part of the gdb testsuite
+# Do not run if gdb debug is enabled
+if [gdb_debug_enabled] {
+ continue
+}
+
standard_testfile
if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
@@ -15,6 +15,11 @@
# Test "set debug expr 1" on c expressions.
+# Do not run if gdb debug is enabled
+if [gdb_debug_enabled] {
+ return 0
+}
+
standard_testfile .c
if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug}]} {
@@ -20,6 +20,11 @@ if { ![istarget "*-*-linux*"] && ![istarget "*-*-openbsd*"] } then {
continue
}
+# Do not run if gdb debug is enabled
+if [gdb_debug_enabled] {
+ continue
+}
+
standard_testfile
if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
@@ -25,6 +25,11 @@ if {![istarget "*-linux*"]} then {
continue
}
+# Do not run if gdb debug is enabled
+if [gdb_debug_enabled] {
+ continue
+}
+
standard_testfile
set compile_options debug
@@ -25,6 +25,11 @@ if { [use_gdb_stub] } {
return
}
+# Do not run if gdb debug is enabled
+if [gdb_debug_enabled] {
+ continue
+}
+
standard_testfile
if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } {
@@ -15,6 +15,11 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# Do not run if gdb debug is enabled
+if [gdb_debug_enabled] {
+ continue
+}
+
standard_testfile
# The test program exits after a while, in case GDB crashes. Make it
@@ -21,6 +21,11 @@
# We cannot expect remote hosts to see environment variables set on the
# local machine.
+# Do not run if gdb debug is enabled - it interferes with the command history.
+if [gdb_debug_enabled] {
+ continue
+}
+
if { [is_remote host] } {
unsupported "can't set environment variables on remote host"
return -1
@@ -15,6 +15,11 @@
# This file is part of the gdb testsuite.
+# Do not run if gdb debug is enabled.
+if [gdb_debug_enabled] {
+ continue
+}
+
# Test that choosing "set osabi none" really requests a gdbarch with no osabi.
proc test_set_osabi_none { } {
@@ -31,6 +31,11 @@
# 4 - The single-step finishes, and GDB removes the single-step
# breakpoint.
+# Do not run if gdb debug is enabled
+if [gdb_debug_enabled] {
+ continue
+}
+
standard_testfile
if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
@@ -13,6 +13,11 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# Do not run if gdb debug is enabled
+if [gdb_debug_enabled] {
+ return 0
+}
+
if { [prepare_for_testing "failed to prepare" ui-redirect start.c] } {
return -1
}
@@ -13,6 +13,11 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# Do not run if gdb debug is enabled
+if [gdb_debug_enabled] {
+ continue
+}
+
set do_xml_test [expr ![gdb_skip_xml_test]]
gdb_start
@@ -429,6 +429,12 @@ proc test_break {mi_mode} {
test_explicit_breakpoints
}
-foreach_with_prefix mi-mode {"main" "separate"} {
+if [gdb_debug_enabled] {
+ set modes {"main"}
+} else {
+ set modes {"main" "separate"}
+}
+
+foreach_with_prefix mi-mode $modes {
test_break ${mi-mode}
}
@@ -293,7 +293,10 @@ gdb_test "python print (sys.stdout)" ".*gdb.GdbOutputFile (instance|object) at.*
gdb_test "python gdb.write(\"Foo\\n\")" "Foo" "test default write"
gdb_test "python gdb.write(\"Error stream\\n\", stream=gdb.STDERR)" "Error stream" "test stderr write"
gdb_test "python gdb.write(\"Normal stream\\n\", stream=gdb.STDOUT)" "Normal stream" "test stdout write"
-gdb_test "python gdb.write(\"Log stream\\n\", stream=gdb.STDLOG)" "Log stream" "test stdlog write"
+
+if ![gdb_debug_enabled] {
+ gdb_test "python gdb.write(\"Log stream\\n\", stream=gdb.STDLOG)" "Log stream" "test stdlog write"
+}
# Turn on full stack printing for subsequent tests.
gdb_py_test_silent_cmd "set python print-stack full" \
@@ -18,6 +18,11 @@ if {[target_info gdb_protocol] != "" || ![istarget *-linux*]} {
continue
}
+# Do not run if gdb debug is enabled
+if [gdb_debug_enabled] {
+ continue
+}
+
standard_testfile
if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
@@ -18,6 +18,11 @@
# stop, when the thread that hit that breakpoint is not the stepped
# thread.
+# Do not run if gdb debug is enabled
+if [gdb_debug_enabled] {
+ continue
+}
+
standard_testfile
set executable ${testfile}
@@ -13,6 +13,11 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# Do not run if gdb debug is enabled
+if [gdb_debug_enabled] {
+ continue
+}
+
standard_testfile
set executable ${testfile}