aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/lib
diff options
context:
space:
mode:
authorFelix Lee <flee@cygnus.com>1999-02-10 12:26:21 +0000
committerJim Wilson <wilson@gcc.gnu.org>1999-02-10 04:26:21 -0800
commit05a596505cfa4642b7d5df8c071eef0ce4fdfafc (patch)
tree0f2ce5c8d1f457de4007bd60b163ff30a4fc5eca /gcc/testsuite/lib
parent44e95b192cf68a4642d9ff8e3eaa6bc46bd380b9 (diff)
downloadgcc-05a596505cfa4642b7d5df8c071eef0ce4fdfafc.zip
gcc-05a596505cfa4642b7d5df8c071eef0ce4fdfafc.tar.gz
gcc-05a596505cfa4642b7d5df8c071eef0ce4fdfafc.tar.bz2
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
Diffstat (limited to 'gcc/testsuite/lib')
-rw-r--r--gcc/testsuite/lib/c-torture.exp93
-rw-r--r--gcc/testsuite/lib/gcc.exp56
2 files changed, 60 insertions, 89 deletions
diff --git a/gcc/testsuite/lib/c-torture.exp b/gcc/testsuite/lib/c-torture.exp
index 570a0ef..2078a61 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 ac11d0b..b824933 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
#