URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Subversion Repositories openrisc_me
[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [lib/] [mike-g++.exp] - Rev 306
Compare with Previous | Blame | View Log
# Copyright (C) 1988, 90, 91, 92, 95, 96, 1997, 2007# 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/>.# This file was written by Mike Stump <mrs@cygnus.com>## mike_cleanup -- remove any files that are created by the testcase#proc mike_cleanup { src_code output_file assembly_file } {remote_file build delete $output_file $assembly_file}## prebase -- sets up a Mike Stump (mrs@cygnus.com) style G++ test#proc prebase { } {global compiler_outputglobal not_compiler_outputglobal compiler_resultglobal not_compiler_resultglobal program_outputglobal groupsglobal runglobal actionsglobal target_regexpset compiler_output "^$"set not_compiler_output ".*Internal compiler error.*"set compiler_result ""set not_compiler_result ""set program_output ".*PASS.*"set groups {}set run noset actions assembleset target_regexp ".*"}## run the test#proc postbase { src_code run groups args } {global verboseglobal srcdirglobal subdirglobal not_compiler_outputglobal compiler_outputglobal compiler_resultglobal not_compiler_resultglobal program_outputglobal actionsglobal target_regexpglobal host_tripletglobal target_tripletglobal toolglobal tmpdirglobal objdirglobal base_dirif ![regexp $target_regexp $target_triplet] {unsupported $subdir/$src_codereturn}if { [llength $args] > 0 } {set comp_options [lindex $args 0]} else {set comp_options ""}set fail_message $subdir/$src_codeset pass_message $subdir/$src_codeif [info exists GROUP] {if {[lsearch $groups $GROUP] == -1} {return}}if [string match $run yes] {set actions run}set output_file "$tmpdir/[file tail [file rootname $src_code]]"set assembly_file "$output_file"append assembly_file ".S"set compile_type "none"case $actions {compile{set compile_type "assembly"set output_file $assembly_file}assemble{set compile_type "object"append output_file ".o"}link{set compile_type "executable"append output_file ".exe"}run{set compile_type "executable"append output_file ".exe"set run yes}default{set output_file ""set compile_type "none"}}set src_file "$srcdir/$subdir/$src_code"set options ""if { $comp_options != "" } {lappend options "additional_flags=$comp_options"}if ![ishost "*-dos-*"] {lappend options "libs=-lstdc++ -lg++"} else {lappend options "libs=-lstdcxx -lgxx"}set comp_output [g++_target_compile $src_file $output_file $compile_type $options]set pass no# Delete things like "ld.so warning" messages.set comp_output [prune_warnings $comp_output]if [regexp -- $not_compiler_output $comp_output] {if { $verbose > 1 } {send_user "\nChecking:\n$not_compiler_output\nto make sure it does not match:\n$comp_output\nbut it does.\n\n"} else {send_log "\nCompiler output:\n$comp_output\n\n"}fail $fail_message# The framework doesn't like to see any error remnants,# so remove them.uplevel {if [info exists errorInfo] {unset errorInfo}}mike_cleanup $src_code $output_file $assembly_filereturn}# remove any leftover CRs.regsub -all -- "\r" $comp_output "" comp_outputregsub -all "(^|\n)\[^\n\]*linker input file unused since linking not done" $comp_output "" comp_outputregsub -all "(^|\n)\[^\n\]*file path prefix \[^\n\]* never used" $comp_output "" comp_outputset unsupported_message [${tool}_check_unsupported_p $comp_output]if { $unsupported_message != "" } {unsupported "$subdir/$src_code: $unsupported_message"mike_cleanup $src_code $output_file $assembly_filereturn}if { $verbose > 1 } {send_user "\nChecking:\n$compiler_output\nto see if it matches:\n$comp_output\n"} else {send_log "\nCompiler output:\n$comp_output\n\n"}if [regexp -- $compiler_output $comp_output] {if { $verbose > 1 } {send_user "Yes, it matches.\n\n"}set pass yesif [file exists [file rootname [file tail $src_code]].s] {set fd [open [file rootname [file tail $src_code]].s r]set dot_s [read $fd]close $fdif { $compiler_result != "" } {verbose "Checking .s file for $compiler_result" 2if [regexp -- $compiler_result $dot_s] {verbose "Yes, it matches." 2} else {verbose "Nope, doesn't match." 2verbose $dot_s 4set pass no}}if { $not_compiler_result != "" } {verbose "Checking .s file for not $not_compiler_result" 2if ![regexp -- $not_compiler_result $dot_s] {verbose "Nope, not found (that's good)." 2} else {verbose "Uh oh, it was found." 2verbose $dot_s 4set pass no}}}if [string match $run yes] {set result [g++_load $output_file]set status [lindex $result 0]set output [lindex $result 1]if { $status == -1 } {mike_cleanup $src_code $output_file $assembly_filereturn}if { $verbose > 1 } {send_user "Checking:\n$program_output\nto see if it matches:\n$output\n\n"}if ![regexp -- $program_output $output] {set pass noif { $verbose > 1 } {send_user "Nope, does not match.\n\n"}} else {if { $verbose > 1 } {send_user "Yes, it matches.\n\n"}}}} else {if { $verbose > 1 } {send_user "Nope, does not match.\n\n"}}if [string match $pass "yes"] {pass $pass_message} else {fail $fail_message}# The framework doesn't like to see any error remnants,# so remove them.uplevel {if [info exists errorInfo] {unset errorInfo}}mike_cleanup $src_code $output_file $assembly_file}
