srcwin.exp   [plain text]


# Copyright 1999, 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 ../gdb.gdbtk/insight-support.exp

if {[gdbtk_initialize_display]} {
  if {$tracelevel} {
    strace $tracelevel
  }

  #
  # test source window
  #
  set prms_id 0
  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
  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]
  set all_results $results

  # move file with "main" out of the way
  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]
  set all_results [concat $all_results $results]

  # restore file
  file rename $s1.save $s1

  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."
  }
  # run slightly different set of tests
  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_done $all_results
}