]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/lib/gcc-simulate-thread.exp
builtins.c (expand_builtin): Remove 4th parameter representing weak/strong mode when...
[thirdparty/gcc.git] / gcc / testsuite / lib / gcc-simulate-thread.exp
CommitLineData
ff8e7c4d
AH
1# Copyright (C) 2011 Free Software Foundation, Inc.
2
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 3 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with GCC; see the file COPYING3. If not see
15# <http://www.gnu.org/licenses/>.
16
17# Utility for running a given test through the simulate-thread harness
18# using gdb. This is invoked via dg-final.
19#
20# Adapted from the guality harness.
21#
22# Call 'fail' if a given test printed "FAIL:", otherwise call 'pass'.
23
24proc simulate-thread { args } {
25 if { ![isnative] || [is_remote target] } { return }
26
27 if { [llength $args] == 1 } {
28 switch [dg-process-target [lindex $args 0]] {
29 "F" { setup_xfail "*-*-*" }
30 }
31 }
32
33 # This assumes that we are three frames down from dg-test, and that
34 # it still stores the filename of the testcase in a local variable "name".
35 # A cleaner solution would require a new DejaGnu release.
36 upvar 2 name testcase
37 upvar 2 prog prog
38 upvar 2 srcdir testsuite_dir
39
40 set gdb_name $::env(GDB_FOR_GCC_TESTING)
41 set exec_file "[file rootname [file tail $prog]].exe"
42 set cmd_file "$testsuite_dir/gcc.dg/simulate-thread/simulate-thread.gdb"
43
44 if ![file exists $exec_file] {
45 return
46 }
47
29e339fd
UB
48 set message "(thread simulation test)"
49
ff8e7c4d
AH
50 send_log "Spawning: $gdb_name -nx -nw -quiet -x $cmd_file ./$exec_file\n"
51 set res [remote_spawn target "$gdb_name -nx -nw -x $cmd_file ./$exec_file"]
52 if { $res < 0 || $res == "" } {
29e339fd 53 unsupported "$testcase $message"
ff8e7c4d
AH
54 return
55 }
56
57 set gdb_worked 0
29e339fd
UB
58
59 # Set timeout to 10 seconds due to huge amount of generated log.
60 remote_expect target 10 {
ff8e7c4d
AH
61 # Too old GDB
62 -re "Unhandled dwarf expression|Error in sourced command file" {
29e339fd 63 unsupported "$testcase $message"
ff8e7c4d
AH
64 remote_close target
65 return
66 }
67 -re "FAIL:" {
29e339fd 68 fail "$testcase $message"
ff8e7c4d
AH
69 remote_close target
70 return
71 }
29e339fd 72 # If the gdb output contained simulate_thread_done, assume
ff8e7c4d 73 # that at the very least, we had a working gdb that was able
29e339fd
UB
74 # to break in simulate_thread_done.
75 -re "simulate_thread_done" {
ff8e7c4d
AH
76 set gdb_worked 1
77 exp_continue
78 }
79 timeout {
29e339fd 80 fail "$testcase $message"
ff8e7c4d
AH
81 remote_close target
82 return
83 }
84 }
85
86 remote_close target
87 if {$gdb_worked} {
29e339fd 88 pass "$testcase $message"
ff8e7c4d 89 } else {
29e339fd
UB
90 # Unsupported in the absence of a sane GDB.
91 unsupported "$testcase $message"
ff8e7c4d
AH
92 }
93 return
94}