Thomas Schwinge and Joseph convinced me that 'rootme' only makes sense
for in-tree testing and, hence, does not need (or: should not) be set in
site.exp.
Thus, if it is not set, we have to check its existence before using it –
to avoid similar TCL errors.
Hence, I updated the patch to check also for 'rootme'.
OK?
Tobias
On 10/19/20 11:46 AM, Tobias Burnus wrote:
In a --disable-libsanitizer build, I see errors such as:
g++.sum:ERROR: can't read "asan_saved_library_path": no such variable
I believe the following patch is the right way to solve this.
OK?
Tobias
-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander
Walter
testsuite: Avoid TCL errors when rootme or ASAN/TSAN/UBSAN is not avail
* g++.dg/guality/guality.exp:
* gcc.dg/guality/guality.exp:
* gfortran.dg/guality/guality.exp:
* lib/asan-dg.exp:
* lib/tsan-dg.exp:
* lib/ubsan-dg.exp:
gcc/testsuite/g++.dg/guality/guality.exp | 2 +-
gcc/testsuite/gcc.dg/guality/guality.exp | 2 +-
gcc/testsuite/gfortran.dg/guality/guality.exp | 2 +-
gcc/testsuite/lib/asan-dg.exp | 6 ++++--
gcc/testsuite/lib/tsan-dg.exp | 6 ++++--
gcc/testsuite/lib/ubsan-dg.exp | 6 ++++--
6 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/gcc/testsuite/g++.dg/guality/guality.exp b/gcc/testsuite/g++.dg/guality/guality.exp
index 33571f1f28f..1d5b65fef57 100644
--- a/gcc/testsuite/g++.dg/guality/guality.exp
+++ b/gcc/testsuite/g++.dg/guality/guality.exp
@@ -38,7 +38,7 @@ global GDB
if ![info exists ::env(GUALITY_GDB_NAME)] {
if [info exists GDB] {
set guality_gdb_name "$GDB"
- } elseif [file exists $rootme/../gdb/gdb] {
+ } elseif { [info exists rootme] && [file exists $rootme/../gdb/gdb] } {
# If we're doing a combined build, and gdb is available, use it.
set guality_gdb_name "$rootme/../gdb/gdb"
} else {
diff --git a/gcc/testsuite/gcc.dg/guality/guality.exp b/gcc/testsuite/gcc.dg/guality/guality.exp
index 89cd896d05c..ba87132aef2 100644
--- a/gcc/testsuite/gcc.dg/guality/guality.exp
+++ b/gcc/testsuite/gcc.dg/guality/guality.exp
@@ -38,7 +38,7 @@ global GDB
if ![info exists ::env(GUALITY_GDB_NAME)] {
if [info exists GDB] {
set guality_gdb_name "$GDB"
- } elseif [file exists $rootme/../gdb/gdb] {
+ } elseif { [info exists rootme] && [file exists $rootme/../gdb/gdb] } {
# If we're doing a combined build, and gdb is available, use it.
set guality_gdb_name "$rootme/../gdb/gdb"
} else {
diff --git a/gcc/testsuite/gfortran.dg/guality/guality.exp b/gcc/testsuite/gfortran.dg/guality/guality.exp
index eaa7ae770d6..0375edfffe4 100644
--- a/gcc/testsuite/gfortran.dg/guality/guality.exp
+++ b/gcc/testsuite/gfortran.dg/guality/guality.exp
@@ -19,7 +19,7 @@ global GDB
if ![info exists ::env(GUALITY_GDB_NAME)] {
if [info exists GDB] {
set guality_gdb_name "$GDB"
- } elseif [file exists $rootme/../gdb/gdb] {
+ } elseif { [info exists rootme] && [file exists $rootme/../gdb/gdb] } {
# If we're doing a combined build, and gdb is available, use it.
set guality_gdb_name "$rootme/../gdb/gdb"
} else {
diff --git a/gcc/testsuite/lib/asan-dg.exp b/gcc/testsuite/lib/asan-dg.exp
index 2124607245e..ce745dfdf8d 100644
--- a/gcc/testsuite/lib/asan-dg.exp
+++ b/gcc/testsuite/lib/asan-dg.exp
@@ -151,8 +151,10 @@ proc asan_finish { args } {
unset TEST_ALWAYS_FLAGS
}
}
- set ld_library_path $asan_saved_library_path
- set_ld_library_path_env_vars
+ if [info exists asan_saved_library_path ] {
+ set ld_library_path $asan_saved_library_path
+ set_ld_library_path_env_vars
+ }
clear_effective_target_cache
}
diff --git a/gcc/testsuite/lib/tsan-dg.exp b/gcc/testsuite/lib/tsan-dg.exp
index b5631a79bcf..6dcfd0a2f83 100644
--- a/gcc/testsuite/lib/tsan-dg.exp
+++ b/gcc/testsuite/lib/tsan-dg.exp
@@ -150,7 +150,9 @@ proc tsan_finish { args } {
} else {
unset dg-do-what-default
}
- set ld_library_path $tsan_saved_library_path
- set_ld_library_path_env_vars
+ if [info exists tsan_saved_library_path ] {
+ set ld_library_path $tsan_saved_library_path
+ set_ld_library_path_env_vars
+ }
clear_effective_target_cache
}
diff --git a/gcc/testsuite/lib/ubsan-dg.exp b/gcc/testsuite/lib/ubsan-dg.exp
index f4ab29e2add..31740e02ab4 100644
--- a/gcc/testsuite/lib/ubsan-dg.exp
+++ b/gcc/testsuite/lib/ubsan-dg.exp
@@ -141,7 +141,9 @@ proc ubsan_finish { args } {
unset TEST_ALWAYS_FLAGS
}
}
- set ld_library_path $ubsan_saved_library_path
- set_ld_library_path_env_vars
+ if [info exists ubsan_saved_library_path ] {
+ set ld_library_path $ubsan_saved_library_path
+ set_ld_library_path_env_vars
+ }
clear_effective_target_cache
}