This is the mail archive of the gdb-cvs@sourceware.org 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]

[binutils-gdb] sim: testsuite: support basic vars in flags


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9bea4d16a6f009585841c1134a024d10a61b8d56

commit 9bea4d16a6f009585841c1134a024d10a61b8d56
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Mon Nov 9 01:14:57 2015 -0500

    sim: testsuite: support basic 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:
    
    Long term we'll want to switch the framework to use the dejagnu helpers
    like dg-xxx that gcc & gdb utilize.  But that'll require more rework.

Diff:
---
 sim/testsuite/ChangeLog        | 7 ++++++-
 sim/testsuite/lib/sim-defs.exp | 6 ++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/sim/testsuite/ChangeLog b/sim/testsuite/ChangeLog
index 509dc1f..e6525a9 100644
--- a/sim/testsuite/ChangeLog
+++ b/sim/testsuite/ChangeLog
@@ -1,6 +1,11 @@
+2015-11-14  Mike Frysinger  <vapier@gentoo.org>
+
+	* lib/sim-defs.exp (slurp_options): Pull in global subdir/srcdir.
+	Replace $srcdir and $subdir in the read option.
+
 2015-04-13  Hans-Peter Nilsson  <hp@axis.com>
 
-	* sim-defs.exp (sim_init): Unset target ldscript here.
+	* lib/sim-defs.exp (sim_init): Unset target ldscript here.
 
 2015-03-30  Mike Frysinger  <vapier@gentoo.org>
 
diff --git a/sim/testsuite/lib/sim-defs.exp b/sim/testsuite/lib/sim-defs.exp
index 2faf5dc..b8ce230 100644
--- a/sim/testsuite/lib/sim-defs.exp
+++ b/sim/testsuite/lib/sim-defs.exp
@@ -1,4 +1,5 @@
 # Simulator dejagnu utilities.
+# TODO: Switch to using dg-xxx helpers rather than parsing the files directly.
 
 # Communicate simulator path from sim_init to sim_version.
 # For some reason [board_info target sim] doesn't work in sim_version.
@@ -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]