[RFA] testsuite/gdb.base/maint.exp: Add relative pathname test and fix test for Cygwin

Andrew Cagney cagney@gnu.org
Wed Feb 9 14:54:00 GMT 2005


Corinna Vinschen wrote:
> Hi,
> 
> this patch adds a new test, which tests for the path problem described
> and patched in my posting to this list from 2005-01-24:
> 
>   http://sources.redhat.com/ml/gdb-patches/2005-01/msg00234.html
> 
> which still awaits approval.
> 
> The below patch adds a test for the added ability to handle relativ paths
> to object files.  It FAILs on current GDB but it PASSes with my patch to
> symmisc.c.

Looks good, just some refinement before committing ...

> This patch also tweaks maint.exp to get useful results also on Cygwin:
> 


> - So far, the "help maint dump-me" and "maint dump-me" tests are
>   marked XFAIL on Cygwin.  That's not necessary anymore, so I removed
>   the XFAIL settings.

Ya!

An audit of the entire testsuite/ pulling any other similar XFAILs would 
be treated as obvious ;-)

> - The timeout value is raised, because printing all the symbols and
>   statistical information about Cygwin and Windows libraries takes a lot
>   of time.

.... should be added here as a comment and made cygwin only.

> > +set oldtimeout $timeout
> +set timeout [expr $timeout + 500]
>  
>  send_gdb "maint print statistics\n"
>  gdb_expect  {
> @@ -316,6 +318,49 @@ gdb_expect  {
>          timeout         { fail "(timeout) maint print msymbols" }
>          }
>  
> +# Check that maint print msymbols allows relative pathnames
> +set mydir [pwd]

Can you change these new tests to use gdb_test_multiple, unlike 
gdb_send/gdb_expect, that handles internal errors, timeouts, and similar 
directly so is much more robust.  For indentation, I'd just use the style
	..... {
	    commands
	}

(yes I know the existing file is totally inconsistent in both those 
regards, lets get the new code right :-)

> +send_gdb "cd ${objdir}\n"
> +gdb_expect  {
> +	-re "Working directory ${objdir}\..*$gdb_prompt $" \
> +		{ pass "cd into objdir" }
> +	-re ".*$gdb_prompt $" \
> +		{ fail "cd into objdir" }
> +	timeout	{ fail "(timeout) cd into objdir" }
> +}
> +send_gdb "maint print msymbols msymbols_output ${subdir}/${testfile}\n"
> +gdb_expect  {
> +        -re "^maint print msymbols msymbols_output \[^\n\]*\r\n$gdb_prompt $"\
> +         {
> +          send_gdb "shell ls msymbols_output\n"
> +          gdb_expect {
> +                -re "msymbols_output\r\n$gdb_prompt $"\
> +                 {
> +                  send_gdb "shell grep factorial msymbols_output\n"
> +                  gdb_expect {
> +                        -re "\\\[ *$decimal\\\] T\[ \t\]+$hex factorial.*$gdb_prompt $"\
> +                                               { pass "maint print msymbols rel-path" }
> +                        -re ".*$gdb_prompt $"       { fail "maint print msymbols rel-path" }
> +                         timeout         { fail "(timeout) maint print msymbols rel-path" }
> +                         }
> +                  gdb_test "shell rm -f msymbols_output" ""
> +
> +                  }
> +                 -re ".*$gdb_prompt $"       { fail "maint print msymbols rel-path" }
> +                  timeout         { fail "(timeout) maint print msymbols rel-path" }
> +                  }
> +         }
> +        -re ".*$gdb_prompt $"       { fail "maint print msymbols rel-path" }
> +        timeout         { fail "(timeout) maint print msymbols rel-path" }
> +        }
> +send_gdb "cd ${mydir}\n"
> +gdb_expect  {
> +	-re "Working directory ${mydir}\..*$gdb_prompt $" \
> +		{ pass "cd into objdir" }
> +	-re ".*$gdb_prompt $" \
> +		{ fail "cd into objdir" }
> +	timeout	{ fail "(timeout) cd into objdir" }
> +}
>  
>  send_gdb "maint print symbols\n"
>  gdb_expect  {
> @@ -421,6 +466,7 @@ gdb_expect {
>  
>  # Test for new option: DATA section flag
>  # If your text section is tagged DATA, xfail this test.

Again with this ...

 > - The "maint info sections DATA" test is marked for XFAIL on Cygwin,
 >   because Windows has text sections marked DATA.

Andrew



More information about the Gdb-patches mailing list