Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / gcc.misc-tests / options.exp
blob298388a14fe1e061b8c3f9f48225b986ad3afe08
1 # Copyright (C) 2005 Free Software Foundation, Inc.
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 2 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.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 # Run the LANGUAGE compiler with GCC_OPTIONS and inspect the compiler,
18 # assembler and linker output (from gcc -v) to make sure that they
19 # match the patterns COMPILER_PATTERN, AS_PATTERN and LD_PATTERN,
20 # respectively.
22 proc check_for_options {language gcc_options compiler_pattern as_pattern ld_pattern} {
23 set filename test-[pid]
24 set fd [open $filename.c w]
25 puts $fd "int main (void) \{ return 0; \}"
26 close $fd
27 remote_download host $filename.c
29 set test "compiler driver $gcc_options option(s)"
30 set gcc_options "\{additional_flags=$gcc_options -v\}"
32 switch "$language" {
33 "c" { set compiler cc1 }
34 default { error "unknown language" }
36 set gcc_output [gcc_target_compile $filename.c $filename.x executable $gcc_options]
37 remote_file build delete $filename.c $filename.x $filename.gcno
39 if {![regexp -- "/$compiler -quiet.*$compiler_pattern" $gcc_output]} {
40 fail "$test (compiler options)"
41 return
43 if {![regexp -- " *as .*$as_pattern" $gcc_output]} {
44 fail "$test (assembler options)"
45 return
47 if {![regexp -- "/collect2 .*$ld_pattern" $gcc_output]} {
48 fail "$test (linker options)"
49 return
51 pass $test
54 check_for_options c {--coverage} {-fprofile-arcs -ftest-coverage} {} {-lgcov}