This is the mail archive of the gdb-patches@sourceware.org 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]

Re: [rfa] gdb.base/volatile.exp / varargs.exp: replace send_gdb with gdb_test


For the record, Michael and I were discussing privately by email,
and one of the things I wrote was that he should feel free to commit
if he feels confident about his patches.  Since this can be relatively
mechanical, this should be relatively safe, and we can deal with
adjustments using followup patches...

> 2010-05-19  Michael Snyder  <msnyder@vmware.com>
> 
> 	* gdb.base/varargs.exp: Replace send_gdb with gdb_test.
> 	* gdb.base/volatile.exp: Replace send_gdb with gdb_test.

Some questions/suggestions...

> -send_gdb "set print sevenbit-strings\n" ; gdb_expect -re "$gdb_prompt $"
> -send_gdb "set print address off\n" ; gdb_expect -re "$gdb_prompt $"
> -send_gdb "set width 0\n" ; gdb_expect -re "$gdb_prompt $"
> +gdb_test "set print sevenbit-strings" "" \
> +    "set print sevenbit-strings; ${testfile}"
> +gdb_test "set print address off" "" \
> +    "set print address off; ${testfile}"
> +gdb_test "set width 0" "" \
> +    "set width 0; ${testfile}"

Just wondering why you added the "testfile" at the end of the test
description? It does not seem to serve any purpose, and so yo should
be able to simplify the above using:

> +gdb_test "set print sevenbit-strings" ""
> +gdb_test "set print address off" ""
> +gdb_test "set width 0" ""

You actually don't need to specify the second argument if it's empty,
but I think it's good practice to do so, just to show that we do indeed
expect the command to produce no output.  The fact that we cannot
currently verify that is a bit unfortunate, but at least the above
expresses it at the testsuite level...

> +gdb_test "print find_max1(5,1,2,3,4,5)" \
> +    "find_max\\(5, 1, 2, 3, 4, 5\\) returns 5\[ \r\n\]+.\[0-9\]+ = 5" \
> +    "print find_max1(5,1,2,3,4,5)"

If the test description simply repeats the command sent to GDB,
then it's not necessary to provide the third argument. gdb_test
does it automatically for you. Thus...

> +gdb_test "print find_max1(5,1,2,3,4,5)" \
> +    "find_max\\(5, 1, 2, 3, 4, 5\\) returns 5\[ \r\n\]+.\[0-9\]+ = 5"

... should give you the same result.

Generally speaking, my approach is becoming to use the command as
the description as long as it's not ambiguous for the testcase -
meaning that I don't use the same command twice in the same testcase.
There might be times where I'd want a specific description, but
that should be relatively rare...

-- 
Joel


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