g++.exp (g++_exit, [...]): Removed.
authorStan Cox <scox@redhat.com>
Thu, 26 Jul 2001 21:38:14 +0000 (21:38 +0000)
committerStan Cox <scox@gcc.gnu.org>
Thu, 26 Jul 2001 21:38:14 +0000 (21:38 +0000)
* lib/g++.exp (g++_exit, g++_check_unsupported_p): Removed.
* lib/gcc.exp (gcc_check_compile, gcc_pass, gcc_fail, gcc_finish,
gcc_exit, gcc_check_unsupported_p):
Moved to gcc-deps.exp
* gcc-deps.exp: New file.

From-SVN: r44410

gcc/testsuite/ChangeLog
gcc/testsuite/lib/g++.exp
gcc/testsuite/lib/gcc-defs.exp [new file with mode: 0644]
gcc/testsuite/lib/gcc.exp

index 5b9ab08a692eca3052c4bb4e794fd983dfe11d64..43c029a820617d8dae55b4a66d451dea530632b8 100644 (file)
@@ -1,3 +1,11 @@
+2001-07-26  Stan Cox <scox@redhat.com>
+
+       * lib/g++.exp (g++_exit, g++_check_unsupported_p): Removed.
+       * lib/gcc.exp (gcc_check_compile, gcc_pass, gcc_fail, gcc_finish,
+       gcc_exit, gcc_check_unsupported_p):
+       Moved to gcc-deps.exp
+       * gcc-deps.exp: New file.
+
 2001-07-26  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
 
        * g++.old-deja/g++.pt/defarg14.C: New test.
index 36024e9c28025e9f4ed760d311582c74e53282ad..c597b03c5406bdd1d4b5952aa5968c101bebda24 100644 (file)
@@ -22,6 +22,7 @@
 # g++ support library routines
 #
 load_lib prune.exp
+load_lib gcc-defs.exp
 
 #
 # GXX_UNDER_TEST is the compiler under test.
@@ -30,12 +31,16 @@ load_lib prune.exp
 
 set gpp_compile_options ""
 
+
 #
 # g++_version -- extract and print the version number of the compiler
 #
+
 proc g++_version { } {
     global GXX_UNDER_TEST
     
+    g++_init
+
     # ignore any arguments after the command
     set compiler [lindex $GXX_UNDER_TEST 0]
     
@@ -61,8 +66,8 @@ proc g++_version { } {
 }
 
 #
-# provide new versions of g++_include_flags and g++_link_flags (both
-# originally from libgloss.exp) which know about the new gcc tree structure
+# g++_include_flags -- provide new version of g++_include_flags
+# (originally from libgloss.exp) which knows about the gcc tree structure
 #
 proc g++_include_flags { paths } {
     global srcdir
@@ -94,6 +99,11 @@ proc g++_include_flags { paths } {
     return "$flags"
 }
 
+#
+# g++_link_flags -- provide new version of g++_link_flags
+# (originally from libgloss.exp) which knows about the gcc tree structure
+#
+
 proc g++_link_flags { paths } {
     global rootme
     global srcdir
@@ -236,6 +246,9 @@ proc g++_init { args } {
     verbose "g++ is initialized" 3
 }
 
+#
+# g++_target_compile -- compile a source file
+#
 
 proc g++_target_compile { source dest type options } {
     global tmpdir;
@@ -265,38 +278,15 @@ proc g++_target_compile { source dest type options } {
     return [target_compile $source $dest $type $options]
 }
 
-proc g++_exit { args } {
-    global gluefile;
-
-    if [info exists gluefile] {
-       file_on_build delete $gluefile;
-       unset gluefile;
-    }
-}
-
-# If this is an older version of dejagnu (without runtest_file_p),
-# provide one and assume the old syntax: foo1.exp bar1.c foo2.exp bar2.c.
-# This can be deleted after the next dejagnu release.
-
-if { [info procs runtest_file_p] == "" } then {
-    proc runtest_file_p { runtests testcase } {
-       if { $runtests != "" && [regexp "\[.\]\[cC\]" $runtests] } then {
-           if { [lsearch $runtests [file tail $testcase]] >= 0 } then {
-               return 1
-           } else {
-               return 0
-           }
-       }
-       return 1
-    }
-}
-
+#
+# g++_set_ld_library_path --
 # On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but
 # called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH
 # (for the 64-bit ABI).  The right way to do this would be to modify
 # unix.exp -- but that's not an option since it's part of DejaGNU
 # proper, so we do it here, by trickery.  We really only need to do 
 # this on IRIX, but it shouldn't hurt to do it anywhere else.
+#
 
 proc g++_set_ld_library_path { name element op } {
   setenv LD_LIBRARYN32_PATH [getenv LD_LIBRARY_PATH]
@@ -305,27 +295,18 @@ proc g++_set_ld_library_path { name element op } {
 
 trace variable env(LD_LIBRARY_PATH) w g++_set_ld_library_path
 
-# Utility used by mike-g++.exp and old-dejagnu.exp.
-# Check the compiler(/assembler/linker) output for text indicating that
-# the testcase should be marked as "unsupported".
 #
-# When dealing with a large number of tests, it's difficult to weed out the
-# ones that are too big for a particular cpu (eg: 16 bit with a small amount
-# of memory).  There are various ways to deal with this.  Here's one.
-# Fortunately, all of the cases where this is likely to happen will be using
-# gld so we can tell what the error text will look like.
-
-proc ${tool}_check_unsupported_p { output } {
-    if [regexp "(^|\n)\[^\n\]*: region \[^\n\]* is full" $output] {
-       return "memory full"
-    }
-    return ""
-}
+# ${tool}_option_help
+#
 
 proc ${tool}_option_help { } {
-    send_user "--additional_options,OPTIONS\t\tUse OPTIONS to compile the testcase files. OPTIONS should be comma-separated."
+    send_user " --additional_options,OPTIONS\t\tUse OPTIONS to compile the testcase files. OPTIONS should be comma-separated.\n"
 }
 
+#
+# ${tool}_option_proc
+#
+
 proc ${tool}_option_proc { option } {
     if [regexp "^--additional_options," $option] {
        global gpp_compile_options
diff --git a/gcc/testsuite/lib/gcc-defs.exp b/gcc/testsuite/lib/gcc-defs.exp
new file mode 100644 (file)
index 0000000..30e4b13
--- /dev/null
@@ -0,0 +1,166 @@
+# Copyright (C) 2001 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 2 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 this program; if not, write to the Free Software
+# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#
+# ${tool}_check_compile -- Reports and returns pass/fail for a compilation
+#
+
+proc ${tool}_check_compile {testcase option objname gcc_output} {
+    global tool
+    set fatal_signal "*cc: Internal compiler error: program*got fatal signal"
+    if [string match "$fatal_signal 6" $gcc_output] then {
+       ${tool}_fail $testcase "Got Signal 6, $option"
+       return 0
+    }
+
+    if [string match "$fatal_signal 11" $gcc_output] then {
+       ${tool}_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 [${tool}_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 {
+       ${tool}_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]} {
+       ${tool}_fail $testcase $option
+       return 0
+    }
+
+    ${tool}_pass $testcase $option
+    return 1
+}
+
+#
+# ${tool}_pass -- utility to record a testcase passed
+#
+
+proc ${tool}_pass { testcase cflags } {
+    if { "$cflags" == "" } {
+       pass "$testcase"
+    } else {
+       pass "$testcase, $cflags"
+    }
+}
+
+#
+# ${tool}_fail -- utility to record a testcase failed
+#
+
+proc ${tool}_fail { testcase cflags } {
+    if { "$cflags" == "" } {
+       fail "$testcase"
+    } else {
+       fail "$testcase, $cflags"
+    }
+}
+
+#
+# ${tool}_finish -- called at the end of every script that calls ${tool}_init
+#
+# Hide all quirks of the testing environment from the testsuites.  Also
+# undo anything that ${tool}_init did that needs undoing.
+#
+
+proc ${tool}_finish { } {
+    # The testing harness apparently requires this.
+    global errorInfo;
+
+    if [info exists errorInfo] then {
+       unset errorInfo
+    }
+
+    # Might as well reset these (keeps our caller from wondering whether
+    # s/he has to or not).
+    global prms_id bug_id
+    set prms_id 0
+    set bug_id 0
+}
+
+#
+# ${tool}_exit -- Does final cleanup when testing is complete
+#
+
+proc ${tool}_exit { } {
+    global gluefile;
+
+    if [info exists gluefile] {
+       file_on_build delete $gluefile;
+       unset gluefile;
+    }
+}
+    
+#
+# ${tool}_check_unsupported_p -- Check the compiler(/assembler/linker) output 
+#      for text indicating that the testcase should be marked as "unsupported"
+#
+# Utility used by mike-gcc.exp and c-torture.exp.
+# When dealing with a large number of tests, it's difficult to weed out the
+# ones that are too big for a particular cpu (eg: 16 bit with a small amount
+# of memory).  There are various ways to deal with this.  Here's one.
+# Fortunately, all of the cases where this is likely to happen will be using
+# gld so we can tell what the error text will look like.
+#
+
+proc ${tool}_check_unsupported_p { output } {
+    if [regexp "(^|\n)\[^\n\]*: region \[^\n\]* is full" $output] {
+       return "memory full"
+    }
+    return ""
+}
+
+#
+# runtest_file_p -- Provide a definition for older dejagnu releases
+#                  and assume the old syntax: foo1.exp bar1.c foo2.exp bar2.c.
+#                  (delete after next dejagnu release).
+#
+
+if { [info procs runtest_file_p] == "" } then {
+    proc runtest_file_p { runtests testcase } {
+       if { $runtests != "" && [regexp "\[.\]\[cC\]" $runtests] } then {
+           if { [lsearch $runtests [file tail $testcase]] >= 0 } then {
+               return 1
+           } else {
+               return 0
+           }
+       }
+       return 1
+    }
+}
index f26481e87b4b37ad171d60a203a1fe30c56b5e2e..e03f55916da11c1ada7c522313461a70c8f6eee2 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 1992, 1993, 1994, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
+# Copyright (C) 1992, 1993, 1994, 1996, 1997, 1999, 2000, 2001 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
@@ -27,6 +27,7 @@
 # we want to use libgloss so we can get find_gcc.
 load_lib libgloss.exp
 load_lib prune.exp
+load_lib gcc-defs.exp
 
 #
 # GCC_UNDER_TEST is the compiler under test.
@@ -68,8 +69,9 @@ proc default_gcc_version { } {
 }
 
 #
-# Call gcc_version. We do it this way so we can override it if needed.
+# gcc_version -- Call default_gcc_version, so we can override it if needed.
 #
+
 proc gcc_version { } {
     default_gcc_version;
 }
@@ -116,6 +118,10 @@ proc gcc_init { args } {
     }
 }
 
+#
+# gcc_target_compile -- compile a source file
+#
+
 proc gcc_target_compile { source dest type options } {
     global tmpdir;
     global gluefile wrap_flags;
@@ -148,147 +154,3 @@ proc gcc_target_compile { source dest type options } {
     lappend options "compiler=$GCC_UNDER_TEST"
     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
-#
-
-proc gcc_pass { testcase cflags } {
-    if { "$cflags" == "" } {
-       pass "$testcase"
-    } else {
-       pass "$testcase, $cflags"
-    }
-}
-
-#
-# gcc_fail -- utility to record a testcase failed
-#
-
-proc gcc_fail { testcase cflags } {
-    if { "$cflags" == "" } {
-       fail "$testcase"
-    } else {
-       fail "$testcase, $cflags"
-    }
-}
-
-#
-# gcc_finish -- called at the end of every .exp script that calls gcc_init
-#
-# The purpose of this proc is to hide all quirks of the testing environment
-# from the testsuites.  It also exists to undo anything that gcc_init did
-# (that needs undoing).
-#
-
-proc gcc_finish { } {
-    # The testing harness apparently requires this.
-    global errorInfo;
-
-    if [info exists errorInfo] then {
-       unset errorInfo
-    }
-
-    # Might as well reset these (keeps our caller from wondering whether
-    # s/he has to or not).
-    global prms_id bug_id
-    set prms_id 0
-    set bug_id 0
-}
-
-proc gcc_exit { } {
-    global gluefile;
-
-    if [info exists gluefile] {
-       file_on_build delete $gluefile;
-       unset gluefile;
-    }
-}
-    
-# If this is an older version of dejagnu (without runtest_file_p),
-# provide one and assume the old syntax: foo1.exp bar1.c foo2.exp bar2.c.
-# This can be deleted after next dejagnu release.
-
-if { [info procs runtest_file_p] == "" } then {
-    proc runtest_file_p { runtests testcase } {
-       if { $runtests != "" && [regexp "\[.\]\[cC\]" $runtests] } then {
-           if { [lsearch $runtests [file tail $testcase]] >= 0 } then {
-               return 1
-           } else {
-               return 0
-           }
-       }
-       return 1
-    }
-}
-
-# Utility used by mike-gcc.exp and c-torture.exp.
-# Check the compiler(/assembler/linker) output for text indicating that
-# the testcase should be marked as "unsupported".
-#
-# When dealing with a large number of tests, it's difficult to weed out the
-# ones that are too big for a particular cpu (eg: 16 bit with a small amount
-# of memory).  There are various ways to deal with this.  Here's one.
-# Fortunately, all of the cases where this is likely to happen will be using
-# gld so we can tell what the error text will look like.
-
-proc ${tool}_check_unsupported_p { output } {
-    if [regexp "(^|\n)\[^\n\]*: region \[^\n\]* is full" $output] {
-       return "memory full"
-    }
-    return ""
-}