OSDN Git Service

* README: New file.
authorKeith Seitz <keiths@redhat.com>
Mon, 7 May 2001 20:39:32 +0000 (20:39 +0000)
committerKeith Seitz <keiths@redhat.com>
Mon, 7 May 2001 20:39:32 +0000 (20:39 +0000)
        * configure.in: Check for executable filename extension.
        * Makefile.in: Add filename extensions.
        * configure: Regenerated.

        * defs: Fix typo setting _test(verbose).
        (gdbtk_test_file): New proc to load executables into gdbtk.
        (gdbtk_test_run): New proc to run executables on gdbtk.
        * browser.exp: Don't check if DISPLAY is set: let
        gdbtk_initialize_display do it all for us.
        Call gdbtk_done when finished with tests.
        * c_variable.exp: Ditto.
        * console.exp: Ditto.
        * cpp_variable.exp: Ditto.
        Only run tests if c++ is supported in the configuration.
        * srcwin.exp: Ditto the DISPLAY stuff.
        Accumulate all test results for the end and report them then.

        * browser.test: Use gdbtk_test_file and gdbtk_test_run
        to load and run an executable.
        * c_variable.test: Use gdbtk_test_file and gdbtk_test_run
        to load and run an executable.
        * srcwin.test: Ditto.
        * srcwin1.test: Ditto.
        * srcwin2.test: Ditto.
        * browser.test: (set_search_mode): Use "configure
        -value" not "entryset" to set the combobox's value. We need
        to have the command fired.
        (browser-3.5): Remove trailing whitespace which causes test to
        fail.
        (browser-4.4): Expect something rational. Regexp "\_1$" cannot
        match "func_10"!
        (browser-4.5): Ditto.
        (browser-5.12): Select all files for search to make test
        match description.
        (browser-6.2): Renamed from another test also calledd 6.1.
        (browser-7.1): Delete all breakpoints at once without from_tty.
        Select all entries in the comobox before invoking BP set/delete
        button.
        (browser-7.2): Ditto.

        * list0.c, list1.c, list0.h: New files. Grabbed from gdb.base.
        * srcwin.exp: Use these local files instead of those in gdb.base.

21 files changed:
gdb/testsuite/gdb.gdbtk/ChangeLog
gdb/testsuite/gdb.gdbtk/Makefile.in
gdb/testsuite/gdb.gdbtk/README [new file with mode: 0644]
gdb/testsuite/gdb.gdbtk/browser.exp
gdb/testsuite/gdb.gdbtk/browser.test
gdb/testsuite/gdb.gdbtk/c_variable.exp
gdb/testsuite/gdb.gdbtk/c_variable.test
gdb/testsuite/gdb.gdbtk/configure
gdb/testsuite/gdb.gdbtk/configure.in
gdb/testsuite/gdb.gdbtk/console.exp
gdb/testsuite/gdb.gdbtk/console.test
gdb/testsuite/gdb.gdbtk/cpp_variable.exp
gdb/testsuite/gdb.gdbtk/cpp_variable.test
gdb/testsuite/gdb.gdbtk/defs
gdb/testsuite/gdb.gdbtk/list0.c [new file with mode: 0644]
gdb/testsuite/gdb.gdbtk/list0.h [new file with mode: 0644]
gdb/testsuite/gdb.gdbtk/list1.c [new file with mode: 0644]
gdb/testsuite/gdb.gdbtk/srcwin.exp
gdb/testsuite/gdb.gdbtk/srcwin.test
gdb/testsuite/gdb.gdbtk/srcwin2.test
gdb/testsuite/gdb.gdbtk/srcwin3.test

index 5b5db47..5a01a88 100644 (file)
@@ -1,3 +1,51 @@
+2001-05-07  Keith Seitz  <keiths@cygnus.com>
+
+       * README: New file.
+
+        * configure.in: Check for executable filename extension.
+       * Makefile.in: Add filename extensions.
+        * configure: Regenerated.
+
+        * defs: Fix typo setting _test(verbose).
+        (gdbtk_test_file): New proc to load executables into gdbtk.
+        (gdbtk_test_run): New proc to run executables on gdbtk.
+        * browser.exp: Don't check if DISPLAY is set: let
+        gdbtk_initialize_display do it all for us.
+        Call gdbtk_done when finished with tests.
+        * c_variable.exp: Ditto.
+        * console.exp: Ditto.
+        * cpp_variable.exp: Ditto.
+        Only run tests if c++ is supported in the configuration.
+        * srcwin.exp: Ditto the DISPLAY stuff.
+        Accumulate all test results for the end and report them then.
+
+        * browser.test: Use gdbtk_test_file and gdbtk_test_run
+        to load and run an executable.
+        * c_variable.test: Use gdbtk_test_file and gdbtk_test_run
+        to load and run an executable.
+        * srcwin.test: Ditto.
+        * srcwin1.test: Ditto.
+        * srcwin2.test: Ditto.
+
+        * browser.test: (set_search_mode): Use "configure
+        -value" not "entryset" to set the combobox's value. We need
+        to have the command fired.
+        (browser-3.5): Remove trailing whitespace which causes test to
+        fail.
+        (browser-4.4): Expect something rational. Regexp "\_1$" cannot
+        match "func_10"!
+        (browser-4.5): Ditto.
+        (browser-5.12): Select all files for search to make test
+        match description.
+        (browser-6.2): Renamed from another test also calledd 6.1.
+        (browser-7.1): Delete all breakpoints at once without from_tty.
+        Select all entries in the comobox before invoking BP set/delete
+        button.
+        (browser-7.2): Ditto.
+
+        * list0.c, list1.c, list0.h: New files. Grabbed from gdb.base.
+        * srcwin.exp: Use these local files instead of those in gdb.base.
+
 1999-09-17  Fernando Nasser  <fnasser@totem.to.cygnus.com>
 
        * cpp_variable.test: Add test (2.75) to verify
index 09fed6d..51151a5 100644 (file)
@@ -1,7 +1,10 @@
 VPATH = @srcdir@
 srcdir = @srcdir@
 
-EXECUTABLES = simple stack c_variable cpp_variable
+EXEEXT = @EXEEXT@
+
+EXECUTABLES = simple$(EXEEXT) stack$(EXEEXT) c_variable$(EXEEXT) \
+               cpp_variable$(EXEEXT)
 
 # uuencoded format to avoid SCCS/RCS problems with binary files.
 CROSS_EXECUTABLES =
diff --git a/gdb/testsuite/gdb.gdbtk/README b/gdb/testsuite/gdb.gdbtk/README
new file mode 100644 (file)
index 0000000..ff60d99
--- /dev/null
@@ -0,0 +1,430 @@
+                       The Insight Testsuite
+                       ---------------------
+                  Keith Seitz (keiths@cygnus.com)
+                            May 1, 2001
+
+RUNNING THE TESTSUITE
+
+The Insight testsuite is run in much the same way that gdb's testsuites
+are run. The one big difference is the environment variable GDB_DISPLAY,
+which governs what display should be used for the tests.
+
+When GDB_DISPLAY is not set in the user's environment, the Insight testsuite
+will attempt to run Xvfb, an X server with a virtual frame buffer. Using
+Xvfb, the testsuite can run without interuppting the user.
+
+When Xvfb is not available, the testsuite will mark the Insight tests
+"untested" and print out some appropriate warning to the testsuite log
+file.
+
+If GDB_DISPLAY is set in the user's environment, the testsuite will attempt
+to use this display for the tests. If this display is a desktop display,
+it is very likely that any interaction between the user and his desktop
+will interfere with the tests. Some tests warp the cursor, i.e., they
+force the mouse to move on the screen. If you don't want this to happen to
+you, put Xvfb in your path.
+
+On Cygwin systems, Xvfb is not supported. Only two choices are available in
+this environment: run the testsuites using the desktop or do not run the
+testsuite. To run the testsuite on Cygwin, just define the environment
+variable GDB_DISPLAY to anything.
+
+The examples below summarize the usage of the environment variable GDB_DISPLAY
+on unix/X-Windows hosts and Cygwin hosts. In all examples, assume that DISPLAY
+set to the local workstation's main display (:0).
+
+To run the testsuite using Xvfb -- unix only (Xvfb must be in PATH):
+$ make check
+
+To run the testsuite using a given display (either the desktop or a peviously
+started Xvfb):
+$ GDB_DISPLAY=$DISPLAY make check
+
+To run the testsuite on Cygwin:
+$ GDB_DISPLAY=foo make check
+
+
+TESTSUITE INFRASTRUCTURE
+
+The rest of this document deals with writing tests for Insight. This reading
+is only noteworthy for developers and contributors.
+
+The Insight testsuite consists of two large portions of code: code which is
+run in dejagnu and code which runs in Insight's built-in Tcl interpreter. Files
+containing dejagnu code (those files ending in ".exp" in the testsuite directory)
+are "glue code" between gdb's dejagnu testsuite and Insight's Tcl testsuite.
+
+Dejagnu testsuite files are considered "drivers" for any particular set of
+tests, since they allow dejagnu to control Insight's Tcl testsuite.
+
+
+Dejagnu Testsuite Infrastructure
+
+The dejagnu code is responsible for doing several things. Some of the more
+important responsibilities include:
+
+o Initializing the display
+o Determining if tests should be run
+o Results accounting
+o Compiling testcases in various languages
+o Repoting results to gdb's testsuite
+
+There are various functions defined to facilitate the writing of tests. These
+functions currently reside in gdb's gdb.exp (src/gdb/testsuite/lib/gdb.exp) and
+include:
+
+Pulic functions:
+proc gdbtk_initialize_display {}
+
+  gdbtk_initialize_display should be the first function called from the
+  (dejagnu) test file. It initializes the DISPLAY variable on unix systems
+  and determines (for all host systems) whether or not the testsuite should
+  run. It returns 1 if the test should run. If tests should not run, it
+  marks the test as "untested" and leaves a suitable message about why
+  the test should not run. If gdbtk_initialize_display returns zero, a test
+  should simply exit.
+
+proc gdbtk_start {test}
+
+  This function marks the start of a test and will execute Insight for
+  testing. The TEST parameter should be the file name of the Tcl test
+  file to load into Insight's Tcl interpreter. It returns a list of
+  test results suitable for passing to gdbtk_done or gdbtk_analyze_results.
+  See gdbtk_analyze_results for more information on the format of results.
+
+  gdbtk_start is responsible for communicating target startup information
+  to Insight, so that Insight's testsuite may be run on any target supported
+  by gdb. It does this by setting several environment variables just before
+  it starts Insight. These environment variables are:
+
+  OBJDIR
+    The object directory of the dejagnu testsuite (i.e.,
+    objdir/gdb/testsuite).
+  SRCDIR
+    The dejagnu source directory in which the tests are located (i.e,
+    src/gdb/testsuite)
+  SUBDIR
+    The dejagnu testsuite subdirectory for the test (i.e., gdb.gdbtk)
+  GDBTK_LIBRARY
+    The location of the Insight tcl library (i.e., src/gdb/gdbtk/library)
+  TCL_LIBRARY
+    The location of the Tcl library (i.e., src/tcl/library)
+  TK_LIBRARY
+    The location of the Tk library (i.e., src/tk/library)
+  TIX_LIBRARY
+    The location of the Tix library (i.e., src/tix/library)
+  ITCL_LIBRARY
+    The location fo the Itcl librarry (i.e., src/itcl/itcl/library)
+  CYGNUS_GUI_LIBRARY
+    The location of libgui (i.e., src/libgui/library)
+  DEFS
+    The location of the testsuite definitions file (i.e.,
+    src/gdb/testsuite/gdb.gdbtk/defs)
+
+  Note that *_LIBRARY and DEFS are converted to absolute tcl-style
+  paths. On unix, this means that GDBTK_LIBRARY would point to, for example,
+  /home/keiths/insight/src/gdb/gdbtk/library. On Cygwin it would point to
+  C:/cygwin/home/keiths/insight/src/gdb/gdbtk/library. This is because of
+  a descrepency between Cygwin's posix paths and Tcl's not-quite-posix
+  paths.
+
+proc gdbtk_analyze_results {results}
+  This function translates the list of results in RESULTS into dejagnu
+  results, reporting the number of failures, errors, passes, and expected
+  failures and passes. It currently does not deal with "untested" and other
+  test statuses from dejagnu since Insight's tcl testsuite does not
+  issue such results.
+
+  The format of the results expected by gdbtk_analyze_results is simple:
+  it is a list of {status name description msg}. "status" is the execution
+  status of one of the tcl tests run. This can be "PASS", "FAIL", "ERROR",
+  "XFAIL", or "XPASS".
+
+  "name" is the name of the test, and it is reported in all testsuite
+  results in dejagnu. This speeds location of the failing test. This
+  "name" may also be given to Insight's testsuite, telling it to
+  only run this test. See "do_tests" in Tcl Testsuite Infrastructure
+  for more information.
+
+  "description" is a textual description of the test given by "name".
+
+  "msg" is currently not used.
+
+proc gdbtk_done {{results {}}}
+  gdbtk_done takes any RESULTS and passes it gdbtk_analyze_results for
+  outputting to the dejagnu part of the testsuite. It may be called
+  without an argument, in which case it will only terminate Xvfb if it
+  was started. Tests must call gdbtk_done _once_ at the end of their
+  test drivers.
+
+Private functions:
+proc _gdbtk_export_target_info
+  This functin exports information about the target into the environment
+  so that Insight's testsuite may run programs on any supported gdb
+  target. This target information is passed into the Tcl testsuite
+  via an environment variable, TARGET_INFO, which is really a Tcl array,
+  i.e., the array is constructed in tcl and exported into the environment
+  with Tcl's "array get" command).
+
+  There are four elements to the array:
+  TARGET_INFO(init)   - (optional) A list of commands to execute in gdb
+                        to initialize the session. This usually includes
+                        setting baud rates and remote protocol options.
+  TARGET_INFO(target) - (required) The complete "target" command to connect
+                        to the given target.
+  TARGET_INFO(load)   - (optional) The complete "load" command to load an
+                        executable into a target.
+  TARGET_INFO(run)    - (required) The complete "run" command, sans arguments,
+                       to start a process on the target. For remote targets,
+                        this is usually just "continue".
+  
+proc _gdbtk_xvfb_init
+  This procedure actually determines whether the an Insight test should
+  run and what DISPLAY it should use for that test. It is called by
+  gdbtk_initialize_display to do most of the dirty work.
+
+  It has a simple heuristic: If GDB_DISPLAY is not set and Xvfb is available
+  (on unix), it starts Xvfb, using the current process id as the screen number.
+  If Xvfb is not available and GDB_DISPLAY was not set, it skips the tests.
+
+proc _gdbtk_xvfb_exit
+  _gdbtk_xvfb_exit will kill any previously started Xvfb.
+
+Private globals:
+global _xvfb_spawn_id
+  This variable holds the spawn_id of any Xvfb process started
+  by the testsuite (or it is left undefined).
+
+global _using_windows
+  A global variable which indicates whether the testsuite is running
+  on cygwin. Unfortunately, as of writing, the global variable
+  tcl_platform(platform) is "unix" on Cygwin, so it is not possible
+  to rely on this for platform-dependent operations.
+
+  Instead, this variable is set by gdbtk_initialize_display. The test
+  it uses to determine if Cygwin is being used: it looks for the program
+  cygpath in the PATH. Therefore, cygpath is REQUIRED to run the testsuite
+  on Cygwin. (gdbtk_start also uses cygpath to determine Windows
+  pathnames for Cygwin.)
+
+
+Testsuite Driver Basics
+
+Given the above interfaces for connecting Insight's Tcl testsuite and
+gdb's dejagnu testsuite, the basic testsuite driver file should look
+(minimally) like this:
+
+File: mytest.exp
+1   if {[gdbtk_initialize_display]} {
+2     # We found a display to use
+3     gdb_exit;   # Make sure any previous gdb is gone
+4     set results [gdbtk_start mytest.test]
+5
+6     # Done!
+7     gdbtk_done [split $results \n]
+8   }
+
+Line 1 calls gdbtk_initialize_display to ascertain whether there is a display
+to use for the test. This could use an existing display (if GDB_DISPLAY is
+set in the environment) or gdbk_initialize_display could startup an Xvfb
+for use by the testsuite.
+
+Line 3 forces any previously executing gdb to terminate.
+
+Line 4 signals the start of the test run. "mytest.test" is the name of the
+Tcl test file to execute in Insight's built-in Tcl interpreter. The output
+of gdbtk_start_test is all of the results of the Tcl test from Insight, which
+is subsequently passed to gdbk_analyze_results via gdbtk_done on Line 7.
+
+Note how nothing happens if gdbtk_initialize_display returns false.
+
+
+Tcl Testsuite Infrastructure
+
+The heart of Insight's testsuite is its Tcl testsuite. It is these tests
+which run directly in Insight's Tcl interpreter and allow test writers
+access to Insight's internals. Tcl testsuite files have the filename suffix
+".test" to distinguish them from their driver files, which end in ".exp".
+
+The design of the Insight Tcl testsuite parallels Tcl's testsuite. It has
+many powerful features, including the ability to run ANY test in a given
+Tcl test file. See the description of utility routines below for more
+information about running any set of tests from a file.
+
+The bulk of the code implementing the Tcl testsuite infrastructure in
+Insight is contained in the testsuite definitions file, "defs", located
+in src/gdb/testsuite/gdb.gdbtk. This file contains routines necessary
+to write tests for Insight.
+
+Public functions:
+proc gdbtk_read_defs {}
+  This function, located in Insight's core Tcl library, attempts to load
+  the testsuite definitions file. If it fails, it will either pop up
+  a dialog box with the error (if running interactively) or it will
+  print the error to stderr and exit (if running non-interactively).
+
+  If successful, it will return true.
+
+proc gdbtk_test_file {filename}
+  This function is used to load the file given by FILENAME into
+  Insight. It will automatically append ".exe" to any FILENAME
+  on Cygwin-hosted systems.
+
+  If successful, it will load the given file into Insight and
+  return the output of gdb's file command. It will call "error"
+  if it was succesful, therefore all calls to "gdbtk_test_file"
+  should be called using "catch".
+
+  Test authors should not use "gdb_cmd {file FILENAME}" to load
+  files into gdb unless they are testing interface code between
+  gdb and Insight.
+
+proc gdbtk_test_run {{prog_args {}}}
+  gdbtk_test_run runs the previoiusly loaded executable, passing
+  the given arguments to the inferior. Like Insight's Run button,
+  it will do whatever is necessary to get the executable running,
+  including any target initialization (setting baud rate and remote
+  protocol options), downloading the executable to the target, and
+  finally starting execution.
+
+  Test authors should NEVER use "gdb_cmd {run ARGUMENTS}" to run an
+  executable. Doing so will insure that your tests will only run on
+  a native debugger.
+
+  It returns true if successful or false otherwise. It will report
+  the error in a dialog box (if running interactively) or it will
+  print the error to stderr.
+
+proc gdbtk_test {name description script answer}
+  This is Tcl testsuite equivalent of "expect". "name" is a canonical
+  name of the test, usually of the form "shortname-major.minor". This is
+  the name that is used when running selected tests from a given file.
+  If "name" starts with an asterisk (*), it designates that the test
+  is expected to fail.
+
+  "description" is a short textual description of the test to help
+  humans understand what it does.
+
+  "script" is the actual test script to run. The result of this script
+  will be compared against "answer" to determine if the test passed
+  or failed.
+
+  It calls gdbtk_print_verbose to print out the results to the terminal
+  (if running interactively) or to the log file.
+
+proc gdbtk_test_done {}
+  gdbtk_test_done is called at the very end of all tcl tests. It is used
+  to exit Insight and return control back to the dejagnu driver which
+  started the tests.
+  
+proc gdbtk_dotests {file args}
+  Obsolete.
+
+proc do_test {{file {}} {verbose {}} {tests {}}}
+  This procedure is used to invoke the Insight test(s) given in FILE
+  which match the regular expression(s) in TESTS. This is invoked
+  from Insight's console window to run tests interactively.
+
+  VERBOSE sets the verbosity of the test run. When set to one,
+  the testsuite will report all results in human readable form.
+  When set  greater than one, it will print out results as a list,
+  i.e., for passing to gdbtk_analyze_results. If zero, it will only
+  print errors and failures in human readable form.
+
+Public global variables:
+objdir   - The objdir from dejagnu. See gdbtk_start for more information.
+srcdir   - The srcdir from dejagnu. See gdbtk_start for more information.
+test_ran - Indicates whether the last test ran or not. See example below.
+
+Private functions:
+proc gdbtk_test_error {desc}
+  An internal function used to report a framework error in the testsuite.
+  "desc" is a description of the error. It calls gdbtk_test_done.
+
+proc gdbtk_print_verbose {status name description script code answer}
+  A helper procedure to gdbtk_test which prints out results to the terminal
+  or the logfile (or both or none).
+
+Private global variables:
+_test - An array used by the testsuite internals.
+
+
+Tcl Test Basics
+
+Armed with the basic interface described above, it is possible to test Insight's
+GUI. Please do not write tests which attempt to imitate a user (moving the
+mouse and clicking buttons), unless there is no other way to test the functionality.
+
+The basic test file (with one test) looks like this (nonsensical one):
+File: mytest.exp
+1  if {![gdbtk_read_defs]} {
+2    break
+3  }
+4  
+5  global objdir test_ran
+6  set program [file join $objdir mytest]
+7  if {[catch {gdbtk_test_file $program} t]} {
+8    gdbtk_test_error "loading \"$program\": $t"
+9  }
+10 if {![gdbtk_test_run]} { exit 1 }
+11
+12 global foo
+13 set foo 1
+14
+15 # Test:  mytest-1.1
+16 # Desc:  check if a source window was created
+17 gdbtk_test mytest-1.1 {source window created} {
+18   set window [ManagedWin::find SrcWin]
+19   llength $window
+20   set foo 13
+21 } {1}
+22
+23 if {$test_ran} {
+24   set foo 1
+25 }
+26
+27 # Done
+28 gdbtk_test_done
+
+Line 1 calls the Inisght function gdbtk_read_defs to read in the testsuite
+definitions file.
+
+Line 6 then specifies the name of a file (mytest) in the object directory
+which is loaded into gdb on Line 7. If loading the file into Insight
+failed, gdbtk_test_error is called to publish the error (and terminate the
+test run for this file).
+
+Line 10 runs the executable on the target, and exits if it was unable
+to do so.
+
+Line 13 simply sets a global variable foo to illustrate the purpose
+of the global "test_ran". Before the test "mytest-1.1" runs, foo is set to
+one. In order to support running specific tests, the state of the debugger
+cannot be altered INSIDE gdbtk_test scripts, since the contents of the
+script may not be run if the user requested only a specific test to run.
+
+Line 20 in the middle of the test modifies the global foo. If subsequent
+test relied on foo being one, we would have a state violation, since
+mytest-1.1 may have (or may have not) run.
+
+Therefore, we can check if a test ran and reset foo by checking the
+global "test_ran". If set, we know that the previous test (mytest-1.1)
+was run, and that foo is now thirteen. We reset the result back to one.
+
+(Aside: Some tests do not follow this rule explicitly: they can assume
+that all tests run sequentially. In these cases, running a specific
+test in the file will probably fail, since the debugger is not brought
+to a known state along the way.)
+
+Lines 17-21 contain the actual test. The test's name is "mytest-1.1". It
+is this name that may be referred to when asking the testsuite to run
+a specific test. The description of this test is "source window created",
+indicating that mytest-1.1's purpose is to check whether a source window
+was created.
+
+If gdbtk_test determines that this test is to run, it will execute the
+next part, lines 18-20, and compare the output of that script (llength
+$window) with "1". If the result is not "1", a failure is recorded. If
+it is "1", a pass is recorded.
+
+Finally, the test file is done and exits on line 28.
index 649fc7b..cc1d27c 100644 (file)
@@ -1,16 +1,22 @@
+# Copyright 1998, 1999, 2001 Red Hat, Inc.
 #
-# Check if we have a display
+# 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.
 #
-if {![info exists ::env(DISPLAY)]} {
-  untested "No DISPLAY -- skipping test"
-} else {
+# 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.
 
+if {[gdbtk_initialize_display]} {
   if {$tracelevel} {
     strace $tracelevel
   }
 
   #
-  # test console window
+  # test browser window
   #
   set prms_id 0
   set bug_id 0
@@ -29,5 +35,5 @@ if {![info exists ::env(DISPLAY)]} {
   set results [split $results \n]
 
   # Analyze results
-  gdbtk_analyze_results $results
+  gdbtk_done $results
 }
index 832ad36..9e358da 100644 (file)
@@ -1,4 +1,5 @@
-#   Copyright (C) 1998 Cygnus Solutions
+# Browser Window Tests
+# Copyright 1998, 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
@@ -55,7 +56,10 @@ proc do_search {} {
 proc set_search_mode {val} {
   global browser
   pref set gdb/search/filter_mode $val
-  $browser component filt_type entryset $val
+
+  # Use configure instead of entryset: need to have
+  # combobox's command fire
+  $browser component filt_type configure -value $val
 }
 
 # Highlight a file
@@ -95,8 +99,11 @@ proc clear {} {
 #####         #####
 
 # Load the test executable
-set file [file join $objdir stack]
-gdb_cmd "file $file"
+set program [file join $objdir stack]
+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"
+}
 
 # Open a browser
 set browser [ManagedWin::open BrowserWin]
@@ -353,7 +360,7 @@ gdbtk_test browser-3.5 {all functions matching "func_1" in stack1.c - "mode cont
   clear
   select stack1.c
   do_search
-} {func_1 func_10 func_11 func_12 func_13 func_14 func_15 static_func_1 static_func_10 static_func_11 static_func_12 static_func_13 static_func_14 static_func_15 }
+} {func_1 func_10 func_11 func_12 func_13 func_14 func_15 static_func_1 static_func_10 static_func_11 static_func_12 static_func_13 static_func_14 static_func_15}
 
 # Test:  browser-3.6
 # Desc:  Check all functions matching "func_1" in stack2.c - mode contains
@@ -469,13 +476,13 @@ if {$test_ran} {
 }
 
 # Test:  browser-4.4
-# Desc:  Check for all functions matching "func" - mode ends with
+# Desc:  Check for all functions matching "func_1" - mode ends with
 gdbtk_test browser-4.4 {all functions matching "func_1" - "mode ends with"} {
   set_search_mode "ends with"
   set_regexp "func_1"
   select_all
   do_search
-} {func_1 func_10 func_11 func_12 func_13 func_14 func_15 static_func_1 static_func_10 static_func_11 static_func_12 static_func_13 static_func_14 static_func_15}
+} {func_1 static_func_1}
 
 # Test:  browser-4.5
 # Desc:  Check all functions matching "func_1" in stack1.c - mode ends with
@@ -485,7 +492,7 @@ gdbtk_test browser-4.5 {all functions matching "func_1" in stack1.c - "mode ends
   clear
   select stack1.c
   do_search
-} {func_1 func_10 func_11 func_12 func_13 func_14 func_15 static_func_1 static_func_10 static_func_11 static_func_12 static_func_13 static_func_14 static_func_15 }
+} {func_1 static_func_1}
 if {$test_ran} {
   clear
 }
@@ -555,6 +562,7 @@ gdbtk_test browser-5.12 {all functions matching regexp "func" in stack2.c} {
 gdbtk_test browser-5.13 {all functions matching regexp "\_1$"} {
   set_search_mode "matches regexp"
   set_regexp {\_1$}
+  select_all
   do_search
 } {extern_func1_1 func_1 static_func_1}
 
@@ -608,18 +616,27 @@ gdbtk_test browser-6.1 {select button - select all} {
   expr {[llength $m] >= 2}
 } {1}
 
+# Test:  browser-6.2
+# Desc:  Check that search expressions are saved
+gdbtk_test browser-6.2 {save last search expression} {
+  set_regexp hello
+  select_all
+  do_search
+  pref get gdb/search/last_symbol
+} {hello}
+
 # Test:  browser-7.1
 # Desc:  Toggle all bps on
 gdbtk_test browser-7.1 {toggle_all_bp on} {
   set_regexp {\_1$}
   set_search_mode "matches regexp"
   select_all
-  do_search
-  $browser component func_add_bp invoke
-
-  set_regexp .*
   set funcs [do_search]
 
+  # select all to set bp on
+  $browser component func_box selection set 0 end
+  $browser component func_add_bp invoke
+
   set bps {}
   foreach f $funcs {
     if {![catch {gdb_loc $f} ls]} {
@@ -629,29 +646,26 @@ gdbtk_test browser-7.1 {toggle_all_bp on} {
     }
   }
 
-  for {set i 0} {$i < 20} {incr i} {
-    catch {gdb_cmd "delete $i"}
-  }
-
+  catch {gdb_cmd "delete" 0}
   join [lsort $bps]
 } {extern_func1_1 func_1 static_func_1}
 
 # Test:  browser-7.2
-# Desc:  Toggle all bps off
-gdbtk_test browser-7.2 {toggle_all_bp off} {
+# Desc:  Toggle some bps off
+gdbtk_test browser-7.2 {toggle_some_bp off} {
   set_regexp {\_1$}
   set_search_mode "matches regexp"
   select_all
-  do_search
-  $browser component func_add_bp invoke
-
-  set_regexp .*
   set funcs [do_search]
 
-  # Turn off all static bps
-  set_regexp {\_1$}
+  $browser component func_box selection set 0 end
+  $browser component func_add_bp invoke
+
+  # Turn off all the "static_func_*" bps
+  set_regexp {^static.*_1$}
   do_search
-  $browser component func_remove_bp
+  $browser component func_box selection set 0 end
+  $browser component func_remove_bp invoke
   set bps {}
   foreach f $funcs {
     if {![catch {gdb_loc $f} ls]} {
@@ -661,22 +675,11 @@ gdbtk_test browser-7.2 {toggle_all_bp off} {
     }
   }
 
-  for {set i 0} {$i < 20} {incr i} {
-    catch {gdb_cmd "delete $i"}
-  }
+  catch {gdb_cmd "delete" 0}
 
   join [lsort $bps]
 } {extern_func1_1 func_1}
 
-# Test:  browser-6.1
-# Desc:  Check that search expressions are saved
-gdbtk_test browser-6.1 {save last search expression} {
-  set_regexp hello
-  select_all
-  do_search
-  pref get gdb/search/last_symbol
-} {hello}
-
 #
 #  Exit
 #
index 8452034..70f55b0 100644 (file)
@@ -1,10 +1,16 @@
+# Copyright 1999, 2001 Red Hat, Inc.
 #
-# Check if we have a display
+# 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.
 #
-if {![info exists ::env(DISPLAY)]} {
-  untested "No DISPLAY -- skipping test"
-} else {
+# 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.
 
+if {[gdbtk_initialize_display]} {
   if {$tracelevel} {
     strace $tracelevel
   }
@@ -30,5 +36,5 @@ if {![info exists ::env(DISPLAY)]} {
   set results [split $results \n]
 
   # Analyze results
-  gdbtk_analyze_results $results
+  gdbtk_done $results
 }
index 098c924..7fd0395 100644 (file)
@@ -1,4 +1,5 @@
-#   Copyright (C) 1998 Cygnus Solutions
+# Varobj Tests (C language)
+# Copyright 1998, 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
@@ -25,18 +26,11 @@ if {![gdbtk_read_defs]} {
 }
 
 global objdir test_ran
-global tcl_platform 
 
 # Load in a file
-if {$tcl_platform(platform) == "windows"} {
-  set program [file join $objdir c_variable.exe]
-} else {
-  set program [file join $objdir c_variable]
-}
-
-# This isn't a test case, since if this fails, we're hosed.
-if {[catch {gdb_cmd "file $program"} t]} {
-  # an error occured loading the 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"
 }
 
@@ -179,10 +173,9 @@ gdbtk_test c_variable-1.3 {create out of scope variable} {
   create_variable argc
 } {1}
 
-## FIXME: natives only
 # Break in main and run
 gdb_cmd "break do_locals_tests"
-gdb_cmd "run"
+gdbtk_test_run
 
 # Test: c_variable-1.4
 # Desc: create local variables
@@ -354,6 +347,8 @@ gdbtk_test c_variable-2.11 {create do_locals_tests local in subroutine1} {
   create_variable linteger
 } {1}
 
+# Step over
+#  global_simple.integer = i + 3;
 gdb_cmd "step"
 
 # Test: c_variable-2.12
@@ -365,6 +360,8 @@ gdbtk_test c_variable-2.12 {change global_simple.integer} {
   check_update
 } {{} {lsimple.character lsimple.integer lpsimple lsimple i lcharacter lpcharacter global_simple linteger lpinteger lfloat lpfloat l func llong lplong lpsimple->integer ldouble lpdouble} {}}
 
+# Step over
+#  i = 212;
 gdb_cmd "step"
 
 # Test: c_variable-2.13
@@ -373,6 +370,8 @@ gdbtk_test c_variable-2.13 {change subroutine1 local i} {
   check_update
 } {i {lsimple.character lsimple.integer lpsimple lsimple lcharacter lpcharacter global_simple linteger lpinteger lfloat lpfloat l func llong lplong lpsimple->integer ldouble lpdouble} {}}
 
+# Step over
+#  *l = 12
 gdb_cmd "step"
 
 # Test: c_variable-2.14
@@ -381,6 +380,7 @@ gdbtk_test c_variable-2.14 {change do_locals_tests local llong} {
   check_update
 } {llong {lsimple.character lsimple.integer lpsimple lsimple i lcharacter lpcharacter global_simple linteger lpinteger lfloat lpfloat l func lplong lpsimple->integer ldouble lpdouble} {}}
 
+# Leave subroutine1
 gdb_cmd "next"
 
 # Test: c_variable-2.15
index c65cbd9..f6964b2 100644 (file)
@@ -1,7 +1,7 @@
 #! /bin/sh
 
 # Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.12.2 
+# Generated automatically using autoconf version 2.13 
 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
 #
 # This configure script is free software; the Free Software Foundation
@@ -28,6 +28,7 @@ program_suffix=NONE
 program_transform_name=s,x,x,
 silent=
 site=
+sitefile=
 srcdir=
 target=NONE
 verbose=
@@ -142,6 +143,7 @@ Configuration:
   --help                  print this message
   --no-create             do not create output files
   --quiet, --silent       do not print \`checking...' messages
+  --site-file=FILE        use FILE as the site file
   --version               print the version of autoconf that created configure
 Directory and file names:
   --prefix=PREFIX         install architecture-independent files in PREFIX
@@ -312,6 +314,11 @@ EOF
   -site=* | --site=* | --sit=*)
     site="$ac_optarg" ;;
 
+  -site-file | --site-file | --site-fil | --site-fi | --site-f)
+    ac_prev=sitefile ;;
+  -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*)
+    sitefile="$ac_optarg" ;;
+
   -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
     ac_prev=srcdir ;;
   -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
@@ -333,7 +340,7 @@ EOF
     verbose=yes ;;
 
   -version | --version | --versio | --versi | --vers)
-    echo "configure generated by autoconf version 2.12.2"
+    echo "configure generated by autoconf version 2.13"
     exit 0 ;;
 
   -with-* | --with-*)
@@ -477,12 +484,16 @@ fi
 srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
 
 # Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
-  if test "x$prefix" != xNONE; then
-    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
-  else
-    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+if test -z "$sitefile"; then
+  if test -z "$CONFIG_SITE"; then
+    if test "x$prefix" != xNONE; then
+      CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+    else
+      CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+    fi
   fi
+else
+  CONFIG_SITE="$sitefile"
 fi
 for ac_site_file in $CONFIG_SITE; do
   if test -r "$ac_site_file"; then
@@ -571,7 +582,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:575: checking host system type" >&5
+echo "configure:586: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -592,7 +603,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
 echo "$ac_t""$host" 1>&6
 
 echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:596: checking target system type" >&5
+echo "configure:607: checking target system type" >&5
 
 target_alias=$target
 case "$target_alias" in
@@ -610,7 +621,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
 echo "$ac_t""$target" 1>&6
 
 echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:614: checking build system type" >&5
+echo "configure:625: checking build system type" >&5
 
 build_alias=$build
 case "$build_alias" in
@@ -632,6 +643,103 @@ test "$host_alias" != "$target_alias" &&
     NONENONEs,x,x, &&
   program_prefix=${target_alias}-
 
+
+echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
+echo "configure:649: checking for Cygwin environment" >&5
+if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 654 "configure"
+#include "confdefs.h"
+
+int main() {
+
+#ifndef __CYGWIN__
+#define __CYGWIN__ __CYGWIN32__
+#endif
+return __CYGWIN__;
+; return 0; }
+EOF
+if { (eval echo configure:665: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_cygwin=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_cygwin=no
+fi
+rm -f conftest*
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_cygwin" 1>&6
+CYGWIN=
+test "$ac_cv_cygwin" = yes && CYGWIN=yes
+echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
+echo "configure:682: checking for mingw32 environment" >&5
+if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 687 "configure"
+#include "confdefs.h"
+
+int main() {
+return __MINGW32__;
+; return 0; }
+EOF
+if { (eval echo configure:694: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_mingw32=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_mingw32=no
+fi
+rm -f conftest*
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_mingw32" 1>&6
+MINGW32=
+test "$ac_cv_mingw32" = yes && MINGW32=yes
+
+
+echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
+echo "configure:713: checking for executable suffix" >&5
+if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
+  ac_cv_exeext=.exe
+else
+  rm -f conftest*
+  echo 'int main () { return 0; }' > conftest.$ac_ext
+  ac_cv_exeext=
+  if { (eval echo configure:723: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+    for file in conftest.*; do
+      case $file in
+      *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+      *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
+      esac
+    done
+  else
+    { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
+  fi
+  rm -f conftest*
+  test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
+fi
+fi
+
+EXEEXT=""
+test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
+echo "$ac_t""${ac_cv_exeext}" 1>&6
+ac_exeext=$EXEEXT
+
+
 trap '' 1 2 15
 cat > confcache <<\EOF
 # This file is a shell script that caches the results of configure
@@ -655,7 +763,7 @@ EOF
 # Ultrix sh set writes to stderr and can't be redirected directly,
 # and sets the high bit in the cache file unless we assign to the vars.
 (set) 2>&1 |
-  case `(ac_space=' '; set) 2>&1 | grep ac_space` in
+  case `(ac_space=' '; set | grep ac_space) 2>&1` in
   *ac_space=\ *)
     # `set' does not quote correctly, so add quotes (double-quote substitution
     # turns \\\\ into \\, and sed turns \\ into \).
@@ -734,7 +842,7 @@ do
     echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
     exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
   -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
-    echo "$CONFIG_STATUS generated by autoconf version 2.12.2"
+    echo "$CONFIG_STATUS generated by autoconf version 2.13"
     exit 0 ;;
   -help | --help | --hel | --he | --h)
     echo "\$ac_cs_usage"; exit 0 ;;
@@ -757,6 +865,7 @@ s%@SHELL@%$SHELL%g
 s%@CFLAGS@%$CFLAGS%g
 s%@CPPFLAGS@%$CPPFLAGS%g
 s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
 s%@DEFS@%$DEFS%g
 s%@LDFLAGS@%$LDFLAGS%g
 s%@LIBS@%$LIBS%g
@@ -791,6 +900,7 @@ s%@build_alias@%$build_alias%g
 s%@build_cpu@%$build_cpu%g
 s%@build_vendor@%$build_vendor%g
 s%@build_os@%$build_os%g
+s%@EXEEXT@%$EXEEXT%g
 
 CEOF
 EOF
index 4c408e8..5ab12ed 100644 (file)
@@ -11,4 +11,8 @@ CC=${CC-cc}
 AC_SUBST(CC)
 AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/../../..)
 AC_CANONICAL_SYSTEM
+
+dnl Check for exe extension set on certain hosts (e.g. Win32)
+AC_EXEEXT
+
 AC_OUTPUT(Makefile)
index 1d50c66..2023dc9 100644 (file)
@@ -1,10 +1,16 @@
+# Copyright 1998, 1999, 2001 Red Hat, Inc.
 #
-# Check if we have a display
+# 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.
 #
-if {![info exists ::env(DISPLAY)]} {
-  untested "No DISPLAY -- skipping test"
-} else {
+# 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.
 
+if {[gdbtk_initialize_display]} {
   if {$tracelevel} {
     strace $tracelevel
   }
@@ -30,5 +36,5 @@ if {![info exists ::env(DISPLAY)]} {
   set results [split $results \n]
 
   # Analyze results
-  gdbtk_analyze_results $results
+  gdbtk_done $results
 }
index d24dd6b..7a48418 100644 (file)
@@ -108,7 +108,7 @@ gdbtk_test console-paste-1 {paste X text} {
   text .test_text
   .test_text insert end "this is some pasted text"
   .test_text tag add sel 1.0 {1.0 lineend}
-
+  event generate .test_text <<Copy>>
   event generate $text <<Paste>>
   get_cmd_line
 } {(gdb) this is some pasted text}
@@ -467,8 +467,3 @@ if {$test_ran} {
 #  Exit
 #
 gdbtk_test_done
-
-# Local variables:
-# mode: tcl
-# change-log-default-name: "ChangeLog-gdbtk"
-# End:
index ed5ca35..a0a2972 100644 (file)
@@ -1,34 +1,46 @@
+# Copyright 1999, 2001 Red Hat, Inc.
 #
-# Check if we have a display
+# 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.
 #
-if {![info exists ::env(DISPLAY)]} {
-  untested "No DISPLAY -- skipping test"
-} else {
+# 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.
 
+if {[gdbtk_initialize_display]} {
   if {$tracelevel} {
     strace $tracelevel
   }
 
-  #
-  # test variable API
-  #
-  set prms_id 0
-  set bug_id 0
+  set results {}
+  if {[skip_cplus_tests]} {
+    # Target doesn't have c++ support
+    verbose "No C++ support -- skipping test"
+  } else {
+    #
+    # test variable API
+    #
+    set prms_id 0
+    set bug_id 0
 
-  set testfile "cpp_variable"
-  set srcfile ${testfile}.cc
-  set binfile ${objdir}/${subdir}/${testfile}
-  set r [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}]
-  if  { $r != "" } {
-    gdb_suppress_entire_file \
-      "Testcase compile failed, so some tests in this file will automatically fail."
-  }
+    set testfile "cpp_variable"
+    set srcfile ${testfile}.cc
+    set binfile ${objdir}/${subdir}/${testfile}
+    set r [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}]
+    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 ${testfile}.test]]
-  set results [split $results \n]
+    # Start with a fresh gdbtk
+    gdb_exit
+    set results [gdbtk_start [file join $srcdir $subdir ${testfile}.test]]
+    set results [split $results \n]
+  }
 
   # Analyze results
-  gdbtk_analyze_results $results
+  gdbtk_done $results
 }
index 5f9c273..db0f58a 100644 (file)
@@ -25,18 +25,11 @@ if {![gdbtk_read_defs]} {
 }
 
 global objdir test_ran
-global tcl_platform 
 
 # Load in a file
-if {$tcl_platform(platform) == "windows"} {
-  set program [file join $objdir cpp_variable.exe]
-} else {
-  set program [file join $objdir cpp_variable]
-}
-
-# This isn't a test case, since if this fails, we're hosed.
-if {[catch {gdb_cmd "file $program"} t]} {
-  # an error occured loading the file
+set program [file join $objdir cpp_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"
 }
 
index a4f20c6..6b0c9cd 100644 (file)
@@ -1,10 +1,11 @@
 # This file contains support code for the gdbtk test suite.
+# Copyright 2001 Red Hat, Inc.
 #
 # Based on the Tcl testsuite support code, portions of this file
 # are Copyright (c) 1990-1994 The Regents of the University of California and
 # Copyright (c) 1994-1996 Sun Microsystems, Inc.
 #
-global srcdir _test env srcdir objdir
+global _test env srcdir objdir
 
 if {![info exists srcdir]} {
   if {[info exists env(SRCDIR)]} {
@@ -30,7 +31,7 @@ if {![info exists _test(verbose)]} {
   if {[info exists env(GDBTK_VERBOSE)]} {
     set _test(verbose) $env(GDBTK_VERBOSE)
   } else {
-    set _test(verbose)
+    set _test(verbose) 0
   }
 }
 if {![info exists _test(tests)]} {
@@ -55,6 +56,81 @@ if {[info exists env(GDBTK_LOGFILE)]} {
 # window manager does not interfere. This is reset in gdbtk_test_done.
 set env(GDBTK_TEST_RUNNING) 1
 
+# The gdb "file" command to use for gdbtk testing
+# NOTE: This proc appends ".exe" to all windows' programs
+proc gdbtk_test_file {filename} {
+  global tcl_platform
+
+  if {$tcl_platform(platform) == "windows"} {
+    append filename ".exe"
+  }
+
+  set err [catch {gdb_cmd "file $filename" 1} text]
+  if {$err} {
+    error $text
+  }
+
+  return $text
+}
+
+proc gdbtk_test_run {{prog_args {}}} {
+  global env
+
+  # Get the target_info array from the testsuite
+  array set target_info $env(TARGET_INFO)
+
+  # We get the target ready by:
+  # 1. Run all init commands
+  # 2. Issue target command
+  # 3. Issue load command
+  # 4. Issue run command
+  foreach cmd $target_info(init) {
+    set err [catch {gdb_cmd $cmd 0} txt]
+    if {$err} {
+      _report_error "Target initialization command \"$cmd\" failed: $txt"
+      return 0
+    }
+  }
+
+  if {$target_info(target) != ""} {
+    set err [catch {gdb_cmd $target_info(target) 0} txt]
+    if {$err} {
+      _report_error "Failed to connect to target: $txt"
+      return 0
+    }
+  }
+
+  if {$target_info(load) != ""} {
+    set err [catch {gdb_cmd $target_info(load) 0} txt]
+    if {$err} {
+      _report_error "Failed to load: $txt"
+      return 0
+    }
+  }
+
+  if {$target_info(run) != ""} {
+    set err [catch {gdb_cmd $target_info(run) 0} txt]
+    if {$err} {
+      _report_error "Could not run target with \"$target_info(run)\": $txt"
+      return 0
+    }
+  }
+
+  return 1
+}
+
+proc _report_error {msg} {
+  global _test
+
+  if {[info exists _tesst(interactive)] && $_test(interactive)} {
+    # Dialog
+    tk_messageBox -message $msg -icon error -type ok
+  } else {
+    # to stderr
+    puts stderr $msg
+  }
+}
+
 proc gdbtk_print_verbose {status name description script code answer} {
   global _test
 
diff --git a/gdb/testsuite/gdb.gdbtk/list0.c b/gdb/testsuite/gdb.gdbtk/list0.c
new file mode 100644 (file)
index 0000000..b50fdd4
--- /dev/null
@@ -0,0 +1,43 @@
+#include "list0.h"
+
+int main ()
+{
+    int x;
+#ifdef usestubs
+    set_debug_traps();
+    breakpoint();
+#endif
+    x = 0;
+    foo (x++);
+    foo (x++);
+    foo (x++);
+    foo (x++);
+    foo (x++);
+    foo (x++);
+    foo (x++);
+    foo (x++);
+    foo (x++);
+    foo (x++);
+    foo (x++);
+    foo (x++);
+    foo (x++);
+    foo (x++);
+    foo (x++);
+    foo (x++);
+    foo (x++);
+    foo (x++);
+    foo (x++);
+    foo (x++);
+    foo (x++);
+    foo (x++);
+    foo (x++);
+    foo (x++);
+    foo (x++);
+    return 0;
+}
+
+static void
+unused ()
+{
+    /* Not used for anything */
+}
diff --git a/gdb/testsuite/gdb.gdbtk/list0.h b/gdb/testsuite/gdb.gdbtk/list0.h
new file mode 100644 (file)
index 0000000..d468330
--- /dev/null
@@ -0,0 +1,37 @@
+/* An include file that actually causes code to be generated in the including file.  This is known to cause problems on some systems. */
+#ifdef PROTOTYPES
+extern void bar(int);
+static void foo (int x)
+#else
+static void foo (x) int x;
+#endif
+{
+    bar (x++);
+    bar (x++);
+    bar (x++);
+    bar (x++);
+    bar (x++);
+    bar (x++);
+    bar (x++);
+    bar (x++);
+    bar (x++);
+    bar (x++);
+    bar (x++);
+    bar (x++);
+    bar (x++);
+    bar (x++);
+    bar (x++);
+    bar (x++);
+    bar (x++);
+    bar (x++);
+    bar (x++);
+    bar (x++);
+    bar (x++);
+    bar (x++);
+    bar (x++);
+    bar (x++);
+    bar (x++);
+    bar (x++);
+    bar (x++);
+    bar (x++);
+}
diff --git a/gdb/testsuite/gdb.gdbtk/list1.c b/gdb/testsuite/gdb.gdbtk/list1.c
new file mode 100644 (file)
index 0000000..6094104
--- /dev/null
@@ -0,0 +1,39 @@
+#include <stdio.h>
+
+#ifdef PROTOTYPES
+void long_line (); int oof (int);
+void bar (int x)
+#else
+void bar (x) int x;
+#endif
+{
+    printf ("%d\n", x);
+
+    long_line ();
+}
+
+static void
+unused ()
+{
+    /* Not used for anything */
+}
+/* This routine has a very long line that will break searching in older versions of GDB.  */
+#ifdef PROTOTYPES
+void
+#endif
+long_line ()
+{
+  oof (67);
+
+  oof (6789);
+
+  oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*  5 */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /* 10 */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /* 15 */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /* 20 */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /* 25 */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /* 30 */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /* 35 */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /* 40 */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /* 45 */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /* 50 */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /* 55 */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /* 60 */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /* 65 */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (12); /*    */      oof (12);  oof (12);  oof (12);  oof (12);  oof (12);  oof (1234); /* 70 */
+}
+#ifdef PROTOTYPES
+int oof (int n)
+#else
+oof (n) int n;
+#endif
+{
+  return n + 1;
+}
index e3dc07d..8473114 100644 (file)
@@ -1,9 +1,16 @@
+# Copyright 1999, 2001 Red Hat, Inc.
 #
-# Check if we have a display
+# 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.
 #
-if {![info exists ::env(DISPLAY)]} {
-  untested "No DISPLAY -- skipping test"
-} else {
+# 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.
+
+if {[gdbtk_initialize_display]} {
   if {$tracelevel} {
     strace $tracelevel
   }
@@ -15,32 +22,38 @@ if {![info exists ::env(DISPLAY)]} {
   set bug_id 0
   
   set testfile "list"
+  set s1 "$srcdir/$subdir/list0.c"
+  set sources "$s1 $srcdir/$subdir/list1.c"
   set binfile $objdir/$subdir/$testfile
-  set r [gdb_compile "$srcdir/gdb.base/list0.c $srcdir/gdb.base/list1.c" "$binfile" executable debug]
+  if {[file exists $s1.save]} {
+    catch {file delete $s1}
+    file rename $s1.save $s1
+  }
+  set r [gdb_compile $sources "$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 srcwin.test]]
   set results [split $results \n]
-  # Analyze results
-  gdbtk_analyze_results $results
+  set all_results $results
 
   # move file with "main" out of the way
-  file rename $srcdir/gdb.base/list0.c $srcdir/gdb.base/list0.c.save
+  file rename $s1 $s1.save
+
   # run slightly different set of tests
   gdb_exit
   set results [gdbtk_start [file join $srcdir $subdir srcwin2.test]]
   set results [split $results \n]
-  #restore file
-  file rename $srcdir/gdb.base/list0.c.save $srcdir/gdb.base/list0.c
-  # Analyze results
-  gdbtk_analyze_results $results
+  set all_results [concat $all_results $results]
+
+  # restore file
+  file rename $s1.save $s1
 
-  set r [gdb_compile "$srcdir/gdb.base/list0.c $srcdir/gdb.base/list1.c" "$binfile" executable ""]
+  set r [gdb_compile $sources "$binfile" executable ""]
   if  { $r != "" } {
     gdb_suppress_entire_file \
       "Testcase compile failed, so some tests in this file will automatically fail."
@@ -49,11 +62,8 @@ if {![info exists ::env(DISPLAY)]} {
   gdb_exit
   set results [gdbtk_start [file join $srcdir $subdir srcwin3.test]]
   set results [split $results \n]
+  set all_results [concat $all_results $results]
+
   # Analyze results
-  gdbtk_analyze_results $results
+  gdbtk_done $all_results
 }
-
-# Local variables:
-# mode: tcl
-# change-log-default-name: "ChangeLog-gdbtk"
-# End:
index dcd5369..127351d 100644 (file)
@@ -71,16 +71,10 @@ proc click {win bbox event} {
 #####                 #####
 
 # Load the test executable
-if {$tcl_platform(platform) == "windows"} {
-  set file [file join $objdir list.exe]
-} else {
-  set file [file join $objdir list]
-}
-
-# This isn't a test case, since if this fails, we're hosed.
-if {[catch {gdb_cmd "file $file" 1} t]} {
-  # an error occured loading the file
-  gdbtk_test_error "loading \"$file\": $t"
+set program [file join $objdir list]
+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"
 }
 
 set srcwin [ManagedWin::open SrcWin]
@@ -89,7 +83,7 @@ set twin [$stw test_get twin]
 
 # get things started
 gdb_cmd "break main"
-run_executable
+gdbtk_test_run
 
 # Test: srcwin-1.1
 # Desc: Check for something in source window
@@ -1112,60 +1106,31 @@ gdbtk_test srcwin-4.4 "Click on line to set BP" {
 # Test: srcwin-4.5
 # Desc: Continue till here popup
 gdbtk_test srcwin-4.5 "Continue till here popup" {
-  set r 
   set twin [$stw test_get twin]
 
-  # click mouse button 1 at index 12.1
+  # Get coordinates of line 12
   set b [$twin bbox 12.1]
-  if {![click $twin $b <ButtonPress-3>]} {
-    set r "Click failed on $b"
-  } else {
-  
-    # Hack. Just release the botton 10 pixels to the right and below
-    # where the press was.  This should select the first entry in the
-    # popup menu, "Continue to Here". This should be made more robust.
-    if {[llength $b] == 4} {
-      set x [expr [lindex $b 0] + [lindex $b 2] / 2 + 10]
-      set y [expr [lindex $b 1] + [lindex $b 3] / 2 + 10]
-      if {![click $twin [list $x $y 0 0] <ButtonRelease-3>]} {
-       set r "Click failed at $x $y"
-      } else {
-
-       # check for PC_TAG on the correct line
-       if {$r == 0} {
-         if {![catch {set z [$twin dump 1.0 end]}]} {
-           foreach {k v i} $z {
-             if {$k == "tagon"} {
-               if {$v == "PC_TAG"} {
-                 if {$i == "12.2"} {
-                   incr r
-                 } else {
-                   incr r 5
-                 }
-               }
-               if {$v == "STACK_TAG"} {incr r 10}
-               if {$v == "BROWSE_TAG"} {incr r 100}
-             } elseif {$k == "image"} {
-               switch $i {
-                 10.0 {incr r}
-                 12.0 {incr r}
-                 14.0 {incr r}
-                 default {incr r 1000}
-               }
-             }
-           }
-         } else {
-           set r -4
-         }
-       }
-      }
-    } else {
-      set r "Line 12.1 was not visible..."
-    }
-    # should have seen on PC_TAG at line 12, plus BP images at 10.0, 12.0 and 14.0
+  set y [expr {[lindex $b 1] + ([lindex $b 3] / 2)}]
+
+  # Continue to here
+  $stw continue_to_here $twin $y
+
+  # Where is the PC_TAG?
+  set pcs {}
+  set tags [$twin tag ranges PC_TAG]
+  foreach {start end} $tags {
+    lappend pcs [expr {int($start)}]
+  }
+
+  # Where are breakpoints?
+  set bps {}
+  set imgs [$twin dump -image 1.0 end]
+  foreach {foo bar line} $imgs {
+    lappend bps $line
   }
-  set r
-} {4}
+
+  list $pcs $bps
+} {12 {10.0 14.0}}
 
 # 5.1 balloon variables
 # Test: srcwin-5.1
@@ -1220,8 +1185,3 @@ gdbtk_test srcwin-6.1 "mixed mode disassembly of include file" {
 } {1}
 
 gdbtk_test_done
-
-# Local variables:
-# mode: tcl
-# change-log-default-name: "ChangeLog-gdbtk"
-# End:
index 014f438..17f838e 100644 (file)
@@ -38,16 +38,10 @@ global objdir srcdir
 #####                 #####
 
 # Load the test executable
-if {$tcl_platform(platform) == "windows"} {
-  set file [file join $objdir list.exe]
-} else {
-  set file [file join $objdir list]
-}
-
-# This isn't a test case, since if this fails, we're hosed.
-if {[catch {gdb_cmd "file $file" 1} t]} {
-  # an error occured loading the file
-  gdbtk_test_error "loading \"$file\": $t"
+set program [file join $objdir list]
+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"
 }
 
 set srcwin [ManagedWin::open SrcWin]
@@ -57,7 +51,7 @@ set statbar [$srcwin test_get _statbar]
 
 # get things started
 gdb_cmd "break main"
-run_executable
+gdbtk_test_run
 
 # Test: srcwin2-1.1
 # Desc: Check for something in source window
@@ -902,8 +896,3 @@ gdbtk_test srcwin2-4.2 "temporary BP" {
 } {3}
 
 gdbtk_test_done
-
-# Local variables:
-# mode: tcl
-# change-log-default-name: "ChangeLog-gdbtk"
-# End:
index c3edd13..cb888d2 100644 (file)
@@ -39,16 +39,10 @@ global objdir srcdir
 #####                 #####
 
 # Load the test executable
-if {$tcl_platform(platform) == "windows"} {
-  set file [file join $objdir list.exe]
-} else {
-  set file [file join $objdir list]
-}
-
-# This isn't a test case, since if this fails, we're hosed.
-if {[catch {gdb_cmd "file $file" 1} t]} {
-  # an error occured loading the file
-  gdbtk_test_error "loading \"$file\": $t"
+set program [file join $objdir list]
+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"
 }
 
 set srcwin [ManagedWin::open SrcWin]
@@ -58,7 +52,7 @@ set statbar [$srcwin test_get _statbar]
 
 # get things started
 gdb_cmd "break main"
-run_executable
+gdbtk_test_run
 
 # Test: srcwin3-1.1
 # Desc: Check for something in source window
@@ -793,8 +787,3 @@ gdbtk_test srcwin3-4.2 "temporary BP" {
 } {3}
 
 gdbtk_test_done
-
-# Local variables:
-# mode: tcl
-# change-log-default-name: "ChangeLog-gdbtk"
-# End: