This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH]: some testsuite fixes


Hi,
here are a set of cleanups for the testsuite.  Mostly they are tests
where we've forgotton to check some enabling variable.  The others are

* gdb.trace/collection.exp: Some of the checking regexps were not robust
enough for slightly different output.  Also, there's a race condition
with the use of gdb_run_cmd.  We need to wait until the breakpoint in 'begin'
is reached before trying to send the 'tstart' command.

* gdb.trace/tfind.exp:  There's a comment asking why the testcase is
optimized.  With gcc 3.4, if optimization is enabled, the leaf function is
inlined and the test fails.  So I think optimization is not a good idea.

ok?

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

2005-02-09  Nathan Sidwell  <nathan@codesourcery.com>

	* gdb.base/fileio.exp: Disable if gdb,noinferiorio.
	* gdb.base/sigbpt.exp: Disable if gdb,nosignals.
	* gdb.base/signull.exp: Disable if gdb,nosignals.
	* gdb.cp/bs15503.exp: Disable if skip_cplus_tests
	* gdb.cp/exception.exp: Disable if skip_cplus_tests.
	* gdb.mi/mi-console.exp: Disable hello test if gbd,noinferiorio.
	* gdb.mi/mi2-console.exp: Likewise.
	* gdb.trace/collection.exp (test_register): Robustify regexp.
	(run_trace_experiment): Consume the continue output at start.
	(gdb_collect_locals_test): Robustify regexp.
	* gdb.trace/passc-dyn.exp: Fix comment typo.
	* gdb.trace/tfind.exp: Don't enable optimization. Remove stray ']'.

Index: testsuite/gdb.base/fileio.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/fileio.exp,v
retrieving revision 1.7
diff -c -3 -p -r1.7 fileio.exp
*** testsuite/gdb.base/fileio.exp	18 Jan 2004 21:17:57 -0000	1.7
--- testsuite/gdb.base/fileio.exp	9 Feb 2005 13:20:19 -0000
*************** if [target_info exists gdb,nofileio] {
*** 25,30 ****
--- 25,35 ----
      continue
  }
  
+ if [target_info exists gdb,noinferiorio] {
+     verbose "Skipping fileio.exp because of no inferior stdout capabilities."
+     continue
+ }
+ 
  if $tracelevel then {
          strace $tracelevel
  }
Index: testsuite/gdb.base/sigbpt.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/sigbpt.exp,v
retrieving revision 1.3
diff -c -3 -p -r1.3 sigbpt.exp
*** testsuite/gdb.base/sigbpt.exp	8 Jul 2004 14:19:21 -0000	1.3
--- testsuite/gdb.base/sigbpt.exp	9 Feb 2005 13:20:20 -0000
***************
*** 29,34 ****
--- 29,39 ----
  # instruction.  Since the kernel problems can be "fixed" using
  # software single-step this is KFAILed rather than XFAILed.
  
+ if [target_info exists gdb,nosignals] {
+     verbose "Skipping signals.exp because of nosignals."
+     continue
+ }
+ 
  if $tracelevel {
      strace $tracelevel
  }
Index: testsuite/gdb.base/signull.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/signull.exp,v
retrieving revision 1.3
diff -c -3 -p -r1.3 signull.exp
*** testsuite/gdb.base/signull.exp	13 Jul 2004 13:44:01 -0000	1.3
--- testsuite/gdb.base/signull.exp	9 Feb 2005 13:20:21 -0000
***************
*** 28,33 ****
--- 28,38 ----
  
  # This also tests backtrace/gdb1476.
  
+ if [target_info exists gdb,nosignals] {
+     verbose "Skipping signals.exp because of nosignals."
+     continue
+ }
+ 
  if $tracelevel {
      strace $tracelevel
  }
Index: testsuite/gdb.cp/bs15503.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/bs15503.exp,v
retrieving revision 1.3
diff -c -3 -p -r1.3 bs15503.exp
*** testsuite/gdb.cp/bs15503.exp	8 Jan 2004 09:41:15 -0000	1.3
--- testsuite/gdb.cp/bs15503.exp	9 Feb 2005 13:20:21 -0000
*************** if $tracelevel {
*** 22,27 ****
--- 22,29 ----
      strace $tracelevel
  }
  
+ if { [skip_cplus_tests] } { continue }
+ 
  set testfile "bs15503"
  set srcfile ${testfile}.cc
  set binfile ${objdir}/${subdir}/${testfile}
Index: testsuite/gdb.cp/exception.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/exception.exp,v
retrieving revision 1.5
diff -c -3 -p -r1.5 exception.exp
*** testsuite/gdb.cp/exception.exp	11 Feb 2004 14:01:25 -0000	1.5
--- testsuite/gdb.cp/exception.exp	9 Feb 2005 13:20:22 -0000
*************** if $tracelevel then {
*** 42,47 ****
--- 42,49 ----
      strace $tracelevel
  }
  
+ if { [skip_cplus_tests] } { continue }
+ 
  set testfile "exception"
  set srcfile ${testfile}.cc
  set binfile ${objdir}/${subdir}/${testfile}
Index: testsuite/gdb.mi/mi-console.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-console.exp,v
retrieving revision 1.12
diff -c -3 -p -r1.12 mi-console.exp
*** testsuite/gdb.mi/mi-console.exp	9 Aug 2004 16:32:44 -0000	1.12
--- testsuite/gdb.mi/mi-console.exp	9 Feb 2005 13:20:23 -0000
*************** gdb_expect {
*** 64,86 ****
      }
  }
  
! gdb_expect {
!     -re "@\"H\"\r\n.*@\"e\"\r\n.*@\"l\"\r\n.*@\"l\"\r\n.*@\"o\"\r\n.*@\" \"\r\n.*@\"\\\\\\\\\"\r\n.*@\"\\\\\"\"\r\n.*@\"!\"\r\n.*@\"\\\\r\"\r\n.*@\"\\\\n\"\r\n" {
! 	pass "Hello message"
!     }
!     -re "Hello" {
  
! 	# Probably a native system where GDB doesn't have direct
! 	# control over the inferior console.
! 	# For this to work, GDB would need to run the inferior process
! 	# under a PTY and then use the even-loops ability to wait on
! 	# multiple event sources to channel the output back through the
! 	# MI.
  
! 	kfail "gdb/623" "Hello message"
!     }
!     timeout {
! 	fail "Hello message (timeout)"
      }
  }
      
--- 64,88 ----
      }
  }
  
! if { ![target_info exists gdb,noinferiorio]}  {
!     gdb_expect {
! 	-re "@\"H\"\r\n.*@\"e\"\r\n.*@\"l\"\r\n.*@\"l\"\r\n.*@\"o\"\r\n.*@\" \"\r\n.*@\"\\\\\\\\\"\r\n.*@\"\\\\\"\"\r\n.*@\"!\"\r\n.*@\"\\\\r\"\r\n.*@\"\\\\n\"\r\n" {
! 	    pass "Hello message"
! 	}
! 	-re "Hello" {
  
! 	    # Probably a native system where GDB doesn't have direct #
! 	    # control over the inferior console.  # For this to work,
! 	    # GDB would need to run the inferior process # under a PTY
! 	    # and then use the even-loops ability to wait on #
! 	    # multiple event sources to channel the output back
! 	    # through the # MI.
  
! 	    kfail "gdb/623" "Hello message"
! 	}
! 	timeout {
! 	    fail "Hello message (timeout)"
! 	}
      }
  }
      
Index: testsuite/gdb.mi/mi2-console.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi2-console.exp,v
retrieving revision 1.2
diff -c -3 -p -r1.2 mi2-console.exp
*** testsuite/gdb.mi/mi2-console.exp	9 Aug 2004 22:21:54 -0000	1.2
--- testsuite/gdb.mi/mi2-console.exp	9 Feb 2005 13:20:23 -0000
*************** gdb_expect {
*** 64,89 ****
      }
  }
  
! gdb_expect {
!     -re "@\"H\"\r\n.*@\"e\"\r\n.*@\"l\"\r\n.*@\"l\"\r\n.*@\"o\"\r\n.*@\" \"\r\n.*@\"\\\\\\\\\"\r\n.*@\"\\\\\"\"\r\n.*@\"!\"\r\n.*@\"\\\\r\"\r\n.*@\"\\\\n\"\r\n" {
! 	pass "Hello message"
!     }
!     -re "Hello" {
! 
! 	# Probably a native system where GDB doesn't have direct
! 	# control over the inferior console.
! 	# For this to work, GDB would need to run the inferior process
! 	# under a PTY and then use the even-loops ability to wait on
! 	# multiple event sources to channel the output back through the
! 	# MI.
  
! 	kfail "gdb/623" "Hello message"
!     }
!     timeout {
! 	fail "Hello message (timeout)"
      }
  }
!     
  gdb_expect {
      -re "47\\*stopped.*$mi_gdb_prompt$" {
  	pass "Finished step over hello"
--- 64,91 ----
      }
  }
  
! if { ![target_info exists gdb,noinferiorio] } {
!     gdb_expect {
! 	-re "@\"H\"\r\n.*@\"e\"\r\n.*@\"l\"\r\n.*@\"l\"\r\n.*@\"o\"\r\n.*@\" \"\r\n.*@\"\\\\\\\\\"\r\n.*@\"\\\\\"\"\r\n.*@\"!\"\r\n.*@\"\\\\r\"\r\n.*@\"\\\\n\"\r\n" {
! 	    pass "Hello message"
! 	}
! 	-re "Hello" {
! 	    
! 	    # Probably a native system where GDB doesn't have direct #
! 	    # control over the inferior console.  # For this to work,
! 	    # GDB would need to run the inferior process # under a PTY
! 	    # and then use the even-loops ability to wait on #
! 	    # multiple event sources to channel the output back
! 	    # through the # MI.
  
! 	    kfail "gdb/623" "Hello message"
! 	}
! 	timeout {
! 	    fail "Hello message (timeout)"
! 	}
      }
  }
! 
  gdb_expect {
      -re "47\\*stopped.*$mi_gdb_prompt$" {
  	pass "Finished step over hello"
Index: testsuite/gdb.trace/collection.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.trace/collection.exp,v
retrieving revision 1.2
diff -c -3 -p -r1.2 collection.exp
*** testsuite/gdb.trace/collection.exp	6 Mar 2001 08:22:00 -0000	1.2
--- testsuite/gdb.trace/collection.exp	9 Feb 2005 13:20:25 -0000
*************** proc test_register { reg test_id } {
*** 63,72 ****
  
      send_gdb "print $reg\n"
      gdb_expect {
! 	-re "\\$\[0-9\]+ = \[x0\]+$cr$gdb_prompt " {
  	    fail "collect $test_id: collected $reg (zero)"
  	}
! 	-re "\\$\[0-9\]+ = \[x0-9a-fA-F\]+$cr$gdb_prompt " {
  	    pass "collect $test_id: collected $reg"
  	}
  	-re "\[Ee\]rror.*$gdb_prompt " {
--- 63,72 ----
  
      send_gdb "print $reg\n"
      gdb_expect {
! 	-re "\\$\[0-9\]+ = (\\(\[a-z_0-9\]+ \\*\\) )?0x0+$cr$gdb_prompt " {
  	    fail "collect $test_id: collected $reg (zero)"
  	}
! 	-re "\\$\[0-9\]+ = (\\(\[a-z_0-9\]+ \\*\\) )?0x\[0-9a-fA-F\]+$cr$gdb_prompt " {
  	    pass "collect $test_id: collected $reg"
  	}
  	-re "\[Ee\]rror.*$gdb_prompt " {
*************** proc test_register { reg test_id } {
*** 79,85 ****
  }
  
  proc run_trace_experiment { msg test_func } {
!     gdb_run_cmd 
      gdb_test "tstart" \
  	    "\[\r\n\]+" \
  	    "collect $msg: start trace experiment"
--- 79,96 ----
  }
  
  proc run_trace_experiment { msg test_func } {
!     global gdb_prompt
!     gdb_run_cmd
!     gdb_expect {
! 	-re ".*Breakpoint \[0-9\]+, begin .*$gdb_prompt $" { 
! 	}
! 	-re ".*$gdb_prompt $" { 
! 	    fail "collect $msg: advance to go"
! 	}
! 	timeout { 
! 	    fail "collect $msg: advance to go (timeout)"
! 	}
!     }
      gdb_test "tstart" \
  	    "\[\r\n\]+" \
  	    "collect $msg: start trace experiment"
*************** proc gdb_collect_locals_test { func mylo
*** 280,286 ****
      run_trace_experiment $msg $func
  
      gdb_test "print locc" \
! 	    "\\$\[0-9\]+ = 11 '.013'$cr" \
  	    "collect $msg: collected local char"
      gdb_test "print loci" \
  	    "\\$\[0-9\]+ = 12$cr" \
--- 291,297 ----
      run_trace_experiment $msg $func
  
      gdb_test "print locc" \
! 	"\\$\[0-9\]+ = 11 '.\[a-z0-7\]+'$cr" \
  	    "collect $msg: collected local char"
      gdb_test "print loci" \
  	    "\\$\[0-9\]+ = 12$cr" \
Index: testsuite/gdb.trace/passc-dyn.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.trace/passc-dyn.exp,v
retrieving revision 1.2
diff -c -3 -p -r1.2 passc-dyn.exp
*** testsuite/gdb.trace/passc-dyn.exp	6 Mar 2001 08:22:00 -0000	1.2
--- testsuite/gdb.trace/passc-dyn.exp	9 Feb 2005 13:20:25 -0000
*************** gdb_reinitialize_dir $srcdir/$subdir
*** 66,72 ****
  # We generously give ourselves one "pass" if we successfully 
  # detect that this test cannot be run on this target!
  if { ![gdb_target_supports_trace] } then {
!     pass "Current target does not supporst trace"
      return 1;
  
  }
--- 66,72 ----
  # We generously give ourselves one "pass" if we successfully 
  # detect that this test cannot be run on this target!
  if { ![gdb_target_supports_trace] } then {
!     pass "Current target does not support trace"
      return 1;
  
  }
Index: testsuite/gdb.trace/tfind.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.trace/tfind.exp,v
retrieving revision 1.3
diff -c -3 -p -r1.3 tfind.exp
*** testsuite/gdb.trace/tfind.exp	23 Dec 2002 00:02:02 -0000	1.3
--- testsuite/gdb.trace/tfind.exp	9 Feb 2005 13:20:26 -0000
*************** if [istarget "m68k-*-elf"] then {
*** 54,65 ****
      set srcfile ${testfile}.c
      set binfile $objdir/$subdir/$testfile
  
-     # Why does this test require '-O1' level optimization?  (In
-     # general, the optimization level should be left under the control
-     # of the test framework (target_list and so on), so if we don't
-     # have to override it in individual tests like this, we shouldn't.)
      if { [gdb_compile "$srcdir/$subdir/$srcfile" "$binfile" \
! 	    executable {debug additional_flags=-w optimize=-O1}] != "" } {
  	gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
      }
      gdb_load $binfile
--- 54,61 ----
      set srcfile ${testfile}.c
      set binfile $objdir/$subdir/$testfile
  
      if { [gdb_compile "$srcdir/$subdir/$srcfile" "$binfile" \
! 	    executable {debug additional_flags=-w}] != "" } {
  	gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
      }
      gdb_load $binfile
*************** gdb_tfind_test "8.13: tracepoint <no arg
*** 303,309 ****
  	"\$tracepoint" "$tdp1";
  gdb_test "printf \"x \%d x\\n\", \$trace_frame == \$save_frame" \
  	"x 0 x" \
! 	"8.13: tracepoint <no arg>, tracepoint number unchanged"]
  
  # 1.12 set tracepoint in prologue
  #
--- 299,305 ----
  	"\$tracepoint" "$tdp1";
  gdb_test "printf \"x \%d x\\n\", \$trace_frame == \$save_frame" \
  	"x 0 x" \
! 	"8.13: tracepoint <no arg>, tracepoint number unchanged"
  
  # 1.12 set tracepoint in prologue
  #

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]