summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2001-10-26 06:00:07 +0000
committerKeith Seitz <keiths@redhat.com>2001-10-26 06:00:07 +0000
commita3724e24c5f0857f59482b420fe46b3c2e6f4062 (patch)
treeaf2cf6dab324184b10a6db106af55baf25b38261
parentb2582baab0ea1a84052e13b8e1543d816788a4a7 (diff)
downloadgdb-a3724e24c5f0857f59482b420fe46b3c2e6f4062.tar.gz
* defs (_report_error): Fix typo.
(show_warning): Redefine the standard warning handler so that we don't end up stalling tests with a warning dialog. * windows.exp: New file. * windows.test: New file.
-rw-r--r--gdb/testsuite/gdb.gdbtk/ChangeLog9
-rw-r--r--gdb/testsuite/gdb.gdbtk/defs14
-rw-r--r--gdb/testsuite/gdb.gdbtk/windows.exp41
-rw-r--r--gdb/testsuite/gdb.gdbtk/windows.test131
4 files changed, 194 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.gdbtk/ChangeLog b/gdb/testsuite/gdb.gdbtk/ChangeLog
index 963d71d5896..9a7a8e9c678 100644
--- a/gdb/testsuite/gdb.gdbtk/ChangeLog
+++ b/gdb/testsuite/gdb.gdbtk/ChangeLog
@@ -1,3 +1,12 @@
+2001-10-25 Keith Seitz <keiths@redhat.com>
+
+ * defs (_report_error): Fix typo.
+ (show_warning): Redefine the standard warning handler
+ so that we don't end up stalling tests with a warning dialog.
+
+ * windows.exp: New file.
+ * windows.test: New file.
+
2001-10-08 Keith Seitz <keiths@redhat.com>
* c_variable.test (check_update): Forget about returning
diff --git a/gdb/testsuite/gdb.gdbtk/defs b/gdb/testsuite/gdb.gdbtk/defs
index 6b0c9cd084f..0999732c012 100644
--- a/gdb/testsuite/gdb.gdbtk/defs
+++ b/gdb/testsuite/gdb.gdbtk/defs
@@ -122,7 +122,7 @@ proc gdbtk_test_run {{prog_args {}}} {
proc _report_error {msg} {
global _test
- if {[info exists _tesst(interactive)] && $_test(interactive)} {
+ if {[info exists _test(interactive)] && $_test(interactive)} {
# Dialog
tk_messageBox -message $msg -icon error -type ok
} else {
@@ -292,3 +292,15 @@ proc gdbtk_test_error {desc} {
puts "ERROR \{$desc\} \{\} \{\}"
gdbtk_test_done
}
+
+# Override the warning dialog. We don't want to see them.
+rename show_warning real_show_warning
+proc show_warning {msg} {
+ global _test
+
+ set str "INSIGHT TESTSUITE WARNING: $msg"
+ puts stdout $str
+ if {$_test(logfile) != ""} {
+ puts $_test(logfile) $str
+ }
+}
diff --git a/gdb/testsuite/gdb.gdbtk/windows.exp b/gdb/testsuite/gdb.gdbtk/windows.exp
new file mode 100644
index 00000000000..94b09a4d863
--- /dev/null
+++ b/gdb/testsuite/gdb.gdbtk/windows.exp
@@ -0,0 +1,41 @@
+# Copyright 2001 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License (GPL) as published by
+# the Free Software Foundation; either version 2 of the License, or (at
+# your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+load_lib insight-support.exp
+
+if {[gdbtk_initialize_display]} {
+ if {$tracelevel} {
+ strace $tracelevel
+ }
+
+ #
+ # Basic window tests (basic as in, "do they open")
+ #
+ set prms_id 0
+ set bug_id 0
+
+ set srcfile [file join $srcdir $subdir c_variable.c]
+ set binfile [file join $objdir $subdir c_variable]
+ set r [gdb_compile $srcfile $binfile executable {debug}]
+ if { $r != "" } {
+ gdb_suppress_entire_file \
+ "Testcase compile failed, so some tests in this file will automatically fail."
+ }
+
+ # Start with a fresh gdbtk
+ gdb_exit
+ set results [gdbtk_start [file join $srcdir $subdir windows.test]]
+ set results [split $results \n]
+
+ # Analyze results
+ gdbtk_done $results
+}
diff --git a/gdb/testsuite/gdb.gdbtk/windows.test b/gdb/testsuite/gdb.gdbtk/windows.test
new file mode 100644
index 00000000000..ebb4b3e9c12
--- /dev/null
+++ b/gdb/testsuite/gdb.gdbtk/windows.test
@@ -0,0 +1,131 @@
+# Basic window tests
+# Copyright 2001 Red Hat, Inc.
+#
+# This Program Is Free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu
+
+# This file was written by Keith Seitz (keiths@cygnus.com)
+
+# Read in the standard defs file
+if {![gdbtk_read_defs]} {
+ break
+}
+
+global objdir test_ran
+
+# Windows to test
+# FIXME: TfindArgs needs to be updated before it can go in the list...
+set windows [list BpWin BrowserWin Console DebugWin HtmlViewer KodWin LocalsWin \
+ MemWin ProcessWin RegWin StackWin TdumpWin WatchWin]
+
+# Dialogs to test
+# FIXME: ActionhDlg,TraceDlg cannot be independently opened
+set dialogs [list About AttachDlg GlobalPref SrcPref TargetSelection]
+
+# Helper proc to do all the testing
+proc do_open_close {num winlist} {
+ set i 1
+ foreach win $winlist {
+
+ # Test: windows-$num.*
+ # Desc: Open each window before running
+ set win_obj ""
+ gdbtk_test windows-$num.$i "open $win before running" {
+ set err [catch {ManagedWin::open $win} txt]
+ if {$err} {
+ # display error
+ set txt
+ } else {
+ # display "0"
+ set win_obj $txt
+ set err
+ }
+ } {0}
+
+ # Update screen
+ update idletasks
+
+ # Test: windows-{$num+1}.*
+ # Desc: Close each window before running
+ gdbtk_test windows-[expr {$num+1}].$i "close $win before running" {
+ set err [catch {delete object $win_obj} txt]
+ if {$err} {
+ # display error
+ set txt
+ } else {
+ # display "0"
+ set err
+ }
+ } {0}
+
+ # Update screen
+ update idletasks
+ incr i
+ }
+}
+
+#
+# Tests start here
+#
+
+# Counter for tests. Increment by 2 after each call to do_open_close.
+set num 1
+
+#
+# Check if all windows open with no file loaded
+#
+do_open_close $num $windows
+incr num 2
+
+# Sadly, there is no good way to unpost dialogs (except for setting
+# an after callback). Until something better comes along, skip them.
+# do_open_close $num $dialogs
+# incr num 2
+
+#
+# Check if all windows open with file loaded
+#
+
+# Load in a file
+set program [file join $objdir c_variable]
+if {[catch {gdbtk_test_file $program} t]} {
+ # This isn't a test case, since if this fails, we're hosed.
+ gdbtk_test_error "loading \"$program\": $t"
+}
+
+do_open_close $num $windows
+incr num 2
+#do_open_close $num $dialogs
+incr num 2
+
+#
+# Check if all windows open after running
+#
+
+# Break in main and run
+gdb_cmd "break main"
+gdbtk_test_run
+
+do_open_close $num $windows
+incr num 2
+#do_open_close $num $dialogs
+#incr num 2
+
+#
+# Exit
+#
+gdbtk_test_done