aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2014-05-30 20:40:20 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2014-05-30 20:40:20 +0200
commit51db86a829cb328a78138283bafd8770f365a76b (patch)
tree8f457c027962d86cad1dda6b1bf3675333a079cb /gcc
parentb3f1051b11374792241ae7f72f015ce2325bb492 (diff)
downloadgcc-51db86a829cb328a78138283bafd8770f365a76b.zip
gcc-51db86a829cb328a78138283bafd8770f365a76b.tar.gz
gcc-51db86a829cb328a78138283bafd8770f365a76b.tar.bz2
target-libpath.exp (set_gcc_exec_prefix_env_var, [...]): New procedures.
* lib/target-libpath.exp (set_gcc_exec_prefix_env_var, restore_gcc_exec_prefix_env_var): New procedures. (set_ld_library_path_env_vars, restore_ld_library_path_env_vars): Use them. * lib/c-compat.exp: Load target-libpath.exp. (compat-use-alt-compiler): Call restore_gcc_exec_prefix_env_var. (compat-use-tst-compiler): Call set_gcc_exec_prefix_env_var. * g++.dg/compat/compat.exp (compat-use-alt-compiler): Call restore_gcc_exec_prefix_env_var. * g++.dg/compat/struct-layout-1.exp (compat-use-alt-compiler): Likewise. From-SVN: r211093
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog12
-rw-r--r--gcc/testsuite/g++.dg/compat/compat.exp1
-rw-r--r--gcc/testsuite/g++.dg/compat/struct-layout-1.exp1
-rw-r--r--gcc/testsuite/lib/c-compat.exp3
-rw-r--r--gcc/testsuite/lib/target-libpath.exp46
5 files changed, 50 insertions, 13 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 89cb55c..eea0c4f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,17 @@
2014-05-30 Jakub Jelinek <jakub@redhat.com>
+ * lib/target-libpath.exp (set_gcc_exec_prefix_env_var,
+ restore_gcc_exec_prefix_env_var): New procedures.
+ (set_ld_library_path_env_vars,
+ restore_ld_library_path_env_vars): Use them.
+ * lib/c-compat.exp: Load target-libpath.exp.
+ (compat-use-alt-compiler): Call restore_gcc_exec_prefix_env_var.
+ (compat-use-tst-compiler): Call set_gcc_exec_prefix_env_var.
+ * g++.dg/compat/compat.exp (compat-use-alt-compiler): Call
+ restore_gcc_exec_prefix_env_var.
+ * g++.dg/compat/struct-layout-1.exp (compat-use-alt-compiler):
+ Likewise.
+
* c-c++-common/asan/misalign-1.c: New test.
* c-c++-common/asan/misalign-2.c: New test.
diff --git a/gcc/testsuite/g++.dg/compat/compat.exp b/gcc/testsuite/g++.dg/compat/compat.exp
index 1a7cdb8..7fd77d7 100644
--- a/gcc/testsuite/g++.dg/compat/compat.exp
+++ b/gcc/testsuite/g++.dg/compat/compat.exp
@@ -55,6 +55,7 @@ proc compat-use-alt-compiler { } {
set ALWAYS_CXXFLAGS ""
set ld_library_path $alt_ld_library_path
set_ld_library_path_env_vars
+ restore_gcc_exec_prefix_env_var
}
}
diff --git a/gcc/testsuite/g++.dg/compat/struct-layout-1.exp b/gcc/testsuite/g++.dg/compat/struct-layout-1.exp
index 13211c2..0beb595 100644
--- a/gcc/testsuite/g++.dg/compat/struct-layout-1.exp
+++ b/gcc/testsuite/g++.dg/compat/struct-layout-1.exp
@@ -60,6 +60,7 @@ proc compat-use-alt-compiler { } {
set ALWAYS_CXXFLAGS ""
set ld_library_path $alt_ld_library_path
set_ld_library_path_env_vars
+ restore_gcc_exec_prefix_env_var
}
}
diff --git a/gcc/testsuite/lib/c-compat.exp b/gcc/testsuite/lib/c-compat.exp
index 95a1fb9..f5b461e 100644
--- a/gcc/testsuite/lib/c-compat.exp
+++ b/gcc/testsuite/lib/c-compat.exp
@@ -28,6 +28,7 @@ global compat_skip_list
# compilers for compatibility tests.
load_lib target-supports.exp
+load_lib target-libpath.exp
#
# compat-use-alt-compiler -- make the alternate compiler the default
@@ -47,6 +48,7 @@ proc compat-use-alt-compiler { } {
if { $compat_alt_color == 0 } then {
regsub -- "-fdiagnostics-color=never" $TEST_ALWAYS_FLAGS "" TEST_ALWAYS_FLAGS
}
+ restore_gcc_exec_prefix_env_var
}
}
@@ -64,6 +66,7 @@ proc compat-use-tst-compiler { } {
if { $compat_same_alt == 0 } then {
set GCC_UNDER_TEST $compat_save_gcc_under_test
set TEST_ALWAYS_FLAGS $compat_save_TEST_ALWAYS_FLAGS
+ set_gcc_exec_prefix_env_var
}
}
diff --git a/gcc/testsuite/lib/target-libpath.exp b/gcc/testsuite/lib/target-libpath.exp
index 1891088..175f3cd 100644
--- a/gcc/testsuite/lib/target-libpath.exp
+++ b/gcc/testsuite/lib/target-libpath.exp
@@ -28,6 +28,21 @@ set orig_gcc_exec_prefix_checked 0
#######################################
+# proc set_gcc_exec_prefix_env_var { }
+#######################################
+
+proc set_gcc_exec_prefix_env_var { } {
+ global TEST_GCC_EXEC_PREFIX
+ global env
+
+ # Set GCC_EXEC_PREFIX for the compiler under test to pick up files not in
+ # the build tree from a specified location (normally the install tree).
+ if [info exists TEST_GCC_EXEC_PREFIX] {
+ setenv GCC_EXEC_PREFIX "$TEST_GCC_EXEC_PREFIX"
+ }
+}
+
+#######################################
# proc set_ld_library_path_env_vars { }
#######################################
@@ -49,7 +64,6 @@ proc set_ld_library_path_env_vars { } {
global orig_ld_library_path_64
global orig_dyld_library_path
global orig_gcc_exec_prefix
- global TEST_GCC_EXEC_PREFIX
global env
# Save the original GCC_EXEC_PREFIX.
@@ -61,11 +75,7 @@ proc set_ld_library_path_env_vars { } {
set orig_gcc_exec_prefix_checked 1
}
- # Set GCC_EXEC_PREFIX for the compiler under test to pick up files not in
- # the build tree from a specified location (normally the install tree).
- if [info exists TEST_GCC_EXEC_PREFIX] {
- setenv GCC_EXEC_PREFIX "$TEST_GCC_EXEC_PREFIX"
- }
+ set_gcc_exec_prefix_env_var
# Setting the ld library path causes trouble when testing cross-compilers.
if { [is_remote target] } {
@@ -164,6 +174,22 @@ proc set_ld_library_path_env_vars { } {
}
#######################################
+# proc restore_gcc_exec_prefix_env_var { }
+#######################################
+
+proc restore_gcc_exec_prefix_env_var { } {
+ global orig_gcc_exec_prefix_saved
+ global orig_gcc_exec_prefix
+ global env
+
+ if { $orig_gcc_exec_prefix_saved } {
+ setenv GCC_EXEC_PREFIX "$orig_gcc_exec_prefix"
+ } elseif [info exists env(GCC_EXEC_PREFIX)] {
+ unsetenv GCC_EXEC_PREFIX
+ }
+}
+
+#######################################
# proc restore_ld_library_path_env_vars { }
#######################################
@@ -175,21 +201,15 @@ proc restore_ld_library_path_env_vars { } {
global orig_ld_library_path_32_saved
global orig_ld_library_path_64_saved
global orig_dyld_library_path_saved
- global orig_gcc_exec_prefix_saved
global orig_ld_library_path
global orig_ld_run_path
global orig_shlib_path
global orig_ld_library_path_32
global orig_ld_library_path_64
global orig_dyld_library_path
- global orig_gcc_exec_prefix
global env
- if { $orig_gcc_exec_prefix_saved } {
- setenv GCC_EXEC_PREFIX "$orig_gcc_exec_prefix"
- } elseif [info exists env(GCC_EXEC_PREFIX)] {
- unsetenv GCC_EXEC_PREFIX
- }
+ restore_gcc_exec_prefix_env_var
if { $orig_environment_saved == 0 } {
return