From patchwork Tue Sep 1 14:04:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 52929 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by patches.linaro.org (Postfix) with ESMTPS id 1C8ED2127E for ; Tue, 1 Sep 2015 14:12:54 +0000 (UTC) Received: by lanb10 with SMTP id b10sf409013lan.3 for ; Tue, 01 Sep 2015 07:12:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mailing-list:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:sender :delivered-to:mime-version:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:x-original-sender :x-original-authentication-results; bh=bn0DoLs7qmHWFL47UUGZOavaU1mlOmTOJjDbv6gTik0=; b=jWbxPJrce3ndf1TREeG/JTTFHaUiJPtoekLyv4YY41AQQzTT6nUE5tR5RWm2Zxwzwx usBFhceY+NrkC99oP72e4CFb493/IZCPW99ukYb0cWUwZpPka9vC3BTLGNB2ohBJwbFM gUchPcZzL7ha5JTVhhWHlCPgM+DiDpuOgsaz3ioom/bxr4W46/vJB7W3HyVcqp55E7Q3 yqFhRlJC9I1nG7138cMFeldGT6BD06ypV69wpZfL73w/0zYHH9bXh01cg/0jmi4Jttjo dU12jJhDBC0UAdURNd23ITxofzl2wbhbTOlpTud0pt0xxWuGeVdYIQNJBarGl7CkHRbP yKRA== X-Gm-Message-State: ALoCoQmq/EIOAA4gQyBF7R2U7TNrgIy6r7tyl/2Wxfa6OUrtUczkSbGpAf6A4RUTeKR4KZxrQaia X-Received: by 10.180.100.71 with SMTP id ew7mr896409wib.0.1441116772556; Tue, 01 Sep 2015 07:12:52 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.43.136 with SMTP id w8ls567713lal.16.gmail; Tue, 01 Sep 2015 07:12:52 -0700 (PDT) X-Received: by 10.152.21.103 with SMTP id u7mr12773521lae.49.1441116772129; Tue, 01 Sep 2015 07:12:52 -0700 (PDT) Received: from mail-la0-x232.google.com (mail-la0-x232.google.com. [2a00:1450:4010:c03::232]) by mx.google.com with ESMTPS id f5si16509469laa.134.2015.09.01.07.12.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Sep 2015 07:12:52 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::232 as permitted sender) client-ip=2a00:1450:4010:c03::232; Received: by lamp12 with SMTP id p12so565284lam.0 for ; Tue, 01 Sep 2015 07:12:52 -0700 (PDT) X-Received: by 10.152.5.228 with SMTP id v4mr13481627lav.36.1441116772013; Tue, 01 Sep 2015 07:12:52 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.164.42 with SMTP id yn10csp566251lbb; Tue, 1 Sep 2015 07:12:49 -0700 (PDT) X-Received: by 10.66.219.163 with SMTP id pp3mr54343105pac.8.1441116769024; Tue, 01 Sep 2015 07:12:49 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id u15si30057679pdi.171.2015.09.01.07.12.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Sep 2015 07:12:48 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-406433-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 116502 invoked by alias); 1 Sep 2015 14:12:34 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 116492 invoked by uid 89); 1 Sep 2015 14:12:34 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-qk0-f182.google.com Received: from mail-qk0-f182.google.com (HELO mail-qk0-f182.google.com) (209.85.220.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 01 Sep 2015 14:12:32 +0000 Received: by qkcj187 with SMTP id j187so41118813qkc.2 for ; Tue, 01 Sep 2015 07:12:30 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.55.48.5 with SMTP id w5mr18186547qkw.94.1441116286882; Tue, 01 Sep 2015 07:04:46 -0700 (PDT) Received: by 10.140.96.71 with HTTP; Tue, 1 Sep 2015 07:04:46 -0700 (PDT) In-Reply-To: <14DA89C6-4F95-4A90-847A-6B6E6909475A@comcast.net> References: <14DA89C6-4F95-4A90-847A-6B6E6909475A@comcast.net> Date: Tue, 1 Sep 2015 16:04:46 +0200 Message-ID: Subject: Re: [testsuite] Clean up effective_target cache From: Christophe Lyon To: Mike Stump Cc: "gcc-patches@gcc.gnu.org" X-IsSubscribed: yes X-Original-Sender: christophe.lyon@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::232 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@gcc.gnu.org X-Google-Group-Id: 836684582541 On 25 August 2015 at 17:31, Mike Stump wrote: > On Aug 25, 2015, at 1:14 AM, Christophe Lyon wrote: >> Some subsets of the tests override ALWAYS_CXXFLAGS or >> TEST_ALWAYS_FLAGS and perform effective_target support tests using >> these modified flags. > >> This patch adds a new function 'clear_effective_target_cache', which >> is called at the end of every .exp file which overrides >> ALWAYS_CXXFLAGS or TEST_ALWAYS_FLAGS. > > So, a simple English directive somewhere that says, if one changes ALWAYS_CXXFLAGS or TEST_ALWAYS_FLAGS then they should do a clear_effective_target_cache at the end as the target cache can make decisions based upon the flags, and those decisions need to be redone when the flags change would be nice. > > I do wonder, do we need to reexamine when setting the flags? I’m thinking of a sequence like: non-thumb default, is_thumb, set flags (thumb), is_thumb. Anyway, safe to punt this until someone discovers it or is reasonable sure it happens. > > Anyway, all looks good. Ok. > Here is what I have committed (r227372). I updated the comment before clear_effective_target_cache, and copied the directive you suggested above. I also added a test to check if $et_prop_list exists before clearing (there were error messages otherwise). Christophe. >> However, I noticed that lib/g++.exp changes ALWAYS_CXXFLAGS, but does >> not appear to restore it. In doubt, I didn't change it. > > Yeah, I examined it. It seems like it might not matter, as anyone setting and unsetting would come in cleared, and if they didn’t, it should be roughly the same exact state, meaning, no clearing necessary. I think it is safe to punt this until someone finds a bug or can see a way that it would matter. I also don’t think it would hurt to clear, if someone wanted to refactor the code a bit and make the clearing and the cleanup a little more automatic. I’m thinking of a RAII style code in which the dtor runs the clear. Not sure if that is even possible in tcl. [ checking ] Nope, maybe not. Oh well. 2015-09-01 Christophe Lyon * lib/target-supports.exp (clear_effective_target_cache): New. (check_cached_effective_target): Update et_prop_list. * lib/asan-dg.exp (asan_finish): Call clear_effective_target_cache. * g++.dg/compat/compat.exp: Likewise. * g++.dg/compat/struct-layout-1.exp: Likewise. * lib/asan-dg.exp: Likewise. * lib/atomic-dg.exp: Likewise. * lib/cilk-plus-dg.exp: Likewise. * lib/clearcap.exp: Likewise. * lib/mpx-dg.exp: Likewise. * lib/tsan-dg.exp: Likewise. * lib/ubsan-dg.exp: Likewise. Index: gcc/testsuite/g++.dg/compat/compat.exp =================================================================== --- gcc/testsuite/g++.dg/compat/compat.exp (revision 227370) +++ gcc/testsuite/g++.dg/compat/compat.exp (working copy) @@ -78,6 +78,7 @@ proc compat-use-tst-compiler { } { set ALWAYS_CXXFLAGS $save_always_cxxflags set ld_library_path $save_ld_library_path set_ld_library_path_env_vars + clear_effective_target_cache } } Index: gcc/testsuite/g++.dg/compat/struct-layout-1.exp =================================================================== --- gcc/testsuite/g++.dg/compat/struct-layout-1.exp (revision 227370) +++ gcc/testsuite/g++.dg/compat/struct-layout-1.exp (working copy) @@ -61,6 +61,7 @@ proc compat-use-alt-compiler { } { set ld_library_path $alt_ld_library_path set_ld_library_path_env_vars restore_gcc_exec_prefix_env_var + clear_effective_target_cache } } Index: gcc/testsuite/lib/asan-dg.exp =================================================================== --- gcc/testsuite/lib/asan-dg.exp (revision 227370) +++ gcc/testsuite/lib/asan-dg.exp (working copy) @@ -138,6 +138,7 @@ proc asan_finish { args } { } set ld_library_path $asan_saved_library_path set_ld_library_path_env_vars + clear_effective_target_cache } # Symbolize lines like Index: gcc/testsuite/lib/atomic-dg.exp =================================================================== --- gcc/testsuite/lib/atomic-dg.exp (revision 227370) +++ gcc/testsuite/lib/atomic-dg.exp (working copy) @@ -101,4 +101,5 @@ proc atomic_finish { args } { } else { unset TEST_ALWAYS_FLAGS } + clear_effective_target_cache } Index: gcc/testsuite/lib/cilk-plus-dg.exp =================================================================== --- gcc/testsuite/lib/cilk-plus-dg.exp (revision 227370) +++ gcc/testsuite/lib/cilk-plus-dg.exp (working copy) @@ -101,4 +101,5 @@ proc cilkplus_finish { args } { } else { unset TEST_ALWAYS_FLAGS } + clear_effective_target_cache } Index: gcc/testsuite/lib/clearcap.exp =================================================================== --- gcc/testsuite/lib/clearcap.exp (revision 227370) +++ gcc/testsuite/lib/clearcap.exp (working copy) @@ -55,4 +55,5 @@ proc clearcap-finish { args } { } else { unset TEST_ALWAYS_FLAGS } + clear_effective_target_cache } Index: gcc/testsuite/lib/mpx-dg.exp =================================================================== --- gcc/testsuite/lib/mpx-dg.exp (revision 227370) +++ gcc/testsuite/lib/mpx-dg.exp (working copy) @@ -142,4 +142,5 @@ proc mpx_finish { args } { } set ld_library_path $mpx_saved_library_path set_ld_library_path_env_vars + clear_effective_target_cache } Index: gcc/testsuite/lib/target-supports.exp =================================================================== --- gcc/testsuite/lib/target-supports.exp (revision 227370) +++ gcc/testsuite/lib/target-supports.exp (working copy) @@ -117,6 +117,7 @@ proc current_target_name { } { proc check_cached_effective_target { prop args } { global et_cache + global et_prop_list set target [current_target_name] if {![info exists et_cache($prop,target)] @@ -124,12 +125,37 @@ proc check_cached_effective_target { pro verbose "check_cached_effective_target $prop: checking $target" 2 set et_cache($prop,target) $target set et_cache($prop,value) [uplevel eval $args] + lappend et_prop_list $prop + verbose "check_cached_effective_target cached list is now: $et_prop_list" 2 } set value $et_cache($prop,value) verbose "check_cached_effective_target $prop: returning $value for $target" 2 return $value } +# Clear effective-target cache. This is useful after testing +# effective-target features and overriding TEST_ALWAYS_FLAGS and/or +# ALWAYS_CXXFLAGS. +# If one changes ALWAYS_CXXFLAGS or TEST_ALWAYS_FLAGS then they should +# do a clear_effective_target_cache at the end as the target cache can +# make decisions based upon the flags, and those decisions need to be +# redone when the flags change. An example of this is the +# asan_init/asan_finish pair. + +proc clear_effective_target_cache { } { + global et_cache + global et_prop_list + + if {[info exists et_prop_list]} { + verbose "clear_effective_target_cache: $et_prop_list" 2 + foreach prop $et_prop_list { + unset et_cache($prop,value) + unset et_cache($prop,target) + } + unset et_prop_list + } +} + # Like check_compile, but delete the output file and return true if the # compiler printed no messages. proc check_no_compiler_messages_nocache {args} { Index: gcc/testsuite/lib/tsan-dg.exp =================================================================== --- gcc/testsuite/lib/tsan-dg.exp (revision 227370) +++ gcc/testsuite/lib/tsan-dg.exp (working copy) @@ -149,4 +149,5 @@ proc tsan_finish { args } { } set ld_library_path $tsan_saved_library_path set_ld_library_path_env_vars + clear_effective_target_cache } Index: gcc/testsuite/lib/ubsan-dg.exp =================================================================== --- gcc/testsuite/lib/ubsan-dg.exp (revision 227370) +++ gcc/testsuite/lib/ubsan-dg.exp (working copy) @@ -121,4 +121,5 @@ proc ubsan_finish { args } { } set ld_library_path $ubsan_saved_library_path set_ld_library_path_env_vars + clear_effective_target_cache }