diff options
author | Ben Cheng <bccheng@google.com> | 2014-03-25 22:37:19 -0700 |
---|---|---|
committer | Ben Cheng <bccheng@google.com> | 2014-03-25 22:37:19 -0700 |
commit | 1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch) | |
tree | c607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/gcc/testsuite/lib/options.exp | |
parent | 283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff) | |
download | toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2 |
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/gcc/testsuite/lib/options.exp')
-rw-r--r-- | gcc-4.9/gcc/testsuite/lib/options.exp | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/lib/options.exp b/gcc-4.9/gcc/testsuite/lib/options.exp new file mode 100644 index 0000000..d420ad9 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/lib/options.exp @@ -0,0 +1,76 @@ +# Copyright (C) 2009-2014 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/>. + +# We set LC_ALL and LANG to C so that we get the same error messages as expected. +setenv LC_ALL C +setenv LANG C + +# Many hosts now default to a non-ASCII C locale, however, so +# they can set a charset encoding here if they need. +if { [ishost "*-*-cygwin*"] } { + setenv LC_ALL C.ASCII + setenv LANG C.ASCII +} + +# Run the LANGUAGE compiler with GCC_OPTIONS and inspect the compiler +# output to make sure that they match the newline-separated patterns +# in COMPILER_PATTERNS but not the patterns in COMPILER_NON_PATTERNS. +# In case of failure, xfail if XFAIL is nonempty. + +proc check_for_options {language gcc_options compiler_patterns compiler_non_patterns expected_failure} { + set filename test-[pid] + set fd [open $filename.c w] + puts $fd "int main (void) { return 0; }" + close $fd + remote_download host $filename.c + + set test "compiler driver $gcc_options option(s):" + set gcc_options "\{additional_flags=$gcc_options\}" + + switch "$language" { + "c" { set compiler cc1 } + default { error "unknown language" } + } + set gcc_output [gcc_target_compile $filename.c $filename.x executable $gcc_options] + remote_file build delete $filename.c $filename.x $filename.gcno + + foreach pattern [split $compiler_patterns "\n"] { + if {$pattern != ""} { + if {[regexp -- "$pattern" $gcc_output]} { + pass "$test $pattern" + } else { + if {$expected_failure != ""} { + xfail "$test $pattern" + } else { + fail "$test $pattern" + } + } + } + } + foreach pattern [split $compiler_non_patterns "\n"] { + if {$pattern != ""} { + if {![regexp -- "$pattern" $gcc_output]} { + pass "$test $pattern" + } else { + if {$expected_failure != ""} { + xfail "$test $pattern" + } else { + fail "$test $pattern" + } + } + } + } +} |