Patchwork [PING] Fix environment variables restoring in GCC testsuite.

login
register
mail settings
Submitter max
Date Sept. 1, 2014, 9:09 a.m.
Message ID <540437AF.8050503@partner.samsung.com>
Download mbox | patch
Permalink /patch/384722/
State New
Headers show

Comments

max - Sept. 1, 2014, 9:09 a.m.
Ping.

-Maxim
-------- Original Message --------
Subject: 	[PATCH] Fix environment variables restoring in GCC testsuite.
Date: 	Fri, 22 Aug 2014 14:39:16 +0400
From: 	Maxim Ostapenko <m.ostapenko@partner.samsung.com>
To: 	GCC Patches <gcc-patches@gcc.gnu.org>
CC: 	Yury Gribov <y.gribov@samsung.com>, Slava Garbuzov 
<v.garbuzov@samsung.com>



Hi,

When testing, I've noticed, that Asan-bootstrapped GCC should be
executed with ASAN_OPTIONS=detect_leaks=0 because of memory leaks in
GCC, reported by Leak Sanitizer.

When I ran Asan test on Asan-bootstrapped GCC, some of them fail with
memory leaks into GCC, even if Lsan is disabled. This caused by slightly
wrong logic in saving/restoring env variables functionality in
gcc-dg.exp (some tests override ASAN_OPTIONS and this env variable isn't
restored correcty).

This tiny patch seems to fix the issue.

Tested on x86_64-pc-linux-gnu.

Ok to commit?

-Maxim
Mike Stump - Sept. 2, 2014, 3:58 p.m.
> When I ran Asan test on Asan-bootstrapped GCC, some of them fail with
> memory leaks into GCC, even if Lsan is disabled. This caused by slightly
> wrong logic in saving/restoring env variables functionality in
> gcc-dg.exp (some tests override ASAN_OPTIONS and this env variable isn't
> restored correcty).

> Ok to commit?

Ok.  I’ll note there are 22 other places like this.
Jeff Law - Sept. 3, 2014, 6:58 p.m.
On 09/01/14 03:09, Maxim Ostapenko wrote:
> Subject:     [PATCH] Fix environment variables restoring in GCC testsuite.
> Date:     Fri, 22 Aug 2014 14:39:16 +0400
> From:     Maxim Ostapenko <m.ostapenko@partner.samsung.com>
> To:     GCC Patches <gcc-patches@gcc.gnu.org>
> CC:     Yury Gribov <y.gribov@samsung.com>, Slava Garbuzov
> <v.garbuzov@samsung.com>
>
>
>
> Hi,
>
> When testing, I've noticed, that Asan-bootstrapped GCC should be
> executed with ASAN_OPTIONS=detect_leaks=0 because of memory leaks in
> GCC, reported by Leak Sanitizer.
>
> When I ran Asan test on Asan-bootstrapped GCC, some of them fail with
> memory leaks into GCC, even if Lsan is disabled. This caused by slightly
> wrong logic in saving/restoring env variables functionality in
> gcc-dg.exp (some tests override ASAN_OPTIONS and this env variable isn't
> restored correcty).
>
> This tiny patch seems to fix the issue.
>
> Tested on x86_64-pc-linux-gnu.
>
> Ok to commit?
>
> -Maxim
>
>
>
>
> env_restore.diff
>
>
> gcc/testsuite/ChangeLog:
>
> 2014-09-01  Max Ostapenko<m.ostapenko@partner.samsung.com>
>
> 	* lib/gcc-dg.exp: Change pattern.
OK.
Jeff

Patch

gcc/testsuite/ChangeLog:

2014-09-01  Max Ostapenko  <m.ostapenko@partner.samsung.com>

	* lib/gcc-dg.exp: Change pattern.

diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index 3390caa..d438c05 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -295,8 +295,8 @@  proc set-target-env-var { } {
     foreach env_var $set_target_env_var {
 	set var [lindex $env_var 0]
 	set value [lindex $env_var 1]
-	if [info exists env($var)] {
-	    lappend saved_target_env_var [list $var 1 $env($var)]
+	if [info exists ::env($var)] {
+	    lappend saved_target_env_var [list $var 1 $::env($var)]
 	} else {
 	    lappend saved_target_env_var [list $var 0]
 	}