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.
This commit is contained in:
Mike Frysinger 2021-11-16 20:21:59 -05:00
parent 927f25ebac
commit c2aad00a74
19 changed files with 18 additions and 20 deletions

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -1,4 +1,4 @@
/*
#sim: --sysroot=@exedir@
#sim: --sysroot=$pwd
*/
#include "hello.c"

View File

@ -1,4 +1,4 @@
/*
#sim: --sysroot=@exedir@ --load-vma
#sim: --sysroot=$pwd --load-vma
*/
#include "hello.c"

View File

@ -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"

View File

@ -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

View File

@ -1,5 +1,5 @@
/* Basic file operations, now *with* sysroot.
#sim: --sysroot=@exedir@
#sim: --sysroot=$pwd
*/
#define PREFIX "/"
#include "openpf3.c"

View File

@ -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>

View File

@ -1,6 +1,6 @@
/* Simulator options:
#notarget: cris*-*-elf
#sim: --sysroot=@exedir@
#sim: --sysroot=$pwd
*/
#define SYSROOTED 1
#include "readlink2.c"

View File

@ -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"

View File

@ -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"

View File

@ -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>

View File

@ -1,4 +1,4 @@
/* Simulator options:
#sim: --sysroot=@exedir@/
#sim: --sysroot=$pwd/
*/
#include "seek1.c"

View File

@ -1,5 +1,5 @@
/* Simulator options:
#sim: --sysroot=@exedir@
#sim: --sysroot=$pwd
*/
#include <sys/types.h>
#include <sys/stat.h>

View File

@ -1,6 +1,6 @@
/* Simulator options:
#notarget: cris*-*-elf
#sim: --sysroot=@exedir@
#sim: --sysroot=$pwd
*/
#include <sys/types.h>

View File

@ -1,5 +1,5 @@
/*
#sim: --sysroot=@exedir@
#sim: --sysroot=$pwd
#notarget: cris*-*-elf
*/
#define PREFIX "/"

View File

@ -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"]

View File

@ -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"]