From bcd93c00abf72a5e820a32db5d9dd97603b407ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Dumont?= Date: Fri, 26 Nov 2010 21:29:01 +0100 Subject: [PATCH] libstdc++.exp [...]: Use remote_file delete for generated exe. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2010-11-26 François Dumont * testsuite/lib/libstdc++.exp [check_v3_target_debug_mode]: Use remote_file delete for generated exe. [check_v3_target_profile_mode] Add. * testsuite/lib/dg-options.exp [dg-require-profile-mode]: Add * testsuite/ext/profile/mh.cc, profiler_algos.cc, all.cc: Use dg-require-profile-mode, remove explicit _GLIBCXX_PROFILE definition. From-SVN: r167188 --- libstdc++-v3/ChangeLog | 9 ++++ libstdc++-v3/testsuite/ext/profile/all.cc | 5 +- libstdc++-v3/testsuite/ext/profile/mh.cc | 2 +- .../testsuite/ext/profile/profiler_algos.cc | 2 +- libstdc++-v3/testsuite/lib/dg-options.exp | 9 ++++ libstdc++-v3/testsuite/lib/libstdc++.exp | 52 ++++++++++++++++++- 6 files changed, 74 insertions(+), 5 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index dc22b52a12e..e61b7885b26 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,12 @@ +2010-11-26 François Dumont + + * testsuite/lib/libstdc++.exp [check_v3_target_debug_mode]: Use + remote_file delete for generated exe. [check_v3_target_profile_mode] + Add. + * testsuite/lib/dg-options.exp [dg-require-profile-mode]: Add + * testsuite/ext/profile/mh.cc, profiler_algos.cc, all.cc: Use + dg-require-profile-mode, remove explicit _GLIBCXX_PROFILE definition. + 2010-11-25 François Dumont * src/debug.cc: Introduce a mutex pool in get_safe_base_mutex. diff --git a/libstdc++-v3/testsuite/ext/profile/all.cc b/libstdc++-v3/testsuite/ext/profile/all.cc index 57a55cce61f..152901e01bb 100644 --- a/libstdc++-v3/testsuite/ext/profile/all.cc +++ b/libstdc++-v3/testsuite/ext/profile/all.cc @@ -1,5 +1,6 @@ -// { dg-options "-std=gnu++0x -O0 -D_GLIBCXX_PROFILE" } -// { dg-options "-std=gnu++0x -O0 -D_GLIBCXX_PROFILE -D_GLIBCXX_PROFILE_NO_THREADS" { target { ! tls_native } } } +// { dg-require-profile-mode "" } +// { dg-options "-std=gnu++0x -O0" } +// { dg-options "-std=gnu++0x -O0 -D_GLIBCXX_PROFILE_NO_THREADS" { target { ! tls_native } } } // { dg-do compile } // -*- C++ -*- diff --git a/libstdc++-v3/testsuite/ext/profile/mh.cc b/libstdc++-v3/testsuite/ext/profile/mh.cc index 1688ad5ae03..0de83edea85 100644 --- a/libstdc++-v3/testsuite/ext/profile/mh.cc +++ b/libstdc++-v3/testsuite/ext/profile/mh.cc @@ -1,4 +1,4 @@ -// { dg-options "-D_GLIBCXX_PROFILE" } +// { dg-require-profile-mode "" } // { dg-do compile { target *-*-linux* } } // { dg-xfail-if "" { uclibc } { "*" } { "" } } diff --git a/libstdc++-v3/testsuite/ext/profile/profiler_algos.cc b/libstdc++-v3/testsuite/ext/profile/profiler_algos.cc index 5963ceeefd8..37dfbfee27c 100644 --- a/libstdc++-v3/testsuite/ext/profile/profiler_algos.cc +++ b/libstdc++-v3/testsuite/ext/profile/profiler_algos.cc @@ -1,4 +1,4 @@ -// { dg-options "-D_GLIBCXX_PROFILE" } +// { dg-require-profile-mode "" } // -*- C++ -*- diff --git a/libstdc++-v3/testsuite/lib/dg-options.exp b/libstdc++-v3/testsuite/lib/dg-options.exp index e8d7f3452ae..b75f516c41f 100644 --- a/libstdc++-v3/testsuite/lib/dg-options.exp +++ b/libstdc++-v3/testsuite/lib/dg-options.exp @@ -35,6 +35,15 @@ proc dg-require-debug-mode { args } { return } +proc dg-require-profile-mode { args } { + if { ![ check_v3_target_profile_mode ] } { + upvar dg-do-what dg-do-what + set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] + return + } + return +} + proc dg-require-normal-mode { args } { if { ![ check_v3_target_normal_mode ] } { upvar dg-do-what dg-do-what diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp index 36b6e864f10..d94abfd8b60 100644 --- a/libstdc++-v3/testsuite/lib/libstdc++.exp +++ b/libstdc++-v3/testsuite/lib/libstdc++.exp @@ -935,7 +935,7 @@ proc check_v3_target_debug_mode { } { if [string match "" $lines] { # No error message, compilation succeeded. - file delete $exe + remote_file build delete $exe set et_debug_mode 1 } } @@ -943,6 +943,56 @@ proc check_v3_target_debug_mode { } { return $et_debug_mode } +proc check_v3_target_profile_mode { } { + global et_profile_mode + global tool + + if { ![info exists et_profile_mode_target_name] } { + set et_profile_mode_target_name "" + } + + # If the target has changed since we set the cached value, clear it. + set current_target [current_target_name] + if { $current_target != $et_profile_mode_target_name } { + verbose "check_v3_target_profile_mode: `$et_profile_mode_target_name'" 2 + set et_profile_mode_target_name $current_target + if [info exists et_profile_mode] { + verbose "check_v3_target_profile_mode: removing cached result" 2 + unset et_profile_mode + } + } + + if [info exists et_profile_mode] { + verbose "check_v3_target_profile_mode: using cached result" 2 + } else { + set et_profile_mode 0 + + # Set up and compile a C++ test program that depends + # on profile mode activated. + set src profile_mode[pid].cc + set exe profile_mode[pid].exe + + set f [open $src "w"] + puts $f "#ifndef _GLIBCXX_PROFILE" + puts $f "# error No profile mode" + puts $f "#endif" + puts $f "int main()" + puts $f "{ return 0; }" + close $f + + set lines [v3_target_compile $src $exe executable ""] + file delete $src + + if [string match "" $lines] { + # No error message, compilation succeeded. + remote_file build delete $exe + set et_profile_mode 1 + } + } + verbose "check_v3_target_profile_mode: $et_profile_mode" 2 + return $et_profile_mode +} + proc check_v3_target_normal_mode { } { global et_normal_mode global tool