From 05a596505cfa4642b7d5df8c071eef0ce4fdfafc Mon Sep 17 00:00:00 2001 From: Felix Lee Date: Wed, 10 Feb 1999 12:26:21 +0000 Subject: [PATCH] Cleanup and bug-fix patch from Felix Lee. * lib/c-torture.exp (c-torture-compile): Pull out code for analyzing gcc error messages. (c-torture-execute): Likewise. Fix some (harmless) false positives. * lib/gcc.exp (gcc_check_compile): New function. From-SVN: r25133 --- gcc/testsuite/ChangeLog | 8 +++ gcc/testsuite/lib/c-torture.exp | 93 ++------------------------------- gcc/testsuite/lib/gcc.exp | 56 +++++++++++++++++++- 3 files changed, 68 insertions(+), 89 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 74e96b08d51..76e6da05a40 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +Wed Feb 10 12:15:35 1999 Felix Lee + + * lib/c-torture.exp (c-torture-compile): Pull out code for + analyzing gcc error messages. + (c-torture-execute): Likewise. Fix some (harmless) false + positives. + * lib/gcc.exp (gcc_check_compile): New function. + Mon Feb 8 21:42:57 1999 Richard Henderson * gcc.c-torture/execute/990208-1.c: New test. diff --git a/gcc/testsuite/lib/c-torture.exp b/gcc/testsuite/lib/c-torture.exp index 570a0ef6be2..2078a61b506 100644 --- a/gcc/testsuite/lib/c-torture.exp +++ b/gcc/testsuite/lib/c-torture.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. +# Copyright (C) 1992-1998, 1999 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 @@ -76,50 +76,7 @@ proc c-torture-compile { src option } { lappend options "additional_flags=-w $option" set comp_output [gcc_target_compile "$src" "$output" object $options]; - - # Set a few common compiler messages. - set fatal_signal "*cc: Internal compiler error: program*got fatal signal" - - if [string match "$fatal_signal 6" $comp_output] then { - gcc_fail $testcase "Got Signal 6, $option" - remote_file build delete $output - return - } - - if [string match "$fatal_signal 11" $comp_output] then { - gcc_fail $testcase "Got Signal 11, $option" - remote_file build delete $output - return - } - - # We shouldn't get these because of -w, but just in case. - if [string match "*cc:*warning:*" $comp_output] then { - warning "$testcase: (with warnings) $option" - send_log "$comp_output\n" - unresolved "$testcase, $option" - remote_file build delete $output - return - } - - set comp_output [prune_warnings $comp_output] - - set unsupported_message [gcc_check_unsupported_p $comp_output] - if { $unsupported_message != "" } { - unsupported "$testcase: $unsupported_message" - remote_file build delete $output - return - } - - # remove any leftover LF/CR to make sure any output is legit - regsub -all -- "\[\r\n\]*" $comp_output "" comp_output - # If any message remains, we fail. - if ![string match "" $comp_output] then { - gcc_fail $testcase $option - remote_file build delete $output - return - } - - gcc_pass $testcase $option + gcc_check_compile $testcase $option $output $comp_output remote_file build delete $output } @@ -201,57 +158,17 @@ proc c-torture-execute { src args } { } set comp_output [gcc_target_compile "$src" "${execname}" executable $options]; - # Set a few common compiler messages. - set fatal_signal "*cc: Internal compiler error: program*got fatal signal" - - if [string match "$fatal_signal 6" $comp_output] then { - gcc_fail $testcase "Got Signal 6, $option" + if ![gcc_check_compile "$testcase compilation" $option $execname $comp_output] { + unresolved "$testcase execution, $option" remote_file build delete $execname continue } - - if [string match "$fatal_signal 11" $comp_output] then { - gcc_fail $testcase "Got Signal 11, $option" - remote_file build delete $execname - continue - } - - # We shouldn't get these because of -w, but just in case. - if [string match "*cc:*warning:*" $comp_output] then { - warning "$testcase: (with warnings) $option" - send_log "$comp_output\n" - unresolved "$testcase, $option" - remote_file build delete $execname - continue - } - - set comp_output [prune_warnings $comp_output] - - set unsupported_message [gcc_check_unsupported_p $comp_output] - - if { $unsupported_message != "" } { - unsupported "$testcase: $unsupported_message" - continue - } elseif ![file exists $execname] { - if ![is3way] { - fail "$testcase compilation, $option" - untested "$testcase execution, $option" - continue - } else { - # FIXME: since we can't test for the existance of a remote - # file without short of doing an remote file list, we assume - # that since we got no output, it must have compiled. - pass "$testcase compilation, $option" - } - } else { - pass "$testcase compilation, $option" - } # See if this source file uses "long long" types, if it does, and # no_long_long is set, skip execution of the test. if [target_info exists no_long_long] then { if [expr [search_for $src "long long"]] then { - untested "$testcase execution, $option" + unsupported "$testcase execution, $option" continue } } diff --git a/gcc/testsuite/lib/gcc.exp b/gcc/testsuite/lib/gcc.exp index ac11d0ba26d..b8249333c3f 100644 --- a/gcc/testsuite/lib/gcc.exp +++ b/gcc/testsuite/lib/gcc.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1992, 1993, 1994, 1996, 1997 Free Software Foundation, Inc. +# Copyright (C) 1992, 1993, 1994, 1996, 1997, 1999 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 @@ -148,6 +148,60 @@ proc gcc_target_compile { source dest type options } { return [target_compile $source $dest $type $options] } + +# Reports pass/fail for a gcc compilation and returns true/false. +proc gcc_check_compile {testcase option objname gcc_output} { + + set fatal_signal "*cc: Internal compiler error: program*got fatal signal" + + if [string match "$fatal_signal 6" $gcc_output] then { + gcc_fail $testcase "Got Signal 6, $option" + return 0 + } + + if [string match "$fatal_signal 11" $gcc_output] then { + gcc_fail $testcase "Got Signal 11, $option" + return 0 + } + + # We shouldn't get these because of -w, but just in case. + if [string match "*cc:*warning:*" $gcc_output] then { + warning "$testcase: (with warnings) $option" + send_log "$gcc_output\n" + unresolved "$testcase, $option" + return 0 + } + + set gcc_output [prune_warnings $gcc_output] + + set unsupported_message [gcc_check_unsupported_p $gcc_output] + if { $unsupported_message != "" } { + unsupported "$testcase: $unsupported_message" + return 0 + } + + # remove any leftover LF/CR to make sure any output is legit + regsub -all -- "\[\r\n\]*" $gcc_output "" gcc_output + + # If any message remains, we fail. + if ![string match "" $gcc_output] then { + gcc_fail $testcase $option + return 0 + } + + # fail if the desired object file doesn't exist. + # FIXME: there's no way of checking for existence on a remote host. + if {$objname != "" && ![is3way] && ![file exists $objname]} { + gcc_fail $testcase $option + return 0 + } + + gcc_pass $testcase $option + return 1 +} + + + # # gcc_pass -- utility to record a testcase passed # -- 2.30.2