This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Bug 10645: small additions to existing testcase
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Dragos Tatulea <dragos dot tatulea at gmail dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 5 Aug 2010 00:57:28 +0200
- Subject: Re: [PATCH] Bug 10645: small additions to existing testcase
- References: <AANLkTikTv6zVVix6AHpX77x51_2p-CGuihY95VZf3-nk@mail.gmail.com> <AANLkTimgPBkpneh78XQwhboJHU7iPksTVeB=us4N8w2S@mail.gmail.com>
On Tue, 03 Aug 2010 10:11:09 +0200, Dragos Tatulea wrote:
> ---
> gdb/testsuite/gdb.base/watchpoint-hw-unreadable.c | 45 +++++++
> .../gdb.base/watchpoint-hw-unreadable.exp | 127 ++++++++++++++++++++
> 2 files changed, 172 insertions(+), 0 deletions(-)
> create mode 100644 gdb/testsuite/gdb.base/watchpoint-hw-unreadable.c
> create mode 100644 gdb/testsuite/gdb.base/watchpoint-hw-unreadable.exp
>
A GNU ChangeLog entry is missing.
> diff --git a/gdb/testsuite/gdb.base/watchpoint-hw-unreadable.c b/gdb/testsuite/gdb.base/watchpoint-hw-unreadable.c
> new file mode 100644
> index 0000000..887c293
> --- /dev/null
> +++ b/gdb/testsuite/gdb.base/watchpoint-hw-unreadable.c
> @@ -0,0 +1,45 @@
> +/* This testcase is part of GDB, the GNU debugger.
> +
> + Copyright 2009 Free Software Foundation, Inc.
^^^^ The date should include also 2010.
[...]
> diff --git a/gdb/testsuite/gdb.base/watchpoint-hw-unreadable.exp b/gdb/testsuite/gdb.base/watchpoint-hw-unreadable.exp
> new file mode 100644
> index 0000000..034972f
> --- /dev/null
> +++ b/gdb/testsuite/gdb.base/watchpoint-hw-unreadable.exp
> @@ -0,0 +1,127 @@
> +# Copyright 2009 Free Software Foundation, Inc.
^^^^ The date should include also 2010.
[...]
> +# Tests watchpoints.
> +# Input: Array of list containing the folowing elements:
> +# 1: W_NAME - watched var name
> +# 2: W_ID - watched var id
> +# 3: OLD_VAL - expected old val
> +# 4: NEW_VAL - expected new val
> +proc gdb_watch_test {arg_array} {
> + upvar $arg_array arg_arr
> + global test
> + global gdb_prompt
> +
> + set expect_output "\r\ninfrun: stopped by watchpoint\r\n.*"
> + foreach {k v} [array get arg_arr] {
> + set w_name [lindex $v 0]
> + set w_id [lindex $v 1]
> + set old_val [lindex $v 2]
> + set new_val [lindex $v 3]
> +
> + set expect_output "$expect_output\r\nHardware watchpoint $w_id: \\$w_name\[\r\n\]+Old value = $old_val\r\nNew value = $new_val"
> + }
> +
> + gdb_test_multiple "continue" $test {
> + -re "$expect_output.*$gdb_prompt $" {
> + #puts "PASS"
> + pass $test
> + }
> + default {
> + #puts "FAIL"
> + fail $test
> + return 0
> + }
I do not see why you could not use simple gdb_test here instead of
gdb_test_multiple.
[...]
> + || [target_info exists gdb,no_hardware_watchpoints]} then {
> + verbose "Skipping watchpoint-hw test."
^^^^^^^^^^^^^ This testfile is named differently.
[...]
> +gdb_test "set debug infrun 1"
^^^^^^^^ -> gdb_test_no_output nowadays.
Not an issue for this patch:
gdb_test could sanity check it must be given some expect string.
> +gdb_test "show debug infrun" "Inferior debugging is 1\\."
> +
> +gdb_test "watch *p" "ardware watchpoint 2: \\\*p"
> +gdb_test "watch **pp" "ardware watchpoint 3: \\\*\\\*pp"
> +set test "catch *p"
All the testcases generate:
PASS: gdb.base/watchpoint-hw-unreadable.exp: catch *p
PASS: gdb.base/watchpoint-hw-unreadable.exp: catch *p
PASS: gdb.base/watchpoint-hw-unreadable.exp: catch *p
The testcase names should be unique.
> +set c(0) [list *p 2 9 10]
> +set c(1) [list **pp 3 9 10]
> +gdb_watch_test c
> +unset c
Just such a qustion, maybe to simplify all the upvar, unset, set lines etc.
using just some?
gdb_watch_test {{*p 2 9 10} {**pp 3 9 10}}
Thanks,
Jan