This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] [RFC] sim: testsuite: support @vars@ in flags

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 {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]