On 7/15/11, Gabriel Charette <gch...@google.com> wrote:
> This patch adds an expected checksum for the tests expecting an asm diff.
>
> This way if we were expecting an asm diff, still get one, but a different
> one, we know (before this patch we would ignore this, generating an XFAIL as
> usual, as the status of "having an asm diff" itself hadn't changed).
>
> I had to change from using the TCL grep to the bash grep (through an exec
> call) as I now need the actual output of the grep call, not only the return
> value (it also turns out the return value for TCL grep and bash grep are
> different; hence the change in the if statements on the adiff variable)
>
> Gab
>
> 2011-07-15  Gabriel Charette  <gch...@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..1d7deed 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 differ: 
> expected
> $expectedSum, actual $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
>

Needs shortening of message.  Otherwise, LGTM.

-- 
Lawrence Crowl

Reply via email to