diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2011-10-10 13:42:41 +0000 |
---|---|---|
committer | Aldy Hernandez <aldyh@gcc.gnu.org> | 2011-10-10 13:42:41 +0000 |
commit | ff8e7c4d682099d61e81a20b465280bcc7cdaab5 (patch) | |
tree | bba6939b464863b1cd47394507ef6db3d08fb471 /gcc/testsuite/lib | |
parent | 53fbb7241f0d2d4e3a4eb8b3225671b121091b06 (diff) | |
download | gcc-ff8e7c4d682099d61e81a20b465280bcc7cdaab5.zip gcc-ff8e7c4d682099d61e81a20b465280bcc7cdaab5.tar.gz gcc-ff8e7c4d682099d61e81a20b465280bcc7cdaab5.tar.bz2 |
gcc-simulate-thread.exp: New.
* lib/gcc-simulate-thread.exp: New.
* gcc.dg/simulate-thread/guality.h: New.
* gcc.dg/simulate-thread/simulate-thread.h: New.
* gcc.dg/simulate-thread/simulate-thread.exp: New.
* gcc.dg/simulate-thread/simulate-thread.gdb: New.
* gcc.dg/simulate-thread/README: New.
* g++.dg/simulate-thread/guality.h: New.
* g++.dg/simulate-thread/simulate-thread.h: New.
* g++.dg/simulate-thread/simulate-thread.exp: New.
* g++.dg/simulate-thread/simulate-thread.gdb: New.
* c-c++-common/cxxbitfields-2.c: Remove.
* c-c++-common/cxxbitfields.c: Remove.
* c-c++-common/cxxbitfields-4.c: Remove.
* c-c++-common/cxxbitfields-5.c: Remove.
* c-c++-common/simulate-thread/bitfields-1.c: New.
* c-c++-common/simulate-thread/bitfields-2.c: New.
* c-c++-common/simulate-thread/bitfields-3.c: New.
* c-c++-common/simulate-thread/bitfields-4.c: New.
From-SVN: r179751
Diffstat (limited to 'gcc/testsuite/lib')
-rw-r--r-- | gcc/testsuite/lib/gcc-dg.exp | 22 | ||||
-rw-r--r-- | gcc/testsuite/lib/gcc-simulate-thread.exp | 90 |
2 files changed, 112 insertions, 0 deletions
diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index 9ce0149..6bac368d 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -747,4 +747,26 @@ proc dg-message { args } { process-message saved-dg-warning "" $args } +# Check the existence of a gdb in the path, and return true if there +# is one. +# +# Set env(GDB_FOR_GCC_TESTING) accordingly. + +proc gdb-exists { args } { + if ![info exists ::env(GDB_FOR_GCC_TESTING)] { + global GDB + if ![info exists ::env(GDB_FOR_GCC_TESTING)] { + if [info exists GDB] { + setenv GDB_FOR_GCC_TESTING "$GDB" + } else { + setenv GDB_FOR_GCC_TESTING "[transform gdb]" + } + } + } + if { [which $::env(GDB_FOR_GCC_TESTING)] != 0 } { + return 1; + } + return 0; +} + set additional_prunes "" diff --git a/gcc/testsuite/lib/gcc-simulate-thread.exp b/gcc/testsuite/lib/gcc-simulate-thread.exp new file mode 100644 index 0000000..ba2416a --- /dev/null +++ b/gcc/testsuite/lib/gcc-simulate-thread.exp @@ -0,0 +1,90 @@ +# Copyright (C) 2011 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# Utility for running a given test through the simulate-thread harness +# using gdb. This is invoked via dg-final. +# +# Adapted from the guality harness. +# +# Call 'fail' if a given test printed "FAIL:", otherwise call 'pass'. + +proc simulate-thread { args } { + if { ![isnative] || [is_remote target] } { return } + + if { [llength $args] == 1 } { + switch [dg-process-target [lindex $args 0]] { + "F" { setup_xfail "*-*-*" } + } + } + + # This assumes that we are three frames down from dg-test, and that + # it still stores the filename of the testcase in a local variable "name". + # A cleaner solution would require a new DejaGnu release. + upvar 2 name testcase + upvar 2 prog prog + upvar 2 srcdir testsuite_dir + + set gdb_name $::env(GDB_FOR_GCC_TESTING) + set exec_file "[file rootname [file tail $prog]].exe" + set cmd_file "$testsuite_dir/gcc.dg/simulate-thread/simulate-thread.gdb" + + if ![file exists $exec_file] { + return + } + + send_log "Spawning: $gdb_name -nx -nw -quiet -x $cmd_file ./$exec_file\n" + set res [remote_spawn target "$gdb_name -nx -nw -x $cmd_file ./$exec_file"] + if { $res < 0 || $res == "" } { + unsupported "$testcase" + return + } + + set gdb_worked 0 + remote_expect target [timeout_value] { + # Too old GDB + -re "Unhandled dwarf expression|Error in sourced command file" { + unsupported "$testcase" + remote_close target + return + } + -re "FAIL:" { + fail "$testcase" + remote_close target + return + } + # If the gdb output contained simulate_thread_main, assume + # that at the very least, we had a working gdb that was able + # to break in simulate_thread_main. + -re "simulate_thread_main" { + set gdb_worked 1 + exp_continue + } + timeout { + unsupported "$testcase" + remote_close target + return + } + } + + remote_close target + if {$gdb_worked} { + pass "$testcase" + } else { + # Fail in the absence of a sane GDB. + fail "$testcase" + } + return +} |