Commit 05a59650 by Felix Lee Committed by Jim Wilson

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
parent 44e95b19
Wed Feb 10 12:15:35 1999 Felix Lee <flee@cygnus.com>
* 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 <rth@cygnus.com>
* gcc.c-torture/execute/990208-1.c: New test.
......
# 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
}
}
......
# 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
#
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment