Patchwork [pph] Fix executable test detection (issue4635087)

login
register
mail settings
Submitter Gab Charette
Date July 2, 2011, 12:45 a.m.
Message ID <20110702004518.EE2601C1CDF@gchare.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/102976/
State New
Headers show

Comments

Gab Charette - July 2, 2011, 12:45 a.m.
[string compare "dg-do-what" "run"] which was used before would always return true.

Thus the tests would no longer even get to the asm diff section...

Me and Lawrence tried to find a way to get the content of the "dg-do-what" variable, but couldn't.

We decided to revert to this quick hack fix for now (better then not running the asm diffs...)

(I also added an unrelated re-ordering to the order of the pph asm xdiff comment in c1varoder.cc)

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

	* g++.dg/pph/c1varorder.cc: Moved pph asm xdiff comment to top.
	* lib/dg-pph.exp (proc): Fixed executable test detection.


--
This patch is available for review at http://codereview.appspot.com/4635087
Lawrence Crowl - July 2, 2011, 12:46 a.m.
LGTM

On 7/1/11, Gabriel Charette <gchare@google.com> wrote:
> [string compare "dg-do-what" "run"] which was used before would always
> return true.
>
> Thus the tests would no longer even get to the asm diff section...
>
> Me and Lawrence tried to find a way to get the content of the "dg-do-what"
> variable, but couldn't.
>
> We decided to revert to this quick hack fix for now (better then not running
> the asm diffs...)
>
> (I also added an unrelated re-ordering to the order of the pph asm xdiff
> comment in c1varoder.cc)
>
> 2011-07-01  Gabriel Charette  <gchare@google.com>
>
> 	* g++.dg/pph/c1varorder.cc: Moved pph asm xdiff comment to top.
> 	* lib/dg-pph.exp (proc): Fixed executable test detection.
>
> diff --git a/gcc/testsuite/g++.dg/pph/c1varorder.cc
> b/gcc/testsuite/g++.dg/pph/c1varorder.cc
> index 2db8209..a7a65ec 100644
> --- a/gcc/testsuite/g++.dg/pph/c1varorder.cc
> +++ b/gcc/testsuite/g++.dg/pph/c1varorder.cc
> @@ -1,6 +1,7 @@
> -#include "c1varorder.h"
>  // pph asm xdiff
>
> +#include "c1varorder.h"
> +
>  int foo(void)
>  {
>    return var1 - var2;
> diff --git a/gcc/testsuite/lib/dg-pph.exp b/gcc/testsuite/lib/dg-pph.exp
> index b701ce2..e34bd63 100644
> --- a/gcc/testsuite/lib/dg-pph.exp
> +++ b/gcc/testsuite/lib/dg-pph.exp
> @@ -74,8 +74,11 @@ proc dg-pph-pos { subdir test options mapflag suffix } {
>      set dg-do-what-default compile
>      dg-test -keep-output $test "$options -I." ""
>
> +    # Determine whether this is an executable test
> +    set is_exec [llength [grep $test "dg-do run"]]
> +
>      # Executables do not generate assembly.
> -    if { ![string compare "dg-do-what" "run"] } {
> +    if { !$is_exec } {
>  	# Not executable, so quit if it did not compile successfully.
>  	if { ![file_on_host exists "$bname.s"] } {
>  	    fail "$nshort $options (regular assembly missing)"
> @@ -93,7 +96,7 @@ proc dg-pph-pos { subdir test options mapflag suffix } {
>      dg-test -keep-output $test "$options $mapflag -I." ""
>
>      # Executables do not generate assembly,
> -    if { [string compare "dg-do-what" "run"] } {
> +    if { $is_exec } {
>  	# and so we are done testing.
>  	return
>      }
>
> --
> This patch is available for review at http://codereview.appspot.com/4635087
>

Patch

diff --git a/gcc/testsuite/g++.dg/pph/c1varorder.cc b/gcc/testsuite/g++.dg/pph/c1varorder.cc
index 2db8209..a7a65ec 100644
--- a/gcc/testsuite/g++.dg/pph/c1varorder.cc
+++ b/gcc/testsuite/g++.dg/pph/c1varorder.cc
@@ -1,6 +1,7 @@ 
-#include "c1varorder.h"
 // pph asm xdiff
 
+#include "c1varorder.h"
+
 int foo(void)
 {
   return var1 - var2;
diff --git a/gcc/testsuite/lib/dg-pph.exp b/gcc/testsuite/lib/dg-pph.exp
index b701ce2..e34bd63 100644
--- a/gcc/testsuite/lib/dg-pph.exp
+++ b/gcc/testsuite/lib/dg-pph.exp
@@ -74,8 +74,11 @@  proc dg-pph-pos { subdir test options mapflag suffix } {
     set dg-do-what-default compile
     dg-test -keep-output $test "$options -I." ""
 
+    # Determine whether this is an executable test
+    set is_exec [llength [grep $test "dg-do run"]]
+
     # Executables do not generate assembly.
-    if { ![string compare "dg-do-what" "run"] } {
+    if { !$is_exec } {
 	# Not executable, so quit if it did not compile successfully.
 	if { ![file_on_host exists "$bname.s"] } {
 	    fail "$nshort $options (regular assembly missing)"
@@ -93,7 +96,7 @@  proc dg-pph-pos { subdir test options mapflag suffix } {
     dg-test -keep-output $test "$options $mapflag -I." ""
 
     # Executables do not generate assembly,
-    if { [string compare "dg-do-what" "run"] } {
+    if { $is_exec } {
 	# and so we are done testing.
 	return
     }