From: Tom Tromey <tromey@redhat.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@redhat.com>
Subject: [PATCH v2 05/17] fix up gdb.xml
Date: Fri, 18 Oct 2013 21:36:00 -0000 [thread overview]
Message-ID: <1382129374-18344-6-git-send-email-tromey@redhat.com> (raw)
In-Reply-To: <1382129374-18344-1-git-send-email-tromey@redhat.com>
This fixes the gdb.xml tests to be parallel-safe.
* gdb.xml/tdesc-arch.exp: Use standard_output_file. Make
downloads conditional on remote host.
(set_arch): Likewise.
* gdb.xml/tdesc-regs.exp: Use gdb_remote_download.
(load_description): Use standard_output_file. Add "should_cd"
argument.
---
gdb/testsuite/gdb.xml/tdesc-arch.exp | 28 +++++++++++++++-----------
gdb/testsuite/gdb.xml/tdesc-regs.exp | 39 ++++++++++++++++++++++++++----------
2 files changed, 44 insertions(+), 23 deletions(-)
diff --git a/gdb/testsuite/gdb.xml/tdesc-arch.exp b/gdb/testsuite/gdb.xml/tdesc-arch.exp
index 5fde2ff..241ad28 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 tdesc-arch.xml ($which architecture)"
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
}
set_arch $arch1 first
set_arch $arch2 second
# Check an invalid architecture setting.
-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>invalid</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"]
+}
-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)"
set cmd "show architecture"
gdb_test $cmd \
"The target architecture is set automatically \\(currently $default_arch\\)" \
"$cmd (invalid architecture)"
-file delete "${subdir}/tdesc-arch.xml"
-remote_file host delete "tdesc-arch.xml"
+remote_file host delete $filename
diff --git a/gdb/testsuite/gdb.xml/tdesc-regs.exp b/gdb/testsuite/gdb.xml/tdesc-regs.exp
index 533812f..c0f4978 100644
--- a/gdb/testsuite/gdb.xml/tdesc-regs.exp
+++ b/gdb/testsuite/gdb.xml/tdesc-regs.exp
@@ -94,20 +94,27 @@ gdb_test "set tdesc file $srcdir/$subdir/single-reg.xml" \
# Copy the core registers into the objdir if necessary, so that they
# will be found by <xi:include>.
foreach src ${core-regs} {
- set file [remote_download host "$srcdir/../features/$regdir$src" "$src"]
+ set remote_filename($src) \
+ [gdb_remote_download host "$srcdir/../features/$regdir$src"]
}
-# Similarly, we need to copy files under test into the objdir.
-proc load_description { file errmsg } {
+# Similarly, we need to copy files under test into the objdir. If
+# SHOULD_CD is set, it causes the gdb under test to "cd" to the
+# directory holding the XML code. This should only be set once; so
+# the first call should use it and subsequent calls should not.
+proc load_description { file errmsg {should_cd 1} } {
global srcdir
global subdir
global gdb_prompt
global core-regs
global architecture
+ global remote_filename
- file delete "$subdir/regs.xml"
+ set regs_file [standard_output_file regs.xml]
+
+ file delete $regs_file
set ifd [open "$srcdir/$subdir/$file" r]
- set ofd [open "$subdir/regs.xml" w]
+ set ofd [open $regs_file w]
while {[gets $ifd line] >= 0} {
if {[regexp {<xi:include href="core-regs.xml"/>} $line]} {
if {! [string equal ${architecture} ""]} {
@@ -122,11 +129,18 @@ proc load_description { file errmsg } {
}
close $ifd
close $ofd
- remote_download host "$subdir/regs.xml" "regs.xml"
- file delete "$subdir/regs.xml"
+
+ if {[is_remote host]} {
+ set regs_file [remote_download host "$subdir/regs.xml" "regs.xml"]
+ }
+
+ if {$should_cd && ![is_remote host]} {
+ gdb_test "cd [file dirname $regs_file]" "Working directory .*" \
+ "cd to directory holding xml"
+ }
# Anchor the test output, so that error messages are detected.
- set cmd "set tdesc filename regs.xml"
+ set cmd "set tdesc filename [file tail $regs_file]"
set msg "set tdesc filename regs.xml - from $file"
set cmd_regex [string_to_regexp $cmd]
gdb_test_multiple $cmd $msg {
@@ -134,7 +148,10 @@ proc load_description { file errmsg } {
pass $msg
}
}
- remote_file host delete "regs.xml"
+
+ if {[is_remote host]} {
+ remote_file host delete "regs.xml"
+ }
}
load_description "extra-regs.xml" ""
@@ -150,10 +167,10 @@ gdb_test "ptype \$structreg.v4" "type = int8_t __attribute__ \\(\\(vector_size\\
gdb_test "ptype \$bitfields" \
"type = struct struct2 {\r\n *uint64_t f1 : 35;\r\n *uint64_t f2 : 1;\r\n}"
-load_description "core-only.xml" ""
+load_description "core-only.xml" "" 0
# The extra register from the previous description should be gone.
gdb_test "ptype \$extrareg" "type = void"
foreach src ${core-regs} {
- remote_file host delete "$src"
+ remote_file host delete $remote_filename($src)
}
--
1.8.1.4
next prev parent reply other threads:[~2013-10-18 21:36 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-18 20:49 [PATCH v2 00/17] test suite parallel safety Tom Tromey
2013-10-18 20:49 ` [PATCH v2 15/17] fix some "exec" tests Tom Tromey
2013-10-25 16:21 ` Pedro Alves
2013-10-25 16:39 ` Tom Tromey
2013-10-25 17:02 ` Pedro Alves
2013-10-18 20:49 ` [PATCH v2 09/17] update checkpoint test Tom Tromey
2013-10-18 20:49 ` [PATCH v2 02/17] fix some simple thinkos in the test suite Tom Tromey
2013-10-18 20:49 ` [PATCH v2 01/17] fix up log-file toggling Tom Tromey
2013-10-18 20:49 ` [PATCH v2 08/17] simple changes in gdb.base Tom Tromey
2013-10-18 20:49 ` [PATCH v2 03/17] fix weird.exp for parallel testing Tom Tromey
2013-10-18 20:49 ` [PATCH v2 06/17] fix up gdb.mi Tom Tromey
2013-10-18 20:49 ` [PATCH v2 07/17] fix up gdb.trace Tom Tromey
2013-10-25 16:22 ` Pedro Alves
2013-10-25 16:37 ` Tom Tromey
2013-10-18 20:49 ` [PATCH v2 12/17] fix up gdb.server Tom Tromey
2013-10-18 21:00 ` [PATCH v2 11/17] introduce relative_filename and use it Tom Tromey
2013-10-25 16:22 ` Pedro Alves
2013-10-25 16:42 ` Tom Tromey
2013-10-25 17:03 ` Pedro Alves
2013-10-28 19:01 ` Doug Evans
2013-10-28 20:10 ` Tom Tromey
2013-10-18 21:00 ` [PATCH v2 14/17] fix argv0-symlink.exp for parallel mode Tom Tromey
2013-10-18 21:11 ` [PATCH v2 17/17] switch to fully " Tom Tromey
2013-10-18 21:24 ` [PATCH v2 13/17] make gdb.asm parallel-safe Tom Tromey
2013-10-18 21:24 ` [PATCH v2 10/17] update fileio test Tom Tromey
2013-10-18 21:36 ` [PATCH v2 04/17] fix up gdb.gdb Tom Tromey
2013-10-18 21:36 ` Tom Tromey [this message]
2013-10-25 16:21 ` [PATCH v2 05/17] fix up gdb.xml Pedro Alves
2013-10-25 18:23 ` Tom Tromey
2013-10-18 21:44 ` [PATCH v2 16/17] fix some fission tests Tom Tromey
2013-10-25 16:23 ` [PATCH v2 00/17] test suite parallel safety Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1382129374-18344-6-git-send-email-tromey@redhat.com \
--to=tromey@redhat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).