From patchwork Tue Nov 10 06:46:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 9628 X-Patchwork-Delegate: vapier@gentoo.org Received: (qmail 115545 invoked by alias); 10 Nov 2015 06:46:47 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 115536 invoked by uid 89); 10 Nov 2015 06:46:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: smtp.gentoo.org Received: from smtp.gentoo.org (HELO smtp.gentoo.org) (140.211.166.183) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 10 Nov 2015 06:46:45 +0000 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id B4FD33403C1 for ; Tue, 10 Nov 2015 06:46:42 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH] [RFC] sim: testsuite: support @vars@ in flags Date: Tue, 10 Nov 2015 01:46:40 -0500 Message-Id: <1447138000-1961-1-git-send-email-vapier@gentoo.org> X-IsSubscribed: yes Sometimes in tests, we need supplemental files like linker scripts or board helper files. There's no way to set those flags in the tests currently and relative paths don't work (breaks out of tree builds). Update the main option parser to replace some strings on the fly. Now tests can do things like: # ld: -T@srcdir@/@subdir@/sample.ld I'm not sure if there's any precedence for things like this in the tree. 2015-11-10 Mike Frysinger * lib/sim-defs.exp (slurp_options): Pull in global subdir/srcdir. Replace @srcdir@ and @subdir@ in the read option. --- sim/testsuite/lib/sim-defs.exp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sim/testsuite/lib/sim-defs.exp b/sim/testsuite/lib/sim-defs.exp index 2faf5dc..918ec0b 100644 --- a/sim/testsuite/lib/sim-defs.exp +++ b/sim/testsuite/lib/sim-defs.exp @@ -423,6 +424,7 @@ proc run_sim_test { name requested_machs } { # Subroutine of run_sim_test to process options in FILE. proc slurp_options { file } { + global subdir srcdir if [catch { set f [open $file r] } x] { #perror "couldn't open `$file': $x" perror "$x" @@ -442,6 +444,10 @@ proc slurp_options { file } { # Whitespace here is space-tab. if [regexp $pat $line xxx opt_name opt_machs opt_val] { # match! + set opt_val [string map [list \ + {@srcdir@} "$srcdir" \ + {@subdir@} "$subdir" \ + ] "$opt_val"] lappend opt_array [list $opt_name $opt_machs $opt_val] set seen_opt 1 } else {