Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: gdb-patches@sourceware.org
Subject: [_Complex test 3/4] Isolate each test's effect in callfuncs.exp
Date: Thu, 19 May 2011 04:46:00 -0000	[thread overview]
Message-ID: <4DD4A086.9030306@codesourcery.com> (raw)
In-Reply-To: <m3oc3bud5j.fsf@fleche.redhat.com>

[-- Attachment #1: Type: text/plain, Size: 473 bytes --]

When I was writing patch 4/4 in callfuncs.exp, a fatal fail will make
the rest of tests failed as well.

In this patch, some code is moved to proc rerun_and_prepare, which is
called some times at the beginning of each tests.  Also, fetch registers
before each test starts, and then, compare with the register state after
test is done.

This patch is not about _Complex type testing.  With this patch, test
result of patch 4/4 looks more reasonable.

-- 
Yao (齐尧)

[-- Attachment #2: 0003-prepare-for-test.patch --]
[-- Type: text/x-patch, Size: 4622 bytes --]

gdb/testsuite/

	* gdb.base/callfuncs.exp (rerun_and_prepare): New.
	Call rerun_and_prepare for each test to isolate effects.

From 461e0c6aac5ed689bae57f3995e073769288d235 Mon Sep 17 00:00:00 2001
From: Yao Qi <yao@codesourcery.com>
Date: Wed, 18 May 2011 23:12:18 +0800
Subject: [PATCH 3/4] prepare for test

---
 gdb/testsuite/gdb.base/callfuncs.exp |   82 ++++++++++++++++++++++------------
 1 files changed, 54 insertions(+), 28 deletions(-)

diff --git a/gdb/testsuite/gdb.base/callfuncs.exp b/gdb/testsuite/gdb.base/callfuncs.exp
index 27ebd1e..ff86eb8 100644
--- a/gdb/testsuite/gdb.base/callfuncs.exp
+++ b/gdb/testsuite/gdb.base/callfuncs.exp
@@ -273,6 +273,39 @@ proc fetch_all_registers {test} {
     return $all_registers_lines
 }
 
+proc rerun_and_prepare {} {
+    global hp_aCC_compiler
+
+    if { $hp_aCC_compiler } {
+	# Do not set language explicitly to 'C'.  This will cause aCC
+	# tests to fail because promotion rules are different.  Just let
+	# the language be set to the default.
+
+	if { ![runto_main] } {
+	    gdb_suppress_tests;
+	}
+
+	# However, turn off overload-resolution for aCC.  Having it on causes
+	# a lot of failures.
+
+	gdb_test_no_output "set overload-resolution 0"
+    } else {
+	gdb_test_no_output "set language c"
+	if { ![runto_main] } {
+	    gdb_suppress_tests;
+	}
+    }
+
+    get_debug_format
+
+    # Make sure that malloc gets called and that the floating point unit
+    # is initialized via a call to t_double_values.
+    gdb_test "next" "t_double_values\\(double_val1, double_val2\\);.*" \
+	"next to t_double_values"
+    gdb_test "next" "t_structs_c\\(struct_val1\\);.*" \
+	"next to t_structs_c"
+}
+
 
 # Start with a fresh gdb.
 
@@ -285,34 +318,7 @@ gdb_test_no_output "set print sevenbit-strings"
 gdb_test_no_output "set print address off"
 gdb_test_no_output "set width 0"
 
-if { $hp_aCC_compiler } {
-    # Do not set language explicitly to 'C'.  This will cause aCC
-    # tests to fail because promotion rules are different.  Just let
-    # the language be set to the default.
-
-    if { ![runto_main] } {
-	gdb_suppress_tests;
-    }
-
-    # However, turn off overload-resolution for aCC.  Having it on causes
-    # a lot of failures.
-
-    gdb_test_no_output "set overload-resolution 0"
-} else {
-    gdb_test_no_output "set language c"
-    if { ![runto_main] } {
-	gdb_suppress_tests;
-    }
-}
-
-get_debug_format
-
-# Make sure that malloc gets called and that the floating point unit
-# is initialized via a call to t_double_values.
-gdb_test "next" "t_double_values\\(double_val1, double_val2\\);.*" \
-  "next to t_double_values"
-gdb_test "next" "t_structs_c\\(struct_val1\\);.*" \
-  "next to t_structs_c"
+rerun_and_prepare
 
 # Save all register contents.
 set old_reg_content [fetch_all_registers "retrieve original register contents"]
@@ -330,6 +336,10 @@ if {$old_reg_content == $new_reg_content} then {
     fail "gdb function calls preserve register contents"
 }
 
+rerun_and_prepare
+# Save all register contents.
+set old_reg_content [fetch_all_registers "retrieve original register contents"]
+
 # Set breakpoint at a function we will call from gdb.
 gdb_breakpoint add
 
@@ -351,6 +361,12 @@ if ![gdb_test "bt 2" \
     }
 }
 
+rerun_and_prepare
+# Set breakpoint at a function we will call from gdb.
+gdb_breakpoint add
+# Save all register contents.
+set old_reg_content [fetch_all_registers "retrieve original register contents"]
+
 # Call function (causing a breakpoint hit in the call dummy) and do a finish,
 # make sure we are back at main and still have the same register contents.
 gdb_test "print add(4,5)" "The program being debugged stopped while.*" \
@@ -370,6 +386,12 @@ if ![gdb_test "bt 2" \
     }
 }
 
+rerun_and_prepare
+# Set breakpoint at a function we will call from gdb.
+gdb_breakpoint add
+# Save all register contents.
+set old_reg_content [fetch_all_registers "retrieve original register contents"]
+
 # Call function (causing a breakpoint hit in the call dummy) and do a return
 # with a value, make sure we are back at main with the same register contents.
 gdb_test "print add(4,5)" "The program being debugged stopped while.*" \
@@ -388,6 +410,10 @@ if ![gdb_test "return 7" \
     }
 }
 
+rerun_and_prepare
+# Set breakpoint at a function we will call from gdb.
+gdb_breakpoint add
+set old_reg_content [fetch_all_registers "retrieve original register contents"]
+
 # Call function (causing a breakpoint hit in the call dummy), and
 # call another function from the call dummy frame (thereby setting up
 # several nested call dummy frames).  Test that backtrace and finish
-- 
1.7.0.4


  parent reply	other threads:[~2011-05-19  4:46 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-06 14:13 [patch, testsuite] Tests to _Complex type Yao Qi
2011-05-06 14:33 ` Joseph S. Myers
2011-05-09  2:24   ` Yao Qi
2011-05-09 15:06     ` Tom Tromey
2011-05-19  4:26       ` [_Complex test 1/4] support_complex_tests in gdb.exp and pass _Complex args to func Yao Qi
2011-05-19  8:16         ` Mark Kettenis
2011-05-19 10:16           ` Joseph S. Myers
2011-05-19 13:26             ` Yao Qi
2011-05-19 17:10               ` Tom Tromey
2011-05-20  8:10                 ` Yao Qi
2011-05-26 17:07                   ` Tom Tromey
2011-05-30  2:53                     ` [committed] " Yao Qi
2011-05-19 13:01           ` Yao Qi
2011-05-19 13:24             ` Mark Kettenis
2011-05-19 13:38               ` Mark Kettenis
2011-05-19 10:12         ` Joseph S. Myers
2011-05-19  4:34       ` [_Complex test 2/4] _Complex type in varargs.exp Yao Qi
2011-05-19 10:13         ` Joseph S. Myers
2011-05-19 13:42           ` Yao Qi
2011-05-19 15:27             ` Joseph S. Myers
2011-05-20  9:09               ` Pedro Alves
2011-05-20 15:22               ` Yao Qi
2011-05-20 15:37                 ` Pedro Alves
2011-05-23  4:09                   ` Yao Qi
2011-05-23 10:27                     ` Pedro Alves
2011-05-30  2:55                       ` [committed] " Yao Qi
2011-05-19 17:12         ` Tom Tromey
2011-05-20  8:11           ` Yao Qi
2011-05-19  4:46       ` Yao Qi [this message]
2011-05-19 18:46         ` [_Complex test 3/4] Isolate each test's effect in callfuncs.exp Tom Tromey
2011-05-30  2:56           ` [committed] " Yao Qi
2011-05-19  5:09       ` [_Complex test 4/4] _Complex tests " Yao Qi
2011-05-20  8:17         ` Yao Qi
2011-05-24  1:46           ` [_Complex test 4/4 V3] " Yao Qi
2011-05-24  9:00             ` Mark Kettenis
2011-05-24  9:34               ` Yao Qi
2011-05-24 10:00                 ` Mark Kettenis
2011-05-24 13:54                   ` Yao Qi
2011-05-26 17:07         ` [_Complex test 4/4] " Tom Tromey
2011-05-30  2:57           ` [committed] " Yao Qi

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=4DD4A086.9030306@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    /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