[pph] Expect checksums for tests marked with pph asm xdiff (issue4744043)

Gabriel Charette gchare@google.com
Fri Jul 15 23:11:00 GMT 2011


Reviewed in person by Lawrence.

Shortened XFAIL message from previous patch.

Also, quick side note, in the first description of this patch I said I used "exec grep", I meant "exec diff".

Gab

2011-07-15  Gabriel Charette  <gchare@google.com>

	* g++.dg/pph/c1builtin-integral.cc: Add expected diff checksum.
	* g++.dg/pph/c1eabi1.cc: Add expected diff checksum.
	* g++.dg/pph/p4eabi1.cc: Add expected diff checksum.
	* lib/dg-pph.exp (dg-pph-pos): Expect checksums for pph asm xdiff.

diff --git a/gcc/testsuite/g++.dg/pph/c1builtin-integral.cc b/gcc/testsuite/g++.dg/pph/c1builtin-integral.cc
index c2fceec..6887b11 100644
--- a/gcc/testsuite/g++.dg/pph/c1builtin-integral.cc
+++ b/gcc/testsuite/g++.dg/pph/c1builtin-integral.cc
@@ -1,2 +1,2 @@
-// pph asm xdiff
+// pph asm xdiff 52758
 #include "c0builtin-integral.h"
diff --git a/gcc/testsuite/g++.dg/pph/c1eabi1.cc b/gcc/testsuite/g++.dg/pph/c1eabi1.cc
index b127f98..3321870 100644
--- a/gcc/testsuite/g++.dg/pph/c1eabi1.cc
+++ b/gcc/testsuite/g++.dg/pph/c1eabi1.cc
@@ -1,5 +1,5 @@
 // { dg-options "-w -fpermissive" }
-// pph asm xdiff
+// pph asm xdiff 36206
 
 #include "c0eabi1.h"
 
diff --git a/gcc/testsuite/g++.dg/pph/p4eabi1.cc b/gcc/testsuite/g++.dg/pph/p4eabi1.cc
index 4247f49..2f0715f 100644
--- a/gcc/testsuite/g++.dg/pph/p4eabi1.cc
+++ b/gcc/testsuite/g++.dg/pph/p4eabi1.cc
@@ -1,5 +1,5 @@
 // { dg-options "-w -fpermissive" }
-// pph asm xdiff
+// pph asm xdiff 15662
 
 #include "p4eabi1.h"
 
diff --git a/gcc/testsuite/lib/dg-pph.exp b/gcc/testsuite/lib/dg-pph.exp
index b706f27..b285ccf 100644
--- a/gcc/testsuite/lib/dg-pph.exp
+++ b/gcc/testsuite/lib/dg-pph.exp
@@ -128,12 +128,11 @@ proc dg-pph-pos { subdir test options mapflag suffix } {
     verbose -log ""
 
     # Compare the two assembly files.  They should be identical.
-    set adiff [diff "$bname.s-pph" "$bname.s+pph"]
+    set adiff [catch {exec diff "$bname.s-pph" "$bname.s+pph"} diff_result]
     # The sources mark when they expect the comparison to differ.
-    set xdiff [llength [grep $test "pph asm xdiff"]]
+    set xdiff_entry [grep $test "pph asm xdiff( )*\[0-9\]*"]
+    set xdiff [llength $xdiff_entry]
     if { $adiff == 0 } {
-	fail "$nshort $options comparison failure"
-    } elseif { $adiff == 1 } {
 	if { $xdiff } {
 	    xpass "$nshort $options (assembly comparison)"
 	} else {
@@ -141,11 +140,20 @@ proc dg-pph-pos { subdir test options mapflag suffix } {
 	}
 	file_on_host delete "$bname.s-pph"
 	file_on_host delete "$bname.s+pph"
-    } else {
+    } elseif { $adiff == 1 } {
+        verbose -log "Diff obtained:\n$diff_result"
 	if { $xdiff } {
-	    xfail "$nshort $options (assembly comparison)"
+	    set expectedSum [exec tr -d \} << [exec cut -f 4 -d\  << $xdiff_entry]]
+	    set actualSum [exec cut -f 1 -d\  << [exec sum << $diff_result]]
+	    if { $expectedSum == $actualSum } {
+	        xfail "$nshort $options (assembly comparison)"
+	    } else {
+	        fail "$nshort $options (assembly comparison, sums $expectedSum=>$actualSum)"
+	    }
 	} else {
 	    fail "$nshort $options (assembly comparison)"
 	}
+    } else {
+	fail "$nshort $options comparison failure"
     }
 }

--
This patch is available for review at http://codereview.appspot.com/4744043



More information about the Gcc-patches mailing list