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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [lib/] [gcc-defs.exp] - Diff between revs 306 and 816

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 306 Rev 816
# Copyright (C) 2001, 2003, 2004, 2007 Free Software Foundation, Inc.
# Copyright (C) 2001, 2003, 2004, 2007 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# 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
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# You should have received a copy of the GNU General Public License
# along with GCC; see the file COPYING3.  If not see
# along with GCC; see the file COPYING3.  If not see
# .
# .
load_lib target-libpath.exp
load_lib target-libpath.exp
load_lib wrapper.exp
load_lib wrapper.exp
#
#
# ${tool}_check_compile -- Reports and returns pass/fail for a compilation
# ${tool}_check_compile -- Reports and returns pass/fail for a compilation
#
#
proc ${tool}_check_compile {testcase option objname gcc_output} {
proc ${tool}_check_compile {testcase option objname gcc_output} {
    global tool
    global tool
    set fatal_signal "*cc: Internal compiler error: program*got fatal signal"
    set fatal_signal "*cc: Internal compiler error: program*got fatal signal"
    if [string match "$fatal_signal 6" $gcc_output] then {
    if [string match "$fatal_signal 6" $gcc_output] then {
        ${tool}_fail $testcase "Got Signal 6, $option"
        ${tool}_fail $testcase "Got Signal 6, $option"
        return 0
        return 0
    }
    }
    if [string match "$fatal_signal 11" $gcc_output] then {
    if [string match "$fatal_signal 11" $gcc_output] then {
        ${tool}_fail $testcase "Got Signal 11, $option"
        ${tool}_fail $testcase "Got Signal 11, $option"
        return 0
        return 0
    }
    }
    if [string match "*internal compiler error*" $gcc_output] then {
    if [string match "*internal compiler error*" $gcc_output] then {
        ${tool}_fail $testcase "$option (internal compiler error)"
        ${tool}_fail $testcase "$option (internal compiler error)"
        return 0
        return 0
    }
    }
    # We shouldn't get these because of -w, but just in case.
    # We shouldn't get these because of -w, but just in case.
    if [string match "*cc:*warning:*" $gcc_output] then {
    if [string match "*cc:*warning:*" $gcc_output] then {
        warning "$testcase: (with warnings) $option"
        warning "$testcase: (with warnings) $option"
        send_log "$gcc_output\n"
        send_log "$gcc_output\n"
        unresolved "$testcase, $option"
        unresolved "$testcase, $option"
        return 0
        return 0
    }
    }
    set gcc_output [prune_warnings $gcc_output]
    set gcc_output [prune_warnings $gcc_output]
    if { [info proc ${tool}-dg-prune] != "" } {
    if { [info proc ${tool}-dg-prune] != "" } {
        global target_triplet
        global target_triplet
        set gcc_output [${tool}-dg-prune $target_triplet $gcc_output]
        set gcc_output [${tool}-dg-prune $target_triplet $gcc_output]
    }
    }
    set unsupported_message [${tool}_check_unsupported_p $gcc_output]
    set unsupported_message [${tool}_check_unsupported_p $gcc_output]
    if { $unsupported_message != "" } {
    if { $unsupported_message != "" } {
        unsupported "$testcase: $unsupported_message"
        unsupported "$testcase: $unsupported_message"
        return 0
        return 0
    }
    }
    # remove any leftover LF/CR to make sure any output is legit
    # remove any leftover LF/CR to make sure any output is legit
    regsub -all -- "\[\r\n\]*" $gcc_output "" gcc_output
    regsub -all -- "\[\r\n\]*" $gcc_output "" gcc_output
    # If any message remains, we fail.
    # If any message remains, we fail.
    if ![string match "" $gcc_output] then {
    if ![string match "" $gcc_output] then {
        ${tool}_fail $testcase $option
        ${tool}_fail $testcase $option
        return 0
        return 0
    }
    }
    # fail if the desired object file doesn't exist.
    # fail if the desired object file doesn't exist.
    # FIXME: there's no way of checking for existence on a remote host.
    # FIXME: there's no way of checking for existence on a remote host.
    if {$objname != "" && ![is3way] && ![file exists $objname]} {
    if {$objname != "" && ![is3way] && ![file exists $objname]} {
        ${tool}_fail $testcase $option
        ${tool}_fail $testcase $option
        return 0
        return 0
    }
    }
    ${tool}_pass $testcase $option
    ${tool}_pass $testcase $option
    return 1
    return 1
}
}
#
#
# ${tool}_pass -- utility to record a testcase passed
# ${tool}_pass -- utility to record a testcase passed
#
#
proc ${tool}_pass { testcase cflags } {
proc ${tool}_pass { testcase cflags } {
    if { "$cflags" == "" } {
    if { "$cflags" == "" } {
        pass "$testcase"
        pass "$testcase"
    } else {
    } else {
        pass "$testcase, $cflags"
        pass "$testcase, $cflags"
    }
    }
}
}
#
#
# ${tool}_fail -- utility to record a testcase failed
# ${tool}_fail -- utility to record a testcase failed
#
#
proc ${tool}_fail { testcase cflags } {
proc ${tool}_fail { testcase cflags } {
    if { "$cflags" == "" } {
    if { "$cflags" == "" } {
        fail "$testcase"
        fail "$testcase"
    } else {
    } else {
        fail "$testcase, $cflags"
        fail "$testcase, $cflags"
    }
    }
}
}
#
#
# ${tool}_finish -- called at the end of every script that calls ${tool}_init
# ${tool}_finish -- called at the end of every script that calls ${tool}_init
#
#
# Hide all quirks of the testing environment from the testsuites.  Also
# Hide all quirks of the testing environment from the testsuites.  Also
# undo anything that ${tool}_init did that needs undoing.
# undo anything that ${tool}_init did that needs undoing.
#
#
proc ${tool}_finish { } {
proc ${tool}_finish { } {
    # The testing harness apparently requires this.
    # The testing harness apparently requires this.
    global errorInfo
    global errorInfo
    if [info exists errorInfo] then {
    if [info exists errorInfo] then {
        unset errorInfo
        unset errorInfo
    }
    }
    # Might as well reset these (keeps our caller from wondering whether
    # Might as well reset these (keeps our caller from wondering whether
    # s/he has to or not).
    # s/he has to or not).
    global prms_id bug_id
    global prms_id bug_id
    set prms_id 0
    set prms_id 0
    set bug_id 0
    set bug_id 0
}
}
#
#
# ${tool}_exit -- Does final cleanup when testing is complete
# ${tool}_exit -- Does final cleanup when testing is complete
#
#
proc ${tool}_exit { } {
proc ${tool}_exit { } {
    global gluefile
    global gluefile
    if [info exists gluefile] {
    if [info exists gluefile] {
        file_on_build delete $gluefile
        file_on_build delete $gluefile
        unset gluefile
        unset gluefile
    }
    }
}
}
#
#
# ${tool}_check_unsupported_p -- Check the compiler(/assembler/linker) output
# ${tool}_check_unsupported_p -- Check the compiler(/assembler/linker) output
#       for text indicating that the testcase should be marked as "unsupported"
#       for text indicating that the testcase should be marked as "unsupported"
#
#
# Utility used by mike-gcc.exp and c-torture.exp.
# Utility used by mike-gcc.exp and c-torture.exp.
# When dealing with a large number of tests, it's difficult to weed out the
# When dealing with a large number of tests, it's difficult to weed out the
# ones that are too big for a particular cpu (eg: 16 bit with a small amount
# ones that are too big for a particular cpu (eg: 16 bit with a small amount
# of memory).  There are various ways to deal with this.  Here's one.
# of memory).  There are various ways to deal with this.  Here's one.
# Fortunately, all of the cases where this is likely to happen will be using
# Fortunately, all of the cases where this is likely to happen will be using
# gld so we can tell what the error text will look like.
# gld so we can tell what the error text will look like.
#
#
proc ${tool}_check_unsupported_p { output } {
proc ${tool}_check_unsupported_p { output } {
    if [regexp "(^|\n)\[^\n\]*: region \[^\n\]* is full" $output] {
    if [regexp "(^|\n)\[^\n\]*: region \[^\n\]* is full" $output] {
        return "memory full"
        return "memory full"
    }
    }
    if {[istarget spu-*-*] && \
    if {[istarget spu-*-*] && \
            [string match "*exceeds local store*" $output]} {
            [string match "*exceeds local store*" $output]} {
        return "memory full"
        return "memory full"
    }
    }
    return ""
    return ""
}
}
#
#
# runtest_file_p -- Provide a definition for older dejagnu releases
# runtest_file_p -- Provide a definition for older dejagnu releases
#                   and assume the old syntax: foo1.exp bar1.c foo2.exp bar2.c.
#                   and assume the old syntax: foo1.exp bar1.c foo2.exp bar2.c.
#                   (delete after next dejagnu release).
#                   (delete after next dejagnu release).
#
#
if { [info procs runtest_file_p] == "" } then {
if { [info procs runtest_file_p] == "" } then {
    proc runtest_file_p { runtests testcase } {
    proc runtest_file_p { runtests testcase } {
        if { $runtests != "" && [regexp "\[.\]\[cC\]" $runtests] } then {
        if { $runtests != "" && [regexp "\[.\]\[cC\]" $runtests] } then {
            if { [lsearch $runtests [file tail $testcase]] >= 0 } then {
            if { [lsearch $runtests [file tail $testcase]] >= 0 } then {
                return 1
                return 1
            } else {
            } else {
                return 0
                return 0
            }
            }
        }
        }
        return 1
        return 1
    }
    }
}
}
# Record additional sources files that must be compiled along with the
# Record additional sources files that must be compiled along with the
# main source file.
# main source file.
set additional_sources ""
set additional_sources ""
proc dg-additional-sources { args } {
proc dg-additional-sources { args } {
    global additional_sources
    global additional_sources
    set additional_sources [lindex $args 1]
    set additional_sources [lindex $args 1]
}
}
# Record additional files -- other than source files -- that must be
# Record additional files -- other than source files -- that must be
# present on the system where the compiler runs.
# present on the system where the compiler runs.
set additional_files ""
set additional_files ""
proc dg-additional-files { args } {
proc dg-additional-files { args } {
    global additional_files
    global additional_files
    set additional_files [lindex $args 1]
    set additional_files [lindex $args 1]
}
}
# Return an updated version of OPTIONS that mentions any additional
# Return an updated version of OPTIONS that mentions any additional
# source files registered with dg-additional-sources.  SOURCE is the
# source files registered with dg-additional-sources.  SOURCE is the
# name of the test case.
# name of the test case.
proc dg-additional-files-options { options source } {
proc dg-additional-files-options { options source } {
    global additional_sources
    global additional_sources
    global additional_files
    global additional_files
    set to_download [list]
    set to_download [list]
    if { $additional_sources != "" } then {
    if { $additional_sources != "" } then {
        if [is_remote host] {
        if [is_remote host] {
            lappend options "additional_flags=$additional_sources"
            lappend options "additional_flags=$additional_sources"
        }
        }
        regsub -all "^| " $additional_sources " [file dirname $source]/" additional_sources
        regsub -all "^| " $additional_sources " [file dirname $source]/" additional_sources
        if ![is_remote host] {
        if ![is_remote host] {
            lappend options "additional_flags=$additional_sources"
            lappend options "additional_flags=$additional_sources"
        }
        }
        set to_download [concat $to_download $additional_sources]
        set to_download [concat $to_download $additional_sources]
        set additional_sources ""
        set additional_sources ""
    }
    }
    if { $additional_files != "" } then {
    if { $additional_files != "" } then {
        regsub -all " " $additional_files " [file dirname $source]/" additional_files
        regsub -all " " $additional_files " [file dirname $source]/" additional_files
        set to_download [concat $to_download $additional_files]
        set to_download [concat $to_download $additional_files]
        set additional_files ""
        set additional_files ""
    }
    }
    if [is_remote host] {
    if [is_remote host] {
        foreach file $to_download {
        foreach file $to_download {
            remote_download host $file
            remote_download host $file
        }
        }
    }
    }
    return $options
    return $options
}
}
# Return a colon-separate list of directories to search for libraries
# Return a colon-separate list of directories to search for libraries
# for COMPILER, including multilib directories.
# for COMPILER, including multilib directories.
proc gcc-set-multilib-library-path { compiler } {
proc gcc-set-multilib-library-path { compiler } {
    global rootme
    global rootme
    # ??? rootme will not be set when testing an installed compiler.
    # ??? rootme will not be set when testing an installed compiler.
    # In that case, we should perhaps use some other method to find
    # In that case, we should perhaps use some other method to find
    # libraries.
    # libraries.
    if {![info exists rootme]} {
    if {![info exists rootme]} {
        return ""
        return ""
    }
    }
    set libpath ":${rootme}"
    set libpath ":${rootme}"
    set compiler [lindex $compiler 0]
    set compiler [lindex $compiler 0]
    if { [is_remote host] == 0 && [which $compiler] != 0 } {
    if { [is_remote host] == 0 && [which $compiler] != 0 } {
        foreach i "[exec $compiler --print-multi-lib]" {
        foreach i "[exec $compiler --print-multi-lib]" {
            set mldir ""
            set mldir ""
            regexp -- "\[a-z0-9=_/\.-\]*;" $i mldir
            regexp -- "\[a-z0-9=_/\.-\]*;" $i mldir
            set mldir [string trimright $mldir "\;@"]
            set mldir [string trimright $mldir "\;@"]
            if { "$mldir" == "." } {
            if { "$mldir" == "." } {
                continue
                continue
            }
            }
            if { [llength [glob -nocomplain ${rootme}/${mldir}/libgcc_s*.so.*]] >= 1 } {
            if { [llength [glob -nocomplain ${rootme}/${mldir}/libgcc_s*.so.*]] >= 1 } {
                append libpath ":${rootme}/${mldir}"
                append libpath ":${rootme}/${mldir}"
            }
            }
        }
        }
    }
    }
    return $libpath
    return $libpath
}
}
 
 

powered by: WebSVN 2.1.0

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