OSDN Git Service

2005-08-06 James A. Morrison <phython@gcc.gnu.org>
authorphython <phython@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 6 Aug 2005 18:25:31 +0000 (18:25 +0000)
committerphython <phython@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 6 Aug 2005 18:25:31 +0000 (18:25 +0000)
        PR treelang/23072
        * Make-lang.in: Remove old testing cruft.

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

gcc/testsuite/treelang/ChangeLog
gcc/testsuite/treelang/output/output-1.c [moved from gcc/testsuite/treelang/a01gcci01.c with 100% similarity]
gcc/testsuite/treelang/output/output-1.out [moved from gcc/testsuite/treelang/a01gcco01runpgm with 100% similarity]
gcc/testsuite/treelang/output/output-1.tree [moved from gcc/testsuite/treelang/a01gcci01.tree with 100% similarity]
gcc/testsuite/treelang/output/output.exp [new file with mode: 0644]
gcc/testsuite/treelang/treetests.exp [deleted file]
gcc/treelang/ChangeLog
gcc/treelang/Make-lang.in

index 7eae886..1eb4cea 100644 (file)
@@ -1,8 +1,19 @@
-2005-07-23  James A. Morrrison  <phython@gcc.gnu.org>
+2005-08-06  James A. Morrison  <phython@gcc.gnu.org>
+
+       * treetests.exp: Remove.
+       * a01gcco01runpgm: Move to...
+       * output/output-1.out: here.
+       * a01gcci01.c: Move to...
+       * output/output-1.c: here.
+       * a01gcci01.tree: Move to...
+       * output/output-1.tree: here.
+       * output/output.exp: New.
+
+2005-07-23  James A. Morrison  <phython@gcc.gnu.org>
 
        * compile/var_defs.tree: Remove extra lines.
 
-2005-07-19  James A. Morrrison  <phython@gcc.gnu.org>
+2005-07-19  James A. Morrison  <phython@gcc.gnu.org>
 
        * compile/var_defs.tree: Remove duplicate variable.
        * compile/var_defs-2.tree: Add duplicate variable test.
diff --git a/gcc/testsuite/treelang/output/output.exp b/gcc/testsuite/treelang/output/output.exp
new file mode 100644 (file)
index 0000000..8284a8f
--- /dev/null
@@ -0,0 +1,58 @@
+proc test_treelang_output { testname srcfiles infile resfile args } {
+    set comp_output [treelang_target_compile $srcfiles $testname executable $args]
+    if { [treelang_check_compile $testname $args $testname $comp_output] == 0 } {
+       return 0;
+    }
+
+    verbose "Expected output is in $resfile"
+    set id [open $resfile r]
+    set expected ""
+    append expected [read $id]
+    close $id
+    set output ""
+    set output [exec $testname $infile]
+    regsub -all "\r" "$output" "" output
+    regsub "\n*$" $expected "" expected
+    regsub "\n*$" $output "" output
+    regsub "^\n*" $expected "" expected
+    regsub "^\n*" $output "" output
+    regsub -all "\[ \t\]\[ \t\]*" $expected " " expected
+    regsub -all "\[ \t\]*\n\n*" $expected "\n" expected
+    regsub -all "\[ \t\]\[ \t\]*" $output " " output
+    regsub -all "\[ \t\]*\n\n*" $output "\n" output
+    verbose "expected is $expected"
+    verbose "actual is $output"
+
+    if { $expected == $output } {
+       pass $testname
+    } else {
+        fail $testname
+    }
+    exec rm $testname
+}
+global srcdir subdir
+
+catch { lsort [glob -nocomplain ${srcdir}/${subdir}/*.out] } outfiles
+verbose "Output files are $outfiles"
+
+set prefix ""
+foreach x $outfiles {
+    regsub "\\.out$" $x "" prefix
+    set bname [file tail $prefix]
+
+    if [file exists ${prefix}.inp] {
+       set inpfile ${prefix}.inp
+    } else {
+       set inpfile ""
+    }
+
+    verbose "inpfile is $inpfile"
+
+    set srcfiles [lsort [glob -nocomplain ${prefix}.{c,tree}]]
+    verbose "source files are $srcfiles"
+    test_treelang_output "treelang/$bname" $srcfiles $inpfile $x ""
+}
+
+# Local Variables:
+# tcl-indent-level:4
+# End:
diff --git a/gcc/testsuite/treelang/treetests.exp b/gcc/testsuite/treelang/treetests.exp
deleted file mode 100644 (file)
index 4fe9bce..0000000
+++ /dev/null
@@ -1,307 +0,0 @@
-
-# Tests for treelang; run from gcc/treelang/Make-lang.in => gcc/Makefile
-# find ttt for the actual tests
-
-# Copyright (C) 1999, 2000, 2001, 2002 by The Free Software Foundation
-
-# 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, 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, 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
-#
-# In other words, you are welcome to use, share and improve this program.
-# You are forbidden to forbid anyone else to use, share and improve
-# what you give them.   Help stamp out software-hoarding!  
-
-# Check the pgm is even there and set up the basics
-proc init_utility {pgm} {
-    global transform
-    global pgm_actual
-    global pgm_base
-    global fix_progname
-    global path
-# maybe add "X" to front of fail to say it is an expected failure
-    global X
-
-    set pgm_base ${pgm}
-    set pgm_actual ${pgm}
-
-    if { ${transform} != "s,x,x,"} {
-        verbose "1. program name was ${pgm}" 2
-        set sed_rc [catch {eval exec sed -e "${transform}" <<${pgm} } catch_res]
-        if { ${sed_rc} != "0" } {
-            verbose "2. Program name transform failed rc=${sed_rc} stat=${catch_res}" 1
-            ${X}fail "${pgm} sed"
-            return 0
-        }
-        set pgm_actual ${catch_res}
-        verbose "3. program name after transformation is ${pgm_actual}" 2
-    }
-
-    set which_rc [catch {exec which ${pgm_actual}} stat]
-    if { ${which_rc} != "0" } {
-        verbose "4. ${pgm_base} cannot be found rc=${which_rc} stat=${stat}" 1
-        ${X}fail "${pgm} = ${pgm_actual} not found in path (${path})"
-        return 0
-    }
-    set fix_progname "s,${pgm_actual},${pgm_base},"
-    verbose "5. fix program name value = ${fix_progname}" 4
-    return 1
-}
-
-#run pgm, option to remove file names from outputs
-proc run3 {srcdd testdd parms group_nbr item_nbr nonzero_RC_expected check_file sanitize_output tree1 pipe} {
-
-    global transform
-    global pgm_actual
-    global pgm_base
-    global fix_progname
-    global X
-    global extras
-
-    set error_msg 0
-    set basefile "a${group_nbr}${pgm_base}.out${item_nbr}"
-    set infile  ""
-    set outfile  ""
-    set suffix ""
-    set temp_extras "-O3 "
-    set real_pgm_actual ${pgm_actual}
-
-    if  {${tree1} > 0} {
-        if {"${pgm_actual}" == "gcc"} {
-            set real_pgm_actual "xgcc"
-            set temp_extras "${extras}"
-        }
-        set infile "${srcdd}/a${group_nbr}${pgm_base}i${item_nbr}.tree"
-        set mainfile "${srcdd}/a${group_nbr}${pgm_base}i${item_nbr}.c"
-        set outfile "-o ${testdd}/a${group_nbr}${pgm_base}o${item_nbr}${suffix}"
-    }
-    
-    verbose "6. exec ${real_pgm_actual} ${temp_extras} ${parms} ${mainfile} ${infile} ${outfile} >${testdd}/${basefile} 2>${testdd}/${basefile}err" 2
-    set run_rc [catch {eval exec ${real_pgm_actual} ${temp_extras} ${parms} ${mainfile} ${infile} ${outfile} >${testdd}/${basefile} 2>${testdd}/${basefile}err} catch_res]
-    if {${run_rc} == 1} {
-        if {${nonzero_RC_expected} == 0} {
-            verbose "7. ${real_pgm_actual} ${group_nbr} ${item_nbr} failed due to rc=${run_rc} status=${catch_res}" 1
-            ${X}fail "${pgm_base} ${group_nbr} ${item_nbr} rc!=0" 
-            return
-        } 
-    } else {
-        if {${nonzero_RC_expected} == 1} {
-            verbose "8. ${pgm_actual} ${group_nbr} ${item_nbr} failed - did not produce nonzero return code as expected rc=${run_rc} status=${catch_res}" 1
-            ${X}fail "${pgm_base} ${group_nbr} ${item_nbr} rc=0" 
-            return
-        } 
-    }
-
-# change the filenames to (file) in output if needed to allow testing
-    set checkfile1 "${srcdd}/${basefile}"
-    set checkfile2 "${testdd}/${basefile}"
-    if {${sanitize_output} != 0} {
-        set oldcheckfile1 "${checkfile1}"
-        set oldcheckfile2 "${checkfile2}"
-        set checkfile1 "${testdd}/${basefile}.test.nofilename"
-        set checkfile2 "${testdd}/${basefile}.run.nofilename"
-        set run_rc [catch {eval exec sed -f ${srcdd}/filefix.sed <${oldcheckfile1} >${checkfile1}} catch_res]
-        if {${run_rc} == 1} {
-            verbose "9. sed to cleanup filenames (std 1) in pgm output failed due to rc=${run_rc} status=${catch_res}" 1
-            if  {${error_msg} == 0} {
-                set error_msg "9. sed to cleanup filenames (std 1) in pgm output failed due to rc=${run_rc} status=${catch_res}"
-            }
-        }
-        set run_rc [catch {eval exec sed -f ${srcdd}/filefix.sed <${oldcheckfile2} | sed -e  "${fix_progname}"  >${checkfile2}} catch_res]
-        if {${run_rc} == 1} {
-            verbose "10. sed to cleanup filenames (std 2) in pgm output failed due to rc=${run_rc} status=${catch_res}" 1
-            if  {${error_msg} == 0} {
-                set error_msg "10. sed to cleanup filenames (std 2) in pgm output failed due to rc=${run_rc} status=${catch_res}" 
-            }
-        }
-    }
-    set diff [diff ${checkfile1} ${checkfile2}]
-    if {${diff} != 1} {
-        verbose "11. ${pgm_actual} ${group_nbr} ${item_nbr} diff stdout failed rc=${diff}" 1
-        if  {${error_msg} == 0} {
-            set error_msg "11. ${pgm_actual} ${group_nbr} ${item_nbr} diff stdout failed rc=${diff}"
-        }
-    }
-
-    set checkfile1 "${srcdd}/${basefile}err"
-    set checkfile2 "${testdd}/${basefile}err"
-    if {${sanitize_output} != 0} {
-        set oldcheckfile1 "${checkfile1}"
-        set oldcheckfile2 "${checkfile2}"
-        set checkfile1 "${testdd}/${basefile}err.test.nofilename"
-        set checkfile2 "${testdd}/${basefile}err.run.nofilename"
-        set run_rc [catch {eval exec sed -f ${srcdd}/filefix.sed <${oldcheckfile1} >${checkfile1}} catch_res]
-        if {${run_rc} == 1} {
-            verbose "12. sed to cleanup filenames (err 1) in pgm output failed due to rc=${run_rc} status=${catch_res}" 1
-            if  {${error_msg} == 0} {
-                set error_msg "12. sed to cleanup filenames (err 1) in pgm output failed due to rc=${run_rc} status=${catch_res}"
-            }
-        }
-        set run_rc [catch {eval exec sed -f ${srcdd}/filefix.sed <${oldcheckfile2} | sed -e  "${fix_progname}"  >${checkfile2}} catch_res]
-        if {${run_rc} == 1} {
-            verbose "13. sed to cleanup filenames (err 2) in pgm output failed due to rc=${run_rc} status=${catch_res}" 1
-            if  {${error_msg} == 0} {
-                set error_msg "13. sed to cleanup filenames (err 2) in pgm output failed due to rc=${run_rc} status=${catch_res}"
-            }
-        }
-    }
-    set diff [diff ${checkfile1} ${checkfile2}]
-    if {${diff} != 1} {
-        verbose "14. ${pgm_actual} ${group_nbr} ${item_nbr} diff stderr failed rc=${diff}" 1
-        if  {${error_msg} == 0} {
-            set error_msg "14. ${pgm_actual} ${group_nbr} ${item_nbr} diff stderr failed rc=${diff}"
-        }
-    }
-
-    if {${check_file} >0} {
-        if  {${tree1} == 0} {
-            set checkfile1 "${srcdd}/${basefile}file"
-            set checkfile2 "${testdd}/${basefile}file"
-            if {${sanitize_output} != 0} {
-                set oldcheckfile1 "${checkfile1}"
-                set oldcheckfile2 "${checkfile2}"
-                set checkfile1 "${testdd}/${basefile}file.test.nofilename"
-                set checkfile2 "${testdd}/${basefile}file.run.nofilename"
-                set run_rc [catch {eval exec sed -f ${srcdd}/filefix.sed <${oldcheckfile1} >${checkfile1}} catch_res]
-                if {${run_rc} == 1} {
-                    verbose "15. sed to cleanup filenames (err 1) in pgm stdout failed due to rc=${run_rc} status=${catch_res}" 1
-                    if  {${error_msg} == 0} {
-                        set error_msg "15. sed to cleanup filenames (err 1) in pgm stdout failed due to rc=${run_rc} status=${catch_res}"
-                    }
-                }
-                set run_rc [catch {eval exec sed -f ${srcdd}/filefix.sed <${oldcheckfile2} | sed -e  "${fix_progname}"  >${checkfile2}} catch_res]
-                if {${run_rc} == 1} {
-                    verbose "16. sed to cleanup filenames (err 2) in pgm stdout failed due to rc=${run_rc} status=${catch_res}" 1
-                    if  {${error_msg} == 0} {
-                        set error_msg "16. sed to cleanup filenames (err 2) in pgm stdout failed due to rc=${run_rc} status=${catch_res}"
-                    }
-                }
-            }
-            set diff [diff ${checkfile1} ${checkfile2}]
-            if {${diff} != 1} {
-                verbose "17. ${pgm_actual} ${group_nbr} ${item_nbr} diff stdout file failed rc=${diff}" 1
-                if  {${error_msg} == 0} {
-                    set error_msg "17. ${pgm_actual} ${group_nbr} ${item_nbr} diff stdout file failed rc=${diff}"
-                }
-            }
-        }
-    }
-    
-    if {${check_file} >1} {
-        if  {${tree1} == 0} {
-            set checkfile1 "${srcdd}/${outfile}"
-            set checkfile2 "${testdd}/${outfile}"
-            if {${sanitize_output} != 0} {
-                set oldcheckfile1 "${checkfile1}"
-                set oldcheckfile2 "${checkfile2}"
-                set checkfile1 "${testdd}/${basefile}out.test.nofilename"
-                set checkfile2 "${testdd}/${basefile}out.run.nofilename"
-                set run_rc [catch {eval exec sed -f ${srcdd}/filefix.sed <${oldcheckfile1} >${checkfile1}} catch_res]
-                if {${run_rc} == 1} {
-                    verbose "18. sed to cleanup filenames (err 1) in pgm output failed due to rc=${run_rc} status=${catch_res}" 1
-                    if  {${error_msg} == 0} {
-                        set error_msg "18. sed to cleanup filenames (err 1) in pgm output failed due to rc=${run_rc} status=${catch_res}"
-                    }
-                }
-                set run_rc [catch {eval exec sed -f ${srcdd}/filefix.sed <${oldcheckfile2} | sed -e  "${fix_progname}"  >${checkfile2}} catch_res]
-                if {${run_rc} == 1} {
-                    verbose "19. sed to cleanup filenames (err 2) in pgm output failed due to rc=${run_rc} status=${catch_res}" 1
-                    if  {${error_msg} == 0} {
-                        set error_msg "19. sed to cleanup filenames (err 2) in pgm output failed due to rc=${run_rc} status=${catch_res}"
-                    }
-                }
-            }
-            set diff [diff ${checkfile1} ${checkfile2}]
-            if {${diff} != 1} {
-                verbose "20. ${pgm_actual} ${group_nbr} ${item_nbr} diff output file failed rc=${diff}" 1
-                if  {${error_msg} == 0} {
-                    set error_msg "20. ${pgm_actual} ${group_nbr} ${item_nbr} diff output file failed rc=${diff}"
-                }
-            }
-        }
-    }
-    
-    if {${check_file} >2} {
-        set outfile "a${group_nbr}${pgm_base}o${item_nbr}${suffix}"
-        set pgmrun "${testdd}/a${group_nbr}${pgm_base}o${item_nbr}${suffix}"
-        set checkfile1 "${srcdd}/${outfile}runpgm"
-        set checkfile2 "${testdd}/${outfile}runpgm"
-        verbose "21. exec ${pgmrun} >${checkfile2} 2>${checkfile2}err" 2
-        set run_rc [catch {eval exec ${pgmrun} >${checkfile2} 2>${checkfile2}err} catch_res]
-        if {${run_rc} == 1} {
-            if {${nonzero_RC_expected} == 0} {
-                verbose "22. ${pgm_actual} ${group_nbr} ${item_nbr} failed due to rc=${run_rc} status=${catch_res}" 1
-                ${X}fail "${pgm_base} ${group_nbr} ${item_nbr} run" 
-                return
-            } 
-        } else {
-            if {${nonzero_RC_expected} == 1} {
-                verbose "23. ${pgm_actual} ${group_nbr} ${item_nbr} failed - did not produce nonzero return code as expected rc=${run_rc} status=${catch_res}" 1
-                ${X}fail "${pgm_base} ${group_nbr} ${item_nbr} run" 
-                return
-            } 
-        }
-        set diff [diff ${checkfile1} ${checkfile2}]
-        if {${diff} != 1} {
-            verbose "24. ${pgm_actual} ${group_nbr} ${item_nbr} diff run output file failed rc=${diff}" 1
-            if  {${error_msg} == 0} {
-                set error_msg "24. ${pgm_actual} ${group_nbr} ${item_nbr} diff run output file failed rc=${diff}"
-            }
-        }
-        set diff [diff ${checkfile1}err ${checkfile2}err]
-        if {${diff} != 1} {
-            verbose "25. ${pgm_actual} ${group_nbr} ${item_nbr} diff run stderr file failed rc=${diff}" 1
-            if  {${error_msg} == 0} {
-                set error_msg "25. ${pgm_actual} ${group_nbr} ${item_nbr} diff run stderr file failed rc=${diff}"
-            }
-        }
-    }
-
-    if {${error_msg}>0} {
-        ${X}fail "${pgm_base} ${group_nbr} ${item_nbr} fail code=${error_msg}" 
-    } else {
-        pass "${pgm_base} ${group_nbr} ${item_nbr}" 
-    }
-    return 
-}
-
-set extras "$env(gcc_extras)"
-set path $env(PATH)
-set transform $env(TRANSFORM)
-set srcdir $env(srcdir)
-verbose "source directory ${srcdir}\n" 2
-verbose "transform ${transform}\n" 2
-set sourcedir "${srcdir}/testsuite/treelang"
-set testdir "treelang"
-
-set pgm_actual ""
-
-# srcdd testdd parms group_nbr item_nbr nonzero_RC_expected check_file sanitize_output tree1
-
-# ttt
-
-#GCC - main C compiler tests via GCC
-
-set X ""
-
-set check_rc [init_utility "gcc"]
-
-if {${check_rc} == 1} {
-#
-#set X "x"
-set X ""
-run3 "${sourcedir}" "${testdir}" " -g -O3 --param ggc-min-heapsize=0 --param ggc-min-expand=0 " 01 01 0 3 0 1 0
-set X ""
-}
-
index 98b37f4..d020961 100644 (file)
@@ -1,3 +1,8 @@
+2005-08-06  James A. Morrison  <phython@gcc.gnu.org>
+
+       PR treelang/23072
+       * Make-lang.in: Remove old testing cruft.
+
 2005-06-25  Kelley Cook  <kcook@gcc.gnu.org>
 
        * all files: Update FSF address in copyright headers.
index 5b6d122..8e99dd7 100644 (file)
@@ -295,7 +295,6 @@ treelang.check: $(TESTSUITEDIR)/site.exp
 # these three files are empty and it seems diff has trouble generating
 # patch files for new empty files as required for cvs.
 # STAMP does not cut it here as I need an empty file.
-       touch $(srcdir)/testsuite/treelang/{a01gcco01runpgmerr,a01gcc.out01,a01gcc.out01err}
        -rootme=`${PWD_COMMAND}`; export rootme; \
        srcdir=`cd ${srcdir}; ${PWD_COMMAND}` ; export srcdir ; \
        cd testsuite; \
@@ -307,7 +306,6 @@ treelang.check: $(TESTSUITEDIR)/site.exp
        PATH=`cd ..;${PWD_COMMAND}`:$$PATH; export PATH; \
        gcc_extras="-B`cd ..;${PWD_COMMAND}` -B`cd ..;${PWD_COMMAND}`/treelang"; export gcc_extras; \
        $(RUNTEST) --tool treelang $(RUNTESTFLAGS)
-       rm $(srcdir)/testsuite/treelang/{a01gcco01runpgmerr,a01gcc.out01,a01gcc.out01err}
 
 # copy the output files from the current test to source ie say the new results are OK
 treelang.check.fix: force