diff mbox

[4/9] testsuite: Disable some tests when logging

Message ID 51A09969-A894-40F5-A016-18BFD3188EE7@arm.com
State New
Headers show

Commit Message

Alan Hayward May 17, 2019, 2:36 p.m. UTC
> On 16 May 2019, at 20:19, Tom Tromey <tom@tromey.com> wrote:

> 

>>>>>> "Alan" == Alan Hayward <Alan.Hayward@arm.com> writes:

> 

> Alan> Fix up all failures encountered when running the testsuite with

> Alan> GDB_DEBUG="infrun".

> 

> Alan> Some tests rely on enabling debugging for various components.  With

> Alan> debugging on, this will be lost to the debug file.

> 

> Alan> Disable separate tty for mi tests when debugging.  This currently

> Alan> does not work.

> 

> Alan> disasm.c should send errors to the stderr instead of the logfile.

> 

> I wonder if it should error(), but this isn't something you need to

> worry about for this patch.


Sounds reasonable.

> 

> Alan> +# Test relies on checking gdb debug ouput. Do not run if gdb debug is

> 

> All these patches have the "ouput" typo, should be "output”.


Doh! Fixed.

> 

> Alan> +if [gdb_debug_enabled] {

> Alan> +    continue

> 

> I think these early returns should call "untested", see:

> 

> https://sourceware.org/gdb/wiki/GDBTestcaseCookbook#A.22untested.22_calls

> 


Makes sense. Fixed these all up to be:

if [gdb_debug_enabled] {
    untested "debug is enabled"
    return 0
}


Pushed with the above changes:
diff mbox

Patch

diff --git a/gdb/disasm.c b/gdb/disasm.c
index 7c7a148935..ed740c26e0 100644
--- a/gdb/disasm.c
+++ b/gdb/disasm.c
@@ -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;
diff --git a/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp b/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp
index 8655f54e03..9099df0a08 100644
--- a/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp
+++ b/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp
@@ -15,6 +15,13 @@ 

 # This file is part of the gdb testsuite

+# Test relies on checking gdb debug output. Do not run if gdb debug is
+# enabled as any debug will be redirected to the log.
+if [gdb_debug_enabled] {
+    untested "debug is enabled"
+    return 0
+}
+
 standard_testfile

 if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
diff --git a/gdb/testsuite/gdb.base/debug-expr.exp b/gdb/testsuite/gdb.base/debug-expr.exp
index 8885ec6b9b..6da591b9ca 100644
--- a/gdb/testsuite/gdb.base/debug-expr.exp
+++ b/gdb/testsuite/gdb.base/debug-expr.exp
@@ -15,6 +15,13 @@ 

 # Test "set debug expr 1" on c expressions.

+# Test relies on checking gdb debug output. Do not run if gdb debug is
+# enabled as any debug will be redirected to the log.
+if [gdb_debug_enabled] {
+    untested "debug is enabled"
+    return 0
+}
+
 standard_testfile .c

 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug}]} {
diff --git a/gdb/testsuite/gdb.base/foll-fork.exp b/gdb/testsuite/gdb.base/foll-fork.exp
index 8884686928..9f27c4c962 100644
--- a/gdb/testsuite/gdb.base/foll-fork.exp
+++ b/gdb/testsuite/gdb.base/foll-fork.exp
@@ -20,6 +20,13 @@  if { ![istarget "*-*-linux*"] && ![istarget "*-*-openbsd*"] } then {
     continue
 }

+# Test relies on checking follow-fork output. Do not run if gdb debug is
+# enabled as it will be redirected to the log.
+if [gdb_debug_enabled] {
+    untested "debug is enabled"
+    return 0
+}
+
 standard_testfile

 if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
diff --git a/gdb/testsuite/gdb.base/foll-vfork.exp b/gdb/testsuite/gdb.base/foll-vfork.exp
index 96d8539bee..7bfebb2a91 100644
--- a/gdb/testsuite/gdb.base/foll-vfork.exp
+++ b/gdb/testsuite/gdb.base/foll-vfork.exp
@@ -25,6 +25,13 @@  if {![istarget "*-linux*"]} then {
     continue
 }

+# Test relies on checking follow-fork output. Do not run if gdb debug is
+# enabled as it will be redirected to the log.
+if [gdb_debug_enabled] {
+    untested "debug is enabled"
+    return 0
+}
+
 standard_testfile

 set compile_options debug
diff --git a/gdb/testsuite/gdb.base/fork-print-inferior-events.exp b/gdb/testsuite/gdb.base/fork-print-inferior-events.exp
index 1c5a470bd6..2befdd8ede 100644
--- a/gdb/testsuite/gdb.base/fork-print-inferior-events.exp
+++ b/gdb/testsuite/gdb.base/fork-print-inferior-events.exp
@@ -25,6 +25,13 @@  if { [use_gdb_stub] } {
     return
 }

+# Test relies on checking follow-fork output. Do not run if gdb debug is
+# enabled as it will be redirected to the log.
+if [gdb_debug_enabled] {
+    untested "debug is enabled"
+    return 0
+}
+
 standard_testfile

 if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } {
diff --git a/gdb/testsuite/gdb.base/gdb-sigterm.exp b/gdb/testsuite/gdb.base/gdb-sigterm.exp
index 36d24fcc56..f0a26c6085 100644
--- a/gdb/testsuite/gdb.base/gdb-sigterm.exp
+++ b/gdb/testsuite/gdb.base/gdb-sigterm.exp
@@ -15,6 +15,13 @@ 
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.

+# Test relies on checking gdb debug output. Do not run if gdb debug is
+# enabled as any debug will be redirected to the log.
+if [gdb_debug_enabled] {
+    untested "debug is enabled"
+    return 0
+}
+
 standard_testfile

 # The test program exits after a while, in case GDB crashes.  Make it
diff --git a/gdb/testsuite/gdb.base/gdbinit-history.exp b/gdb/testsuite/gdb.base/gdbinit-history.exp
index f4f0686ccc..b45e7116d9 100644
--- a/gdb/testsuite/gdb.base/gdbinit-history.exp
+++ b/gdb/testsuite/gdb.base/gdbinit-history.exp
@@ -21,6 +21,12 @@ 
 # 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] {
+    untested "debug is enabled"
+    return 0
+}
+
 if { [is_remote host] } {
     unsupported "can't set environment variables on remote host"
     return -1
diff --git a/gdb/testsuite/gdb.base/osabi.exp b/gdb/testsuite/gdb.base/osabi.exp
index 50146311f7..f4418cac65 100644
--- a/gdb/testsuite/gdb.base/osabi.exp
+++ b/gdb/testsuite/gdb.base/osabi.exp
@@ -15,6 +15,13 @@ 

 # This file is part of the gdb testsuite.

+# Test relies on checking gdb debug output. Do not run if gdb debug is
+# enabled as any debug will be redirected to the log.
+if [gdb_debug_enabled] {
+    untested "debug is enabled"
+    return 0
+}
+
 # Test that choosing "set osabi none" really requests a gdbarch with no osabi.

 proc test_set_osabi_none { } {
diff --git a/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.exp b/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.exp
index 898233afa4..d25ad794cb 100644
--- a/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.exp
+++ b/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.exp
@@ -31,6 +31,13 @@ 
 # 4 - The single-step finishes, and GDB removes the single-step
 #     breakpoint.

+# Test relies on checking gdb debug output. Do not run if gdb debug is
+# enabled as any debug will be redirected to the log.
+if [gdb_debug_enabled] {
+    untested "debug is enabled"
+    return 0
+}
+
 standard_testfile

 if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
diff --git a/gdb/testsuite/gdb.base/ui-redirect.exp b/gdb/testsuite/gdb.base/ui-redirect.exp
index e62d5e8341..4507ac51a2 100644
--- a/gdb/testsuite/gdb.base/ui-redirect.exp
+++ b/gdb/testsuite/gdb.base/ui-redirect.exp
@@ -13,6 +13,12 @@ 
 # 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 as it will interfere with log redirect.
+if [gdb_debug_enabled] {
+    untested "debug is enabled"
+    return 0
+}
+
 if { [prepare_for_testing "failed to prepare" ui-redirect start.c] } {
     return -1
 }
diff --git a/gdb/testsuite/gdb.gdb/unittest.exp b/gdb/testsuite/gdb.gdb/unittest.exp
index 09c603059f..e6ec628049 100644
--- a/gdb/testsuite/gdb.gdb/unittest.exp
+++ b/gdb/testsuite/gdb.gdb/unittest.exp
@@ -13,6 +13,13 @@ 
 # 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 as maintenance output will be
+# redirected to the log files.
+if [gdb_debug_enabled] {
+    untested "debug is enabled"
+    return 0
+}
+
 set do_xml_test [expr ![gdb_skip_xml_test]]

 gdb_start
diff --git a/gdb/testsuite/gdb.mi/mi-break.exp b/gdb/testsuite/gdb.mi/mi-break.exp
index 365e4faa81..c517ce886f 100644
--- a/gdb/testsuite/gdb.mi/mi-break.exp
+++ b/gdb/testsuite/gdb.mi/mi-break.exp
@@ -429,6 +429,13 @@  proc test_break {mi_mode} {
     test_explicit_breakpoints
 }

-foreach_with_prefix mi-mode {"main" "separate"} {
+if [gdb_debug_enabled] {
+  # gdb debug doesn't work for separate-mi-tty.
+  set modes {"main"}
+} else {
+  set modes {"main" "separate"}
+}
+
+foreach_with_prefix mi-mode $modes {
     test_break ${mi-mode}
 }
diff --git a/gdb/testsuite/gdb.mi/mi-watch.exp b/gdb/testsuite/gdb.mi/mi-watch.exp
index e7c59c8fb7..23cc178d71 100644
--- a/gdb/testsuite/gdb.mi/mi-watch.exp
+++ b/gdb/testsuite/gdb.mi/mi-watch.exp
@@ -174,9 +174,16 @@  proc test_watchpoint_all {mi_mode type} {
     test_watchpoint_triggering
 }

+if [gdb_debug_enabled] {
+  # gdb debug doesn't work for separate-mi-tty.
+  set modes {"main"}
+} else {
+  set modes {"main" "separate"}
+}
+
 # Run the tests twice, once using software watchpoints, and another
 # with hardware watchpoints.
-foreach_with_prefix mi-mode {"main" "separate"} {
+foreach_with_prefix mi-mode $modes {
     foreach_with_prefix wp-type {"sw" "hw"} {
        test_watchpoint_all ${mi-mode} ${wp-type}
     }
diff --git a/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp b/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp
index c9de792e28..5560a8be96 100644
--- a/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp
+++ b/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp
@@ -20,6 +20,12 @@ 
 # commands, MI should not process further commands until the inferior
 # stops again.  See PR gdb/20418.

+# Do not run if gdb debug is enabled as it doesn't work for separate-mi-tty.
+if [gdb_debug_enabled] {
+    untested "debug is enabled"
+    return 0
+}
+
 load_lib mi-support.exp

 standard_testfile
diff --git a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
index 989bc56d35..621b4c5163 100644
--- a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
+++ b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
@@ -29,6 +29,12 @@ 
 # - Thread 3 of each inferior is either stopped at /* thread loop line */, if we
 #   are using all-stop, or running, if we are using non-stop.

+# Do not run if gdb debug is enabled as it doesn't work for separate-mi-tty.
+if [gdb_debug_enabled] {
+    untested "debug is enabled"
+    return 0
+}
+
 load_lib mi-support.exp

 standard_testfile
diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp
index b62572ceb8..3b5d1a462c 100644
--- a/gdb/testsuite/gdb.python/python.exp
+++ b/gdb/testsuite/gdb.python/python.exp
@@ -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" \
diff --git a/gdb/testsuite/gdb.threads/check-libthread-db.exp b/gdb/testsuite/gdb.threads/check-libthread-db.exp
index b569079f46..6baa4910d3 100644
--- a/gdb/testsuite/gdb.threads/check-libthread-db.exp
+++ b/gdb/testsuite/gdb.threads/check-libthread-db.exp
@@ -18,6 +18,13 @@  if {[target_info gdb_protocol] != "" || ![istarget *-linux*]} {
     continue
 }

+# Test relies on checking gdb debug output. Do not run if gdb debug is
+# enabled as any debug will be redirected to the log.
+if [gdb_debug_enabled] {
+    untested "debug is enabled"
+    return 0
+}
+
 standard_testfile

 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
diff --git a/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp b/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp
index 7043a7a9f9..9fb3762934 100644
--- a/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp
+++ b/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp
@@ -18,6 +18,12 @@ 
 # stop, when the thread that hit that breakpoint is not the stepped
 # thread.

+# Test relies on checking gdb debug output. Do not run if gdb debug is
+# enabled as any debug will be redirected to the log.
+if [gdb_debug_enabled] {
+    continue
+}
+
 standard_testfile
 set executable ${testfile}

diff --git a/gdb/testsuite/gdb.threads/stepi-random-signal.exp b/gdb/testsuite/gdb.threads/stepi-random-signal.exp
index ce93bed501..fd593c38e4 100644
--- a/gdb/testsuite/gdb.threads/stepi-random-signal.exp
+++ b/gdb/testsuite/gdb.threads/stepi-random-signal.exp
@@ -13,6 +13,13 @@ 
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.

+# Test relies on checking gdb debug output. Do not run if gdb debug is
+# enabled as any debug will be redirected to the log.
+if [gdb_debug_enabled] {
+    untested "debug is enabled"
+    return 0
+}
+
 standard_testfile
 set executable ${testfile}