From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24535 invoked by alias); 18 Oct 2013 21:36:55 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 24478 invoked by uid 89); 18 Oct 2013 21:36:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.6 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 18 Oct 2013 21:36:53 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r9IKneNn019738 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 18 Oct 2013 16:49:40 -0400 Received: from barimba.redhat.com (ovpn-113-54.phx2.redhat.com [10.3.113.54]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r9IKnbim002849; Fri, 18 Oct 2013 16:49:40 -0400 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH v2 05/17] fix up gdb.xml Date: Fri, 18 Oct 2013 21:36:00 -0000 Message-Id: <1382129374-18344-6-git-send-email-tromey@redhat.com> In-Reply-To: <1382129374-18344-1-git-send-email-tromey@redhat.com> References: <1382129374-18344-1-git-send-email-tromey@redhat.com> X-SW-Source: 2013-10/txt/msg00600.txt.bz2 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 \ " $arch " 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 \ " invalid " 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 . 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 {} $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