Re: [PATCH 05/13] fix up gdb.xml

Pedro Alves
2013-08-27T12:12:35Z

On 08/23/2013 09:36 PM, Tom Tromey wrote:
> diff --git a/gdb/testsuite/gdb.xml/tdesc-arch.exp b/gdb/testsuite/gdb.xml/tdesc-arch.exp
> index 5fde2ff..be0b9f1 100644
> --- a/gdb/testsuite/gdb.xml/tdesc-arch.exp
> +++ b/gdb/testsuite/gdb.xml/tdesc-arch.exp
> @@ -60,17 +60,20 @@ proc set_arch { arch which } {
> global gdb_prompt
> global subdir
>
> - set fd [open "$subdir/tdesc-arch.xml" w]
> + set filename [standard_output_file tdesc-arch.xml]
> + set fd [open $filename w]
> puts $fd \
> "<target>
> <architecture>$arch</architecture>
> </target>"
> close $fd
> - remote_download host "${subdir}/tdesc-arch.xml" "tdesc-arch.xml"
> + if {[is_remote host]} {
> + set filename [remote_download host $filename tdesc-arch.xml]
> + }
>
> # Anchor the test output, so that error messages are detected.
> - set cmd "set tdesc filename tdesc-arch.xml"
> - set msg "$cmd ($which architecture)"
> + set cmd "set tdesc filename $filename"
> + set msg "set tdesc filename ($which architecture)"

Should be:

set msg "set tdesc filename tdesc-arch.xml ($which architecture)"

> -set cmd "set tdesc filename tdesc-arch.xml"
> +set cmd "set tdesc filename $filename"
> gdb_test $cmd \
> "warning:.*Target description specified unknown architecture.*" \
> - "$cmd (invalid architecture)"
> + "set tdesc filename tdesc-arch.xml (invalid architecture)"

(Like here.)

> set cmd_regex [string_to_regexp $cmd]
> gdb_test_multiple $cmd $msg {
> -re "^$cmd_regex\r\n$gdb_prompt $" {
> @@ -86,31 +89,32 @@ proc set_arch { arch which } {
> "The target architecture is set automatically \\(currently $arch\\)" \
> "$cmd ($which architecture)"
>
> - file delete "${subdir}/tdesc-arch.xml"
> - remote_file host delete "tdesc-arch.xml"
> + remote_file host delete $filename

I noticed this seems to leave the build machine's copy
behind. Was that on purpose?

> }

> # Similarly, we need to copy files under test into the objdir.
> -proc load_description { file errmsg } {
> +proc load_description { file errmsg {should_cd 1} } {

Could you add a comment on the should_cd parameter please?
It's not obvious to me why a test should cd, while the other
shouldn't.

--
Pedro Alves