OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [lib/] [options.exp] - Blame information for rev 801

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 701 jeremybenn
# Copyright (C) 2009 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
# .
16
 
17
# We set LC_ALL and LANG to C so that we get the same error messages as expected.
18
setenv LC_ALL C
19
setenv LANG C
20
 
21
# Many hosts now default to a non-ASCII C locale, however, so
22
# they can set a charset encoding here if they need.
23
if { [ishost "*-*-cygwin*"] } {
24
  setenv LC_ALL C.ASCII
25
  setenv LANG C.ASCII
26
}
27
 
28
# Run the LANGUAGE compiler with GCC_OPTIONS and inspect the compiler
29
# output to make sure that they match the newline-separated patterns
30
# in COMPILER_PATTERNS but not the patterns in COMPILER_NON_PATTERNS.
31
# In case of failure, xfail if XFAIL is nonempty.
32
 
33
proc check_for_options {language gcc_options compiler_patterns compiler_non_patterns expected_failure} {
34
    set filename test-[pid]
35
    set fd [open $filename.c w]
36
    puts $fd "int main (void) { return 0; }"
37
    close $fd
38
    remote_download host $filename.c
39
 
40
    set test "compiler driver $gcc_options option(s):"
41
    set gcc_options "\{additional_flags=$gcc_options\}"
42
 
43
    switch "$language" {
44
        "c" { set compiler cc1 }
45
        default { error "unknown language" }
46
    }
47
    set gcc_output [gcc_target_compile $filename.c $filename.x executable $gcc_options]
48
    remote_file build delete $filename.c $filename.x $filename.gcno
49
 
50
    foreach pattern [split $compiler_patterns "\n"] {
51
        if {$pattern != ""} {
52
            if {[regexp -- "$pattern" $gcc_output]} {
53
                pass "$test $pattern"
54
            } else {
55
                if {$expected_failure != ""} {
56
                    xfail "$test $pattern"
57
                } else {
58
                    fail "$test $pattern"
59
                }
60
            }
61
        }
62
    }
63
    foreach pattern [split $compiler_non_patterns "\n"] {
64
        if {$pattern != ""} {
65
            if {![regexp -- "$pattern" $gcc_output]} {
66
                pass "$test $pattern"
67
            } else {
68
                if {$expected_failure != ""} {
69
                    xfail "$test $pattern"
70
                } else {
71
                    fail "$test $pattern"
72
                }
73
            }
74
        }
75
    }
76
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.