From: Mike Frysinger Date: Wed, 17 Nov 2021 01:21:59 +0000 (-0500) Subject: sim: testsuite: add support for $pwd replacements X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c2aad00a7447a32e1f4b0bd558a1bd2b13085381;p=binutils-gdb.git sim: testsuite: add support for $pwd replacements Extend the common test framework to support $pwd replacements in settings. This allows replacing the custom cris @exedir@ with it. --- diff --git a/sim/testsuite/cris/c/badldso3.c b/sim/testsuite/cris/c/badldso3.c index 9ff6d9a7613..f827e771a9c 100644 --- a/sim/testsuite/cris/c/badldso3.c +++ b/sim/testsuite/cris/c/badldso3.c @@ -2,7 +2,7 @@ #notarget: cris*-*-elf #xerror: #cc: additional_flags=-Wl,-dynamic-linker,/compilercheck.x -#sim: --sysroot=@exedir@ +#sim: --sysroot=$pwd #output: *: could not load ELF interpreter `*' for program `*'\n */ #include "hello.c" diff --git a/sim/testsuite/cris/c/c.exp b/sim/testsuite/cris/c/c.exp index e5b48661b63..233ed853377 100644 --- a/sim/testsuite/cris/c/c.exp +++ b/sim/testsuite/cris/c/c.exp @@ -121,10 +121,6 @@ foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c]] { return } - # Replace specific substitutions: - # @exedir@ is where the test-program is located. - regsub -all "@exedir@" $opt_val "[pwd]" opt_val - # Multiple of these options concatenate, they don't override. if { $opt_name == "output" || $opt_name == "progoptions" } { set opt_val "$opts($opt_name)$opt_val" diff --git a/sim/testsuite/cris/c/clone2.c b/sim/testsuite/cris/c/clone2.c index e433a778b34..aaa0873b640 100644 --- a/sim/testsuite/cris/c/clone2.c +++ b/sim/testsuite/cris/c/clone2.c @@ -1,6 +1,6 @@ /* Make sure the thread system trivially works with trace output. #notarget: cris*-*-elf -#sim: --cris-trace=basic --trace-file=@exedir@/clone2.tmp +#sim: --cris-trace=basic --trace-file=$pwd/clone2.tmp #output: got: a\nthen: bc\nexit: 0\n */ #include "clone1.c" diff --git a/sim/testsuite/cris/c/hellodyn.c b/sim/testsuite/cris/c/hellodyn.c index 4a036cc4879..886818ad82c 100644 --- a/sim/testsuite/cris/c/hellodyn.c +++ b/sim/testsuite/cris/c/hellodyn.c @@ -1,4 +1,4 @@ /* -#sim: --sysroot=@exedir@ +#sim: --sysroot=$pwd */ #include "hello.c" diff --git a/sim/testsuite/cris/c/hellodyn2.c b/sim/testsuite/cris/c/hellodyn2.c index 2a94ea4824b..47b501372da 100644 --- a/sim/testsuite/cris/c/hellodyn2.c +++ b/sim/testsuite/cris/c/hellodyn2.c @@ -1,4 +1,4 @@ /* -#sim: --sysroot=@exedir@ --load-vma +#sim: --sysroot=$pwd --load-vma */ #include "hello.c" diff --git a/sim/testsuite/cris/c/hellodyn3.c b/sim/testsuite/cris/c/hellodyn3.c index d21122f73ea..4dd8bdd9e84 100644 --- a/sim/testsuite/cris/c/hellodyn3.c +++ b/sim/testsuite/cris/c/hellodyn3.c @@ -3,6 +3,6 @@ ld.so.cache (having no absolute path specified for the executable falls back on loading through the same mechanisms as a DSO). #notarget: *-*-elf -#sim: --sysroot=@exedir@ @exedir@/lib/ld.so.1 --library-path / +#sim: --sysroot=$pwd $pwd/lib/ld.so.1 --library-path / */ #include "hello.c" diff --git a/sim/testsuite/cris/c/openpf1.c b/sim/testsuite/cris/c/openpf1.c index e0d8e5c9140..fe767f71f37 100644 --- a/sim/testsuite/cris/c/openpf1.c +++ b/sim/testsuite/cris/c/openpf1.c @@ -1,5 +1,5 @@ /* Check that --sysroot is applied to open(2). -#sim: --sysroot=@exedir@ +#sim: --sysroot=$pwd We assume, with EXE being the name of the executable: - The simulator executes with cwd the same directory where the executable diff --git a/sim/testsuite/cris/c/openpf4.c b/sim/testsuite/cris/c/openpf4.c index d3fdcfe2f90..b7ae810d780 100644 --- a/sim/testsuite/cris/c/openpf4.c +++ b/sim/testsuite/cris/c/openpf4.c @@ -1,5 +1,5 @@ /* Basic file operations, now *with* sysroot. -#sim: --sysroot=@exedir@ +#sim: --sysroot=$pwd */ #define PREFIX "/" #include "openpf3.c" diff --git a/sim/testsuite/cris/c/openpf5.c b/sim/testsuite/cris/c/openpf5.c index 1f86ea283d4..90bebe509be 100644 --- a/sim/testsuite/cris/c/openpf5.c +++ b/sim/testsuite/cris/c/openpf5.c @@ -1,6 +1,6 @@ /* Check that TRT happens when error on too many opened files. #notarget: cris*-*-elf -#sim: --sysroot=@exedir@ +#sim: --sysroot=$pwd */ #include #include diff --git a/sim/testsuite/cris/c/readlink3.c b/sim/testsuite/cris/c/readlink3.c index 94cff727e38..d728087f1d5 100644 --- a/sim/testsuite/cris/c/readlink3.c +++ b/sim/testsuite/cris/c/readlink3.c @@ -1,6 +1,6 @@ /* Simulator options: #notarget: cris*-*-elf -#sim: --sysroot=@exedir@ +#sim: --sysroot=$pwd */ #define SYSROOTED 1 #include "readlink2.c" diff --git a/sim/testsuite/cris/c/readlink6.c b/sim/testsuite/cris/c/readlink6.c index 52a26f49639..d64b95913a3 100644 --- a/sim/testsuite/cris/c/readlink6.c +++ b/sim/testsuite/cris/c/readlink6.c @@ -1,5 +1,5 @@ /* Check that rare readlink calls don't cause the simulator to abort. #notarget: cris*-*-elf -#sim: --argv0 @exedir@/readlink6.c.x +#sim: --argv0 $pwd/readlink6.c.x */ #include "readlink2.c" diff --git a/sim/testsuite/cris/c/readlink8.c b/sim/testsuite/cris/c/readlink8.c index 98319fb4e34..ddc424e4c51 100644 --- a/sim/testsuite/cris/c/readlink8.c +++ b/sim/testsuite/cris/c/readlink8.c @@ -1,6 +1,6 @@ /* Check that rare readlink calls don't cause the simulator to abort. #notarget: cris*-*-elf -#sim: --sysroot=@exedir@ --env-unset PWD +#sim: --sysroot=$pwd --env-unset PWD */ #define SYSROOTED 1 #include "readlink2.c" diff --git a/sim/testsuite/cris/c/readlink9.c b/sim/testsuite/cris/c/readlink9.c index 27880543637..7316b7a9854 100644 --- a/sim/testsuite/cris/c/readlink9.c +++ b/sim/testsuite/cris/c/readlink9.c @@ -1,6 +1,6 @@ /* Check that odd cases of readlink work. #notarget: cris*-*-elf -#cc: additional_flags=-DX="@exedir@" +#cc: additional_flags=-DX="$pwd" */ #include diff --git a/sim/testsuite/cris/c/seek2.c b/sim/testsuite/cris/c/seek2.c index 9c24dfbdb08..65d9d2402da 100644 --- a/sim/testsuite/cris/c/seek2.c +++ b/sim/testsuite/cris/c/seek2.c @@ -1,4 +1,4 @@ /* Simulator options: -#sim: --sysroot=@exedir@/ +#sim: --sysroot=$pwd/ */ #include "seek1.c" diff --git a/sim/testsuite/cris/c/stat3.c b/sim/testsuite/cris/c/stat3.c index a248ec0864c..fa9fcc14b48 100644 --- a/sim/testsuite/cris/c/stat3.c +++ b/sim/testsuite/cris/c/stat3.c @@ -1,5 +1,5 @@ /* Simulator options: -#sim: --sysroot=@exedir@ +#sim: --sysroot=$pwd */ #include #include diff --git a/sim/testsuite/cris/c/stat4.c b/sim/testsuite/cris/c/stat4.c index 62415a340e8..e524ac87a8b 100644 --- a/sim/testsuite/cris/c/stat4.c +++ b/sim/testsuite/cris/c/stat4.c @@ -1,6 +1,6 @@ /* Simulator options: #notarget: cris*-*-elf -#sim: --sysroot=@exedir@ +#sim: --sysroot=$pwd */ #include diff --git a/sim/testsuite/cris/c/truncate2.c b/sim/testsuite/cris/c/truncate2.c index a4c6470d8c7..f021ae8ac99 100644 --- a/sim/testsuite/cris/c/truncate2.c +++ b/sim/testsuite/cris/c/truncate2.c @@ -1,5 +1,5 @@ /* -#sim: --sysroot=@exedir@ +#sim: --sysroot=$pwd #notarget: cris*-*-elf */ #define PREFIX "/" diff --git a/sim/testsuite/cris/hw/rv-n-cris/rvc.exp b/sim/testsuite/cris/hw/rv-n-cris/rvc.exp index 3d8b5c3813d..ff3f757e49d 100644 --- a/sim/testsuite/cris/hw/rv-n-cris/rvc.exp +++ b/sim/testsuite/cris/hw/rv-n-cris/rvc.exp @@ -99,6 +99,7 @@ proc slurp_rv { file } { if [regexp $pat $line xxx cmd] { # match! set cmd [string map [list \ + {$pwd} [pwd] \ {$srcdir} "$srcdir" \ {$subdir} "$subdir" \ ] "$cmd"] diff --git a/sim/testsuite/lib/sim-defs.exp b/sim/testsuite/lib/sim-defs.exp index 7bc4c66549e..0ddc4d556ab 100644 --- a/sim/testsuite/lib/sim-defs.exp +++ b/sim/testsuite/lib/sim-defs.exp @@ -447,6 +447,7 @@ proc slurp_options { file } { if [regexp $pat $line xxx opt_name opt_machs opt_val] { # match! set opt_val [string map [list \ + {$pwd} [pwd] \ {$srcdir} "$srcdir" \ {$subdir} "$subdir" \ ] "$opt_val"]