From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9101 invoked by alias); 17 Jul 2013 14:58:58 -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 8957 invoked by uid 89); 17 Jul 2013 14:58:57 -0000 X-Spam-SWARE-Status: No, score=-4.9 required=5.0 tests=AWL,BAYES_50,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RDNS_NONE,SPF_HELO_PASS,SPF_PASS,TW_BJ autolearn=no version=3.3.1 Received: from Unknown (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 17 Jul 2013 14:58:56 +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 r6HEwnun001967 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 17 Jul 2013 10:58:49 -0400 Received: from barimba.redhat.com (ovpn-113-128.phx2.redhat.com [10.3.113.128]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r6HEwl56012037; Wed, 17 Jul 2013 10:58:48 -0400 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 2/4] introduce parallel mode Date: Wed, 17 Jul 2013 14:59:00 -0000 Message-Id: <1374073124-23602-3-git-send-email-tromey@redhat.com> In-Reply-To: <1374073124-23602-1-git-send-email-tromey@redhat.com> References: <1374073124-23602-1-git-send-email-tromey@redhat.com> X-SW-Source: 2013-07/txt/msg00386.txt.bz2 This introduces parallel mode for the test suite. It doesn't work yet -- there are many patches to go -- but it has to start somewhere, and it seemed bested to add some infrastructure now, so that you can follow along and test subsequent patches if you care to. This patch has two parts. First, it checks for the GDB_PARALLEL variable. If this is set (say, on the runtest command line), then the test suite assumes "parallel mode". In this mode, files are put into a subdirectory named after the test. That is, for DIR/TEST.exp, the outputs are put into ./outputs/DIR/TEST/. This first part has various follow-on changes coming in subsequent patches. This is why the code in this patch also makes "temp" and "cache" directories. Second, this adds an "inotify" mode. If you have the inotifywait command (part of inotify-tools), you can set the GDB_INOTIFY variable. This will tell the test suite to watch for changes outside of the allowed output directories. This mode is useful for debugging the test suite, as it issues a report whenever a possibly parallel-unsafe file open is done. * lib/gdb.exp: Handle GDB_PARALLEL and GDB_INOTIFY. (default_gdb_version): Kill inotify_pid if it exists. (standard_output_file): Respect GDB_PARALLEL. --- gdb/testsuite/lib/gdb.exp | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 1ca4354..b12f466 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -111,6 +111,12 @@ proc default_gdb_version {} { global GDB global INTERNAL_GDBFLAGS GDBFLAGS global gdb_prompt + global inotify_pid + + if {[info exists inotify_pid]} { + exec kill $inotify_pid + } + set output [remote_exec host "$GDB $INTERNAL_GDBFLAGS --version"] set tmp [lindex $output 1] set version "" @@ -3379,9 +3385,15 @@ proc default_gdb_init { args } { # the directory is returned. proc standard_output_file {basename} { - global objdir subdir + global objdir subdir gdb_test_file_name GDB_PARALLEL - return [file join $objdir $subdir $basename] + if {[info exists GDB_PARALLEL]} { + set dir [file join $objdir outputs $subdir $gdb_test_file_name] + file mkdir $dir + return [file join $dir $basename] + } else { + return [file join $objdir $subdir $basename] + } } # Set 'testfile', 'srcfile', and 'binfile'. @@ -4287,6 +4299,25 @@ if {[info exists TRANSCRIPT]} { } } +# If GDB_PARALLEL exists, then set up the parallel-mode directories. +if {[info exists GDB_PARALLEL]} { + file mkdir outputs temp cache + + # If GDB_INOTIFY is given, check for writes to '.'. This is a + # debugging tool to help confirm that the test suite is + # parallel-safe. You need "inotifywait" from the inotify-tools + # package to use this. + if {[info exists GDB_INOTIFY]} { + set exclusions {outputs temp gdb[.](log|sum) cache} + set exclusion_re ([join $exclusions |]) + + set inotify_pid [exec inotifywait -r -m -e move,create,delete . \ + --exclude $exclusion_re &] + # Wait for the watches; hopefully this is long enough. + sleep 2 + } +} + proc core_find {binfile {deletefiles {}} {arg ""}} { global objdir subdir -- 1.8.1.4