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/testsuite] radix.exp: unique test names, kfail


This is a rewrite of gdb.base/radix.exp.

The major impetus is to make all the test names unique.
While I was in there, I used more proc's.

Also, I changed two setup_xfail to setup_kfail.

The KFAIL's are for this bug:

  http://sources.redhat.com/gdb/bugs/1715
  floating point values in non-decimal bases print wrong value

That is, if the input is base 10, and the output is hexadecimal,
then "print 20.0" should print "14".  But it actually prints "20".

Tested on native i686-pc-linux-gnu.

I'll give this 24 hours for comment, then commit it.

Michael C

2004-07-20  Michael Chastain  <mec.gnu@mindspring.com>

	Test for PR exp/1715.
	* gdb.base/radix.exp: Refactor common procedures.  Make all
	test names unique.  Change XFAIL to KFAIL.

Index: gdb.base/radix.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/radix.exp,v
retrieving revision 1.2
diff -c -3 -p -r1.2 radix.exp
*** gdb.base/radix.exp	6 Mar 2001 08:21:51 -0000	1.2
--- gdb.base/radix.exp	20 Jul 2004 22:55:55 -0000
***************
*** 1,4 ****
! # Copyright 1993, 1997 Free Software Foundation, 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
--- 1,5 ----
! # This testcase is part of GDB, the GNU debugger.
! # Copyright 1993, 1997, 2004 Free Software Foundation, 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
***************
*** 14,23 ****
  # 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 Fred Fish. (fnf@cygnus.com)
  
  if $tracelevel then {
  	strace $tracelevel
--- 15,22 ----
  # along with this program; if not, write to the Free Software
  # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
  
  # This file was written by Fred Fish. (fnf@cygnus.com)
+ # And rewritten by Michael Chastain (mec.gnu@mindspring.com)
  
  if $tracelevel then {
  	strace $tracelevel
*************** if $tracelevel then {
*** 26,201 ****
  set prms_id 0
  set bug_id 0
  
- proc test_input_radix_2 {} {
-     gdb_test "set radix" \
- 	"Input and output radices now set to decimal 10, hex a, octal 12." \
- 	"set radix #1"
-     gdb_test "set input-radix 2" \
- 	"Input radix now set to decimal 2, hex 2, octal 2."
-     gdb_test "show radix" \
- 	"Input radix set to decimal 2, hex 2, octal 2.\r\nOutput radix set to decimal 10, hex a, octal 12." \
- 	"show radix #1"
-     gdb_test "p 010"		"8"
-     gdb_test "p 20."		"20"
-     gdb_test "p (int) 20."	"20"
-     gdb_test "p 0xf"		"15"
-     gdb_test "p 10"		"2"
-     gdb_test "p -101"		"-5"
-     gdb_test "p 101"		"5"
-     gdb_test "p 10101"		"21"
-     gdb_test "p 4"		"Invalid number \"4\"\\."
-     gdb_test "p -2"		"Invalid number \"2\"\\."
- }
- 
- # Test input radix 3 (an non-typical radix)
- 
- proc test_input_radix_3 {} {
-     gdb_test "set radix" \
- 	"Input and output radices now set to decimal 10, hex a, octal 12." \
- 	"set radix #2"
-     gdb_test "set input-radix 3" \
- 	"Input radix now set to decimal 3, hex 3, octal 3."
-     gdb_test "show radix" \
- 	"Input radix set to decimal 3, hex 3, octal 3.\r\nOutput radix set to decimal 10, hex a, octal 12." \
- 	"show radix #2"
-     gdb_test "p 010"		"8"
-     gdb_test "p 20."		"20"
-     gdb_test "p (int) 20."	"20"
-     gdb_test "p 0xf"		"15"
-     gdb_test "p 10"		"3"
-     gdb_test "p 0"		"0"
-     gdb_test "p 1"		"1"
-     gdb_test "p 2"		"2"
-     gdb_test "p 10"		"3"
-     gdb_test "p 20"		"6"
-     gdb_test "p 100"		"9"
-     gdb_test "p -100"		"-9"
-     gdb_test "p 3"		"Invalid number \"3\"."
-     gdb_test "p 30"		"Invalid number \"30\"."
- }
- 
- proc test_input_radix_8 {} {
-     gdb_test "set radix" \
- 	"Input and output radices now set to decimal 10, hex a, octal 12." \
- 	"set radix #3"
-     gdb_test "set input-radix 8" \
- 	"Input radix now set to decimal 8, hex 8, octal 10."
-     gdb_test "show radix" \
- 	"Input radix set to decimal 8, hex 8, octal 10.\r\nOutput radix set to decimal 10, hex a, octal 12." \
- 	"set radix #3"
-     gdb_test "p 010"		"8"
-     gdb_test "p 20."		"20"
-     gdb_test "p (int) 20."	"20"
-     gdb_test "p 0xf"		"15"
-     gdb_test "p 10"		"8"
-     gdb_test "p 20"		"16"
-     gdb_test "p -20"		"-16"
-     gdb_test "p 100"		"64"
-     gdb_test "p 8"		"Invalid number \"8\"."
-     gdb_test "p -9"		"Invalid number \"9\"."
- }
- 
- proc test_input_radix_10 {} {
-     gdb_test "set radix" \
- 	"Input and output radices now set to decimal 10, hex a, octal 12." \
- 	"set radix #4"
-     gdb_test "set input-radix 10" \
- 	"Input radix now set to decimal 10, hex a, octal 12."
-     gdb_test "show radix" \
- 	"Input and output radices set to decimal 10, hex a, octal 12." \
- 	"show radix #4"
-     gdb_test "p 010"		"8"
-     gdb_test "p 20."		"20"
-     gdb_test "p (int) 20."	"20"
-     gdb_test "p 0xf"		"15"
-     gdb_test "p 10"		"10"
-     gdb_test "p -12"		"-12"
- }
- 
- proc test_input_radix_16 {} {
-     gdb_test "set radix" \
- 	"Input and output radices now set to decimal 10, hex a, octal 12." \
- 	"set radix #5"
-     gdb_test "set input-radix 16" \
- 	"Input radix now set to decimal 16, hex 10, octal 20."
-     gdb_test "show radix" \
- 	"Input radix set to decimal 16, hex 10, octal 20.\r\nOutput radix set to decimal 10, hex a, octal 12." \
- 	"show radix #5"
-     gdb_test "p 010"		"8"
-     gdb_test "p 20."		"20"
-     gdb_test "p (int) 20."	"20"
-     gdb_test "p 0xf"		"15"
-     gdb_test "p 10"		"16"
-     gdb_test "p 100"		"256"
- }
- 
- proc test_output_radix_8 {} {
-     gdb_test "set radix" \
- 	"Input and output radices now set to decimal 10, hex a, octal 12." \
- 	"set radix #6"
-     gdb_test "set output-radix 8" \
- 	"Output radix now set to decimal 8, hex 8, octal 10."
-     gdb_test "show radix" \
- 	"Input radix set to decimal 10, hex a, octal 12.\r\nOutput radix set to decimal 8, hex 8, octal 10." \
- 	"show radix #6"
-     gdb_test "p 010"		"010"
-     # FIXME:  If gdb can't handle float printing in different radices, it
-     # should at least warn once the first time that is attempted.
-     setup_xfail "*-*-*"
-     gdb_test "p 20."		"24"	"Float printing when output radix is 8"
-     gdb_test "p (int) 20."	"24"
-     gdb_test "p 0xf"		"17"
-     gdb_test "p 10"		"12"
-     gdb_test "p 100"		"144"
- }
- 
- proc test_output_radix_10 {} {
-     gdb_test "set radix" \
- 	"Input and output radices now set to decimal 10, hex a, octal 12." \
- 	"set radix #7"
-     gdb_test "set output-radix 10" \
- 	"Output radix now set to decimal 10, hex a, octal 12."
-     gdb_test "show radix" \
- 	"Input and output radices set to decimal 10, hex a, octal 12." \
- 	"show radix #7"
-     gdb_test "p 010"		"8"
-     gdb_test "p 20."		"20"
-     gdb_test "p (int) 20."	"20"
-     gdb_test "p 0xf"		"15"
-     gdb_test "p 10"		"10"
-     gdb_test "p 100"		"100"
- }
- 
- proc test_output_radix_16 {} {
-     gdb_test "set radix" \
- 	"Input and output radices now set to decimal 10, hex a, octal 12." \
- 	"set radix #8"
-     gdb_test "set output-radix 16" \
- 	"Output radix now set to decimal 16, hex 10, octal 20."
-     gdb_test "show radix" \
- 	"Input radix set to decimal 10, hex a, octal 12.\r\nOutput radix set to decimal 16, hex 10, octal 20." \
- 	"show radix #8"
-     gdb_test "p 010"		"8"
-     # FIXME:  If gdb can't handle float printing in different radices, it
-     # should at least warn once the first time that is attempted.
-     setup_xfail "*-*-*"
-     gdb_test "p 20."		"14"	"Float printing when output radix is 16"
-     gdb_test "p (int) 20."	"14"
-     gdb_test "p 0xf"		"f"
-     gdb_test "p 10"		"a"
-     gdb_test "p 100"		"64"
- }
- 
  # Start with a fresh gdb.
  
  gdb_exit
  gdb_start
  
! test_input_radix_2
! test_input_radix_3
! test_input_radix_8
! test_input_radix_10
! test_input_radix_16
! test_output_radix_8
! test_output_radix_10
! test_output_radix_16
--- 25,157 ----
  set prms_id 0
  set bug_id 0
  
  # Start with a fresh gdb.
  
  gdb_exit
  gdb_start
  
! # Test input radices.
! 
! proc test_one_input { iradix input output } {
!     gdb_test "print $input" "$output" \
! 	"print $input; expect $output; input radix $iradix"
! }
! 
! proc test_input_radix { iradix iradixhex iradixoctal } {
!     # set input-radix = $iradix, output-radix = ten
!     gdb_test "set radix" \
! 	"Input and output radices now set to decimal 10, hex a, octal 12." \
! 	"initialize radix, input radix $iradix"
!     gdb_test "set input-radix $iradix" \
! 	"Input radix now set to decimal $iradix, hex $iradixhex, octal $iradixoctal."
!     if { $iradix == 10 } then {
! 	gdb_test "show radix" \
! 	    "Input and output radices set to decimal 10, hex a, octal 12." \
! 	    "show radix, input radix $iradix"
!     } else {
! 	gdb_test "show radix" \
! 	    "Input radix set to decimal $iradix, hex $iradixhex, octal $iradixoctal.\r\nOutput radix set to decimal 10, hex a, octal 12." \
! 	    "show radix, input radix $iradix"
!     }
! 
!     # test constants with specific bases that do not use $iradix
!     test_one_input $iradix  "010"        "8"
!     test_one_input $iradix  "20."        "20"
!     test_one_input $iradix  "(int) 20."  "20"
!     test_one_input $iradix  "0xf"        "15"
! 
!     # test simple one-digit constants
!     test_one_input $iradix  "0"          "0"
!     test_one_input $iradix  "1"          "1"
!     test_one_input $iradix  "-1"          "-1"
! 
!     # test simple two-digit constants
!     test_one_input $iradix "10"          [expr $iradix]
!     test_one_input $iradix "11"          [expr $iradix + 1]
!     test_one_input $iradix "-10"         [expr 0 - $iradix]
!     test_one_input $iradix "-11"         [expr 0 - $iradix - 1]
! 
!     # test simple three-digit constants
!     test_one_input $iradix "100"         [expr $iradix * $iradix]
!     test_one_input $iradix "101"         [expr $iradix * $iradix + 1]
!     test_one_input $iradix "-100"        [expr 0 - $iradix * $iradix]
!     test_one_input $iradix "-101"        [expr 0 - $iradix * $iradix - 1]
! 
!     # test a five-digit constant
!     test_one_input $iradix  "10101"      \
! 	[expr $iradix * $iradix * $iradix * $iradix + $iradix * $iradix + 1]
! }
! 
! test_input_radix 2 "2" "2"
!     test_one_input 2  "4"   "Invalid number \"4\"\\."
!     test_one_input 2  "-2"  "Invalid number \"2\"\\."
! 
! test_input_radix 3 "3" "3"
!     test_one_input 3  "2"   "2"
!     test_one_input 3  "20"  "6"
!     test_one_input 3  "3"   "Invalid number \"3\"\\."
!     test_one_input 2  "30"  "Invalid number \"30\"\\."
! 
! test_input_radix 8 "8" "10"
!     test_one_input 8  "20"  "16"
!     test_one_input 8  "-20" "-16"
!     test_one_input 8  "8"   "Invalid number \"8\"."
!     test_one_input 8  "-9"  "Invalid number \"9\"."
! 
! test_input_radix 10 "a" "12"
!     test_one_input 10 "-12"  "-12"
! 
! test_input_radix 16 "10" "20"
! 
! # Test output radices.
! 
! proc test_one_output { oradix input output } {
!     gdb_test "print $input" "$output" \
! 	"print $input; expect $output; output radix $oradix"
! }
! 
! proc test_output_radix { oradix oradixhex oradixoctal } {
!     # set input-radix = ten, output-radix = $oradix
!     gdb_test "set radix" \
! 	"Input and output radices now set to decimal 10, hex a, octal 12." \
! 	"initialize radix, output radix $oradix"
!     gdb_test "set output-radix $oradix" \
! 	"Output radix now set to decimal $oradix, hex $oradixhex, octal $oradixoctal."
!     if { $oradix == 10 } then {
! 	gdb_test "show radix" \
! 	    "Input and output radices set to decimal 10, hex a, octal 12." \
! 	    "show radix, output radix $oradix"
!     } else {
! 	gdb_test "show radix" \
! 	    "Input radix set to decimal 10, hex a, octal 12.\r\nOutput radix set to decimal $oradix, hex $oradixhex, octal $oradixoctal." \
! 	    "show radix, output radix $oradix"
!     }
! 
!     # no standard tests for output radix
! }
! 
! test_output_radix 8 "8" "10"
!     test_one_output 8  "010"        "010"
!     test_one_output 8  "0xf"        "17"
!     test_one_output 8  "10"         "12"
!     test_one_output 8  "100"        "144"
!     setup_kfail *-*-* "gdb/1715"
!     test_one_output 8  "20."        "24"
!     test_one_output 8  "(int) 20."  "24"
! 
! test_output_radix 10 "a" "12"
!     test_one_output 10 "010"        "8"
!     test_one_output 10 "0xf"        "15"
!     test_one_output 10 "10"         "10"
!     test_one_output 10 "100"        "100"
!     test_one_output 10 "20."        "20"
!     test_one_output 10 "(int) 20."  "20"
! 
! test_output_radix 16 "10" "20"
!     test_one_output 16 "010"        "8"
!     test_one_output 16 "0xf"        "f"
!     test_one_output 16 "10"         "a"
!     test_one_output 16 "100"        "64"
!     setup_kfail *-*-* "gdb/1715"
!     test_one_output 16 "20."        "14"
!     test_one_output 16 "(int) 20."  "14"


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