public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [RFC] sim: testsuite: support @vars@ in flags
@ 2015-11-10  6:46 Mike Frysinger
  2015-11-20 15:36 ` Pedro Alves
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Frysinger @ 2015-11-10  6:46 UTC (permalink / raw)
  To: gdb-patches

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  <vapier@gentoo.org>

	* 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 {
-- 
2.6.2

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-11-20 19:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-10  6:46 [PATCH] [RFC] sim: testsuite: support @vars@ in flags Mike Frysinger
2015-11-20 15:36 ` Pedro Alves
2015-11-20 19:32   ` Mike Frysinger

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).