aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-11-16 20:21:59 -0500
committerMike Frysinger <vapier@gentoo.org>2021-11-16 20:21:59 -0500
commitc2aad00a7447a32e1f4b0bd558a1bd2b13085381 (patch)
treef3223f0539737be3ee23b0cb4b11ea306802853e
parent927f25ebac00e225ed7ca88e45e2a98ddbdb122a (diff)
downloadgdb-c2aad00a7447a32e1f4b0bd558a1bd2b13085381.zip
gdb-c2aad00a7447a32e1f4b0bd558a1bd2b13085381.tar.gz
gdb-c2aad00a7447a32e1f4b0bd558a1bd2b13085381.tar.bz2
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.
-rw-r--r--sim/testsuite/cris/c/badldso3.c2
-rw-r--r--sim/testsuite/cris/c/c.exp4
-rw-r--r--sim/testsuite/cris/c/clone2.c2
-rw-r--r--sim/testsuite/cris/c/hellodyn.c2
-rw-r--r--sim/testsuite/cris/c/hellodyn2.c2
-rw-r--r--sim/testsuite/cris/c/hellodyn3.c2
-rw-r--r--sim/testsuite/cris/c/openpf1.c2
-rw-r--r--sim/testsuite/cris/c/openpf4.c2
-rw-r--r--sim/testsuite/cris/c/openpf5.c2
-rw-r--r--sim/testsuite/cris/c/readlink3.c2
-rw-r--r--sim/testsuite/cris/c/readlink6.c2
-rw-r--r--sim/testsuite/cris/c/readlink8.c2
-rw-r--r--sim/testsuite/cris/c/readlink9.c2
-rw-r--r--sim/testsuite/cris/c/seek2.c2
-rw-r--r--sim/testsuite/cris/c/stat3.c2
-rw-r--r--sim/testsuite/cris/c/stat4.c2
-rw-r--r--sim/testsuite/cris/c/truncate2.c2
-rw-r--r--sim/testsuite/cris/hw/rv-n-cris/rvc.exp1
-rw-r--r--sim/testsuite/lib/sim-defs.exp1
19 files changed, 18 insertions, 20 deletions
diff --git a/sim/testsuite/cris/c/badldso3.c b/sim/testsuite/cris/c/badldso3.c
index 9ff6d9a..f827e77 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 e5b4866..233ed85 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 e433a77..aaa0873 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 4a036cc..886818a 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 2a94ea4..47b5013 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 d21122f..4dd8bdd 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 e0d8e5c..fe767f7 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 d3fdcfe..b7ae810 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 1f86ea2..90bebe5 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 <stddef.h>
#include <stdlib.h>
diff --git a/sim/testsuite/cris/c/readlink3.c b/sim/testsuite/cris/c/readlink3.c
index 94cff72..d728087 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 52a26f4..d64b959 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 98319fb..ddc424e 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 2788054..7316b7a 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 <unistd.h>
diff --git a/sim/testsuite/cris/c/seek2.c b/sim/testsuite/cris/c/seek2.c
index 9c24dfb..65d9d24 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 a248ec0..fa9fcc1 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 <sys/types.h>
#include <sys/stat.h>
diff --git a/sim/testsuite/cris/c/stat4.c b/sim/testsuite/cris/c/stat4.c
index 62415a3..e524ac8 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 <sys/types.h>
diff --git a/sim/testsuite/cris/c/truncate2.c b/sim/testsuite/cris/c/truncate2.c
index a4c6470..f021ae8 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 3d8b5c3..ff3f757 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 7bc4c66..0ddc4d5 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"]