[PATCH 2/3] sim: cris: replace @srcdir@ test extension with $srcdir/$subdir

Mike Frysinger vapier@gentoo.org
Wed Nov 17 01:31:50 GMT 2021


The common framework supports $srcdir & $subdir replacements already,
so replace the custom @srcdir@ logic with those.  Since the replace
happens in slurp_options that cris already uses, we don't have any
logic to port over there.  We have to duplicate that into the cris
slurp_rv helper though.
---
 sim/testsuite/cris/c/c.exp                  |  2 --
 sim/testsuite/cris/c/openpf2.c              |  2 +-
 sim/testsuite/cris/hw/rv-n-cris/host1.ms    |  2 +-
 sim/testsuite/cris/hw/rv-n-cris/rvc.exp     | 10 +++++-----
 sim/testsuite/cris/hw/rv-n-cris/trivial4.ms |  2 +-
 sim/testsuite/cris/hw/rv-n-cris/trivial5.ms |  2 +-
 6 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/sim/testsuite/cris/c/c.exp b/sim/testsuite/cris/c/c.exp
index 8f39b097a0a9..e5b48661b63b 100644
--- a/sim/testsuite/cris/c/c.exp
+++ b/sim/testsuite/cris/c/c.exp
@@ -124,8 +124,6 @@ foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c]] {
 	# Replace specific substitutions:
 	# @exedir@ is where the test-program is located.
 	regsub -all "@exedir@" $opt_val "[pwd]" opt_val
-	# @srcdir@ is where the source of the test-program is located.
-	regsub -all "@srcdir@" $opt_val "$srcdir/$subdir" opt_val
 
 	# Multiple of these options concatenate, they don't override.
 	if { $opt_name == "output" || $opt_name == "progoptions" } {
diff --git a/sim/testsuite/cris/c/openpf2.c b/sim/testsuite/cris/c/openpf2.c
index 50337b110d4c..49f09b641ae4 100644
--- a/sim/testsuite/cris/c/openpf2.c
+++ b/sim/testsuite/cris/c/openpf2.c
@@ -1,5 +1,5 @@
 /* Check that the simulator has chdir:ed to the --sysroot argument
-#sim: --sysroot=@srcdir@
+#sim: --sysroot=$srcdir/$subdir
    (or that  --sysroot is applied to relative file paths).  */
 
 #include <stdio.h>
diff --git a/sim/testsuite/cris/hw/rv-n-cris/host1.ms b/sim/testsuite/cris/hw/rv-n-cris/host1.ms
index c41f51f1809b..78253942a0f2 100644
--- a/sim/testsuite/cris/hw/rv-n-cris/host1.ms
+++ b/sim/testsuite/cris/hw/rv-n-cris/host1.ms
@@ -3,6 +3,6 @@
 
 # Check that we trivially resolve a hostname.
 
-#r @,@srcdir@/trivial4.r
+#r @,$srcdir/$subdir/trivial4.r
 
  .include "trivial4.ms"
diff --git a/sim/testsuite/cris/hw/rv-n-cris/rvc.exp b/sim/testsuite/cris/hw/rv-n-cris/rvc.exp
index 4e302d2238fb..3d8b5c3813de 100644
--- a/sim/testsuite/cris/hw/rv-n-cris/rvc.exp
+++ b/sim/testsuite/cris/hw/rv-n-cris/rvc.exp
@@ -80,6 +80,7 @@ proc sim_has_rv_and_cris {} {
 # including parameters may not contain ":".
 
 proc slurp_rv { file } {
+    global subdir srcdir
     if [catch { set f [open $file r] } x] {
 	#perror "couldn't open `$file': $x"
 	perror "$x"
@@ -97,6 +98,10 @@ proc slurp_rv { file } {
 	# Whitespace here is space-tab.
 	if [regexp $pat $line xxx cmd] {
 	    # match!
+	    set cmd [string map [list \
+		{$srcdir} "$srcdir" \
+		{$subdir} "$subdir" \
+	    ] "$cmd"]
 	    lappend rv_array $cmd
 	    set seen_opt 1
 	} else {
@@ -204,11 +209,6 @@ if [istarget cris*-*-*] {
 		    error "$x"
 		} {
 		    set contents [join $hostcmds "\n"]
-
-		    # Make it possible to use files from the test
-		    # source directory; expected with the @-command.
-		    regsub -all "@srcdir@" $contents "$srcdir/$subdir" contents
-
 		    verbose "rv: $contents" 2
 		    puts $f $contents
 		    close $f
diff --git a/sim/testsuite/cris/hw/rv-n-cris/trivial4.ms b/sim/testsuite/cris/hw/rv-n-cris/trivial4.ms
index 6108160f962c..3259f3ee52e6 100644
--- a/sim/testsuite/cris/hw/rv-n-cris/trivial4.ms
+++ b/sim/testsuite/cris/hw/rv-n-cris/trivial4.ms
@@ -1,5 +1,5 @@
 #mach: crisv32
-#r @,@srcdir@/trivial4.r
+#r @,$srcdir/$subdir/trivial4.r
 
 # Test read and writes.
 
diff --git a/sim/testsuite/cris/hw/rv-n-cris/trivial5.ms b/sim/testsuite/cris/hw/rv-n-cris/trivial5.ms
index 849f17ebb450..c75e09fc6da0 100644
--- a/sim/testsuite/cris/hw/rv-n-cris/trivial5.ms
+++ b/sim/testsuite/cris/hw/rv-n-cris/trivial5.ms
@@ -11,6 +11,6 @@
 
 # Test trace output for read and write.
 
-#r @,@srcdir@/trivial4.r
+#r @,$srcdir/$subdir/trivial4.r
 
  .include "trivial4.ms"
-- 
2.33.0



More information about the Gdb-patches mailing list