This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa, LNO] Analysis of scalar evolutions and data dependences
- From: Pop Sébastian <pop at gauvain dot u-strasbg dot fr>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 12 Dec 2003 12:11:54 +0100
- Subject: Re: [tree-ssa, LNO] Analysis of scalar evolutions and data dependences
- References: <20031209095916.GA18530@gauvain.u-strasbg.fr>
Second hunk that is a good candidate for going into tree-ssa.
In some cases it is simpler to expect that the whole dump file
matches. For this you save a copy of the expected output in the same
directory as the testcase.
I find this simpler to use and maintain testcases than writing long
regexps with lots of backslashes.
2003-12-12 Sebastian Pop <s.pop@laposte.net>
* testsuite/lib/scantree.exp (diff-tree-dumps): New.
Index: scantree.exp
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/lib/Attic/scantree.exp,v
retrieving revision 1.1.2.2
diff -d -u -p -r1.1.2.2 scantree.exp
--- scantree.exp 10 Jul 2003 23:19:57 -0000 1.1.2.2
+++ scantree.exp 12 Dec 2003 11:00:58 -0000
@@ -19,6 +19,51 @@
#
# This is largely borrowed from scanasm.exp.
+# Utility for diffing compiler result against an expected output file.
+# Invoked via dg-final. Call pass if there are no differences between
+# the output of the compiler and the expected output file, otherwise
+# fail. The expected output file has the same name as the output
+# file, and is stored in the same directory as the testcase.
+#
+# Argument 0 is the suffix for the tree dump file
+# Argument 1 handles expected failures and the like
+proc diff-tree-dumps { args } {
+ if { [llength $args] < 1 } {
+ error "diff-tree-dumps: too few arguments"
+ return
+ }
+ if { [llength $args] > 2 } {
+ error "diff-tree-dumps:: too many arguments"
+ return
+ }
+ if { [llength $args] >= 2 } {
+ switch [dg-process-target [lindex $args 1]] {
+ "S" { }
+ "N" { return }
+ "F" { setup_xfail "*-*-*" }
+ "P" { }
+ }
+ }
+
+ # This assumes that we are two frames down from dg-test, and that
+ # it still stores the filename of the testcase in a local variable "name".
+ # A cleaner solution would require a new dejagnu release.
+ upvar 2 prog testcase
+
+ # This must match the rule in gcc-dg.exp.
+ set new_file "[glob [file tail $testcase].t??.[lindex $args 0]]"
+ set reference_file "[glob $testcase.[lindex $args 0]]"
+
+ set test_result [diff $reference_file $new_file]
+
+ if { $test_result == 1 } {
+ pass "$testcase diff-tree-dumps [lindex $args 0]"
+ } else {
+ fail "$testcase diff-tree-dumps [lindex $args 0]"
+ local_exec (diff $reference_file $new_file 0);
+ }
+}
+
# Utility for scanning compiler result, invoked via dg-final.
# Call pass if pattern is present, otherwise fail.
#