From 927f25ebac00e225ed7ca88e45e2a98ddbdb122a Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 16 Nov 2021 20:16:18 -0500 Subject: [PATCH] sim: cris: replace @srcdir@ test extension with $srcdir/$subdir 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 8f39b097a0a..e5b48661b63 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 50337b110d4..49f09b641ae 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 diff --git a/sim/testsuite/cris/hw/rv-n-cris/host1.ms b/sim/testsuite/cris/hw/rv-n-cris/host1.ms index c41f51f1809..78253942a0f 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 4e302d2238f..3d8b5c3813d 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 6108160f962..3259f3ee52e 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 849f17ebb45..c75e09fc6da 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.30.2