diff mbox

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

Message ID 20110715230055.EC6331C1EB7@gchare.mtv.corp.google.com
State New
Headers show

Commit Message

Gab Charette July 15, 2011, 11 p.m. UTC
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.


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

Comments

Andreas Schwab July 16, 2011, 7:59 a.m. UTC | #1
gchare@google.com (Gabriel Charette) writes:

> +	    set expectedSum [exec tr -d \} << [exec cut -f 4 -d\  << $xdiff_entry]]
> +	    set actualSum [exec cut -f 1 -d\  << [exec sum << $diff_result]]

You don't need cut and tr if you have tcl.

Andreas.
Gab Charette July 18, 2011, 9:46 p.m. UTC | #2
On Sat, Jul 16, 2011 at 12:59 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:
>
> gchare@google.com (Gabriel Charette) writes:
>
> > +         set expectedSum [exec tr -d \} << [exec cut -f 4 -d\  << $xdiff_entry]]

$xdiffentry is set to something like {{pph asm diff 123456}}, so i
need tr and cut to extract 123456

(i tried removing the tr and i get "123456}")

>
> > +         set actualSum [exec cut -f 1 -d\  << [exec sum << $diff_result]]

and the sum of $diff_result is something like "123456     12", i'm
ignoring the second number for simplicity; hence why i'm using cut
here.

If there are ways to do this directly in TCL, without using exec
calls, I'd be glad to know.

Gabriel
Andreas Schwab July 18, 2011, 10:05 p.m. UTC | #3
Gabriel Charette <gchare@google.com> writes:

> On Sat, Jul 16, 2011 at 12:59 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:
>>
>> gchare@google.com (Gabriel Charette) writes:
>>
>> > +         set expectedSum [exec tr -d \} << [exec cut -f 4 -d\  << $xdiff_entry]]
>
> $xdiffentry is set to something like {{pph asm diff 123456}}, so i
> need tr and cut to extract 123456

tcl can everything tr and cut can do (with the above options anyway).

> If there are ways to do this directly in TCL, without using exec
> calls, I'd be glad to know.

Read split(n) and string(n).

Andreas.
Gab Charette July 18, 2011, 11:38 p.m. UTC | #4
On Mon, Jul 18, 2011 at 3:05 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> Gabriel Charette <gchare@google.com> writes:
>
>> On Sat, Jul 16, 2011 at 12:59 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:
>>>
>>> gchare@google.com (Gabriel Charette) writes:
>>>
>>> > +         set expectedSum [exec tr -d \} << [exec cut -f 4 -d\  << $xdiff_entry]]
>>
>> $xdiffentry is set to something like {{pph asm diff 123456}}, so i
>> need tr and cut to extract 123456
>
> tcl can everything tr and cut can do (with the above options anyway).
>
>> If there are ways to do this directly in TCL, without using exec
>> calls, I'd be glad to know.
>
> Read split(n) and string(n).
>

Thanks for the suggestion,
suggested changes made as part of issue 4768041.

Gabriel
diff mbox

Patch

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"
     }
 }