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]

Re: [RFC/A] testsuite/gdb.c++/ref-types.exp "cleanup"


Keith Seitz wrote:
> 
> Hi,
> 
> I will be submitting some additional tests to ref-types.exp in the next
> day or so, and I thought that it would be nice to clean up ref-types.exp a
> little beforehand.
> 
> The following "patch" (which is bigger than the file) uses gdb_test and
> gdb_test_exact when appropriate, and it cleans up some common tcl "errors"
> (not really syntax errors, but common syntax usages which are, umm,
> offensive).
> 
> I think this is much easier to read than the "normal" things that are done
> in the testsuite.
> 
> I have only tested this on linux native and solaris native. If more are
> required, just name them.
> 
> What do others think?

Oh boy!  Nit pick fest!   ;-)
[Thanks for doing this, Keith, you probably know more about
Tcl than the rest of us put together.]

> +gdb_test {print s} {.[0-9]* = -1} {print value of s}
> +gdb_test {ptype s} {type = short (int)?} {ptype s}

I'm just curious why these would not be:

   gdb_test "print s" ".[0-9]* = -1" "print value of s"
   gdb_test "ptype s" "type = short (int?)" "ptype s"

Seems like the use of quotes in this context is ubiquitous
throughout the rest of the testsuite.  Is there any reason
for switching to curly braces here?  Is consistancy good?

Also I agree with the suggestion by Fernando to make the pattern
"short( int)?".


> +set pattern {.[0-9]* = \(short (int)? &\) @}
> +append pattern "$hex: -1"
>  send_gdb "print rs\n"
>  gdb_expect {
> -    -re ".\[0-9\]* = \\(short &\\) @$hex: -1.*$gdb_prompt $" {
> -        pass "print value of rs"
> -    }
> -    -re ".\[0-9\]* = \\(short int &\\) @$hex: -1.*$gdb_prompt $" {
> -        pass "print value of rs"
> -    }
> -    -re ".*$gdb_prompt $" { fail "print value of rs" }
> -    timeout           { fail "(timeout) print value of rs" }
> -    eof { fail "print rs ($GDB dumped core) (FIXME)" ; gdb_start_again ; }
> -
> +  -re $pattern {
> +    pass "print value of rs"
>    }

Would it be possible to accomplish the same thing by 
combining the two "pass" regexps thusly?

	-re ".\[0-9\]* = \\(short( int)? &\) @$hex: -1.*$gdb_prompt $" {


Michael


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