Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Corinna Vinschen <vinschen@redhat.com>
To: gdb-patches <gdb-patches@sources.redhat.com>
Subject: [PATCH]: testsuite/gdb.base/display.exp: Change nonportable floating point test
Date: Fri, 14 Sep 2001 03:16:00 -0000	[thread overview]
Message-ID: <20010914121636.C25339@cygbert.vinschen.de> (raw)

Hi,

the testsuite test display.exp contains a non-portable test for
displaying a floating point variable.  It's non-portable since
it uses the int variable `sum' to print it as a float:

	display.c:	int sum;

	display.exp:	disp/f sum

The result expected by the test is only generated by gdb when
sizeof(int) == sizeof(float) for that target. 

My following patch changes the test to use a real floating point
number for the test instead.  The additional 60 seconds of
timeout is needed since some simulated targets are very slow
in floating point arithmetic.

2001-09-14  Corinna Vinschen  <vinschen@redhat.com>

	* gdb.base/display.c (do_loops): Add float variable `f'.
	Increment f in loop.
	* gdb.base/display.exp: Increment timeout by 60 seconds.
	Change float display test to use variable `f'.

Index: display.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/testsuite/gdb.base/display.c,v
retrieving revision 1.2
diff -u -p -r1.2 display.c
--- display.c	1999/01/04 15:34:31	1.2
+++ display.c	2001/09/14 10:09:09
@@ -10,11 +10,11 @@ int do_loops()
     int i=0;
     int k=0;
     int j=0;
-    
+    float f=3.1415;
     for( i = 0; i < LOOP; i++ ) {
         for( j = 0; j < LOOP; j++ ) {
             for( k = 0; k < LOOP; k++ ) {
-                sum++;
+                sum++; f++;
             }
         }
     } 
Index: display.exp
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/testsuite/gdb.base/display.exp,v
retrieving revision 1.17
diff -u -p -r1.17 display.exp
--- display.exp	2001/03/26 19:55:24	1.17
+++ display.exp	2001/09/14 10:09:09
@@ -38,6 +38,11 @@ if [target_info exists gdb_stub] {
     gdb_step_for_stub;
 }
 
+# Preserve the old timeout, and set a new one that should be
+# sufficient to avoid timing out during this test.
+set oldtimeout $timeout
+set timeout [expr "$timeout + 60"]
+verbose "Timeout is now $timeout seconds" 2
 
 # use this to debug:
 #log_user 1
@@ -90,13 +95,13 @@ gdb_test "info disp" ".*There are no aut
 gdb_test "disp i" ".*1: i = 0.*" "display i"
 gdb_test "disp/x j" ".*2: /x j = 0x0.*" "display j"
 gdb_test "disp/i &k" ".*3: x/i &k  $hex:.*" "display &k"
-gdb_test "disp/f sum" ".*4: /f sum = 0.*" "display/f sum"
+gdb_test "disp/f f" ".*4: /f f = 3.1415*" "display/f f"
 gdb_test "disp/s &sum" ".*5: x/s &sum  $hex.*sum.:.*" "display/s &sum"
 
 # Hit the displays
 #
-gdb_test "cont" ".*\[Ww\]atchpoint 3: sum.*\[1-9\]*: x/s &sum.*\[1-9\]*: /f sum = 1.40129846e.45\r\n\[1-9\]*: x/i &k.*\r\n\[1-9\]*: /x j = 0x0\r\n\[1-9\]*: i = 0.*" "first disp"
-gdb_test "cont" ".*\[Ww\]atchpoint 3: sum.*\[1-9\]*: x/s &sum.*\[1-9\]*: /f sum = 2.80259693e.45\r\n\[1-9\]*: x/i &k.*\r\n\[1-9\]*: /x j = 0x0.*\[1-9\]*: i = 0.*" "second disp"
+gdb_test "cont" ".*\[Ww\]atchpoint 3: sum.*\[1-9\]*: x/s &sum.*\[1-9\]*: /f f = 3.1415\r\n\[1-9\]*: x/i &k.*\r\n\[1-9\]*: /x j = 0x0\r\n\[1-9\]*: i = 0.*" "first disp"
+gdb_test "cont" ".*\[Ww\]atchpoint 3: sum.*\[1-9\]*: x/s &sum.*\[1-9\]*: /f f = 4.1415\r\n\[1-9\]*: x/i &k.*\r\n\[1-9\]*: /x j = 0x0.*\[1-9\]*: i = 0.*" "second disp"
 
 gdb_test "enab  disp 6" ".*No display number 6..*" "catch err"
 gdb_test "disab disp 1" ".*" "disab disp 1"
@@ -104,9 +109,9 @@ gdb_test "disab disp 2" ".*" "disab disp
 gdb_test "enab disp 1"  ".*" "re-enab"
 gdb_test "enab disp 1"  ".*" "re-enab of enab"
 gdb_test "undisp 5"     ".*" "undisp"
-gdb_test "info disp"    ".*Auto-display expressions now in effect.*y  /f sum.*y  /1bi &k.*n  /x j.*y  i.*" "info disp"
+gdb_test "info disp"    ".*Auto-display expressions now in effect.*y  /f f.*y  /1bi &k.*n  /x j.*y  i.*" "info disp"
 
-gdb_test "cont" ".*\[Ww\]atch.*4.20389539e-45.*.*i = 0.*" "next hit"
+gdb_test "cont" ".*\[Ww\]atch.*5.1415.*.*i = 0.*" "next hit"
 
 send_gdb "undisp\n"
 gdb_expect {
@@ -202,4 +207,9 @@ gdb_test "print/a &&j" ".*A .* error in 
 # Done!
 #
 gdb_exit
+
+# Restore the preserved old timeout value.
+set timeout $oldtimeout
+verbose "Timeout is now $timeout seconds" 2
+
 return 0

Corinna

-- 
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
mailto:vinschen@redhat.com


             reply	other threads:[~2001-09-14  3:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-14  3:16 Corinna Vinschen [this message]
2001-09-17 13:10 ` Fernando Nasser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010914121636.C25339@cygbert.vinschen.de \
    --to=vinschen@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox