summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.gdbtk/srcwin.exp
blob: c9267d805e32a80f8a9c4c64a4e49fd067764702 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# 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
}