OSDN Git Service

Cleanup and bug-fix patch from Felix Lee.
authorwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 10 Feb 1999 12:26:21 +0000 (12:26 +0000)
committerwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 10 Feb 1999 12:26:21 +0000 (12:26 +0000)
        * 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@25133 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/lib/c-torture.exp
gcc/testsuite/lib/gcc.exp

index 74e96b0..76e6da0 100644 (file)
@@ -1,3 +1,11 @@
+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.
index 570a0ef..2078a61 100644 (file)
@@ -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
            }
        }
index ac11d0b..b824933 100644 (file)
@@ -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
 #