diff mbox series

[testsuite/guality] Run guality tests with Og

Message ID 20180713110243.xw4dgqr6bx6hykjr@delia
State New
Headers show
Series [testsuite/guality] Run guality tests with Og | expand

Commit Message

Tom de Vries July 13, 2018, 11:02 a.m. UTC
Hi,

we advertise Og as the optimization level of choice for the standard
edit-compile-debug cycle, but do not run the guality tests for Og with the
default torture options.

This patch ensures that we test -Og in the guality tests.

F.i., for gcc.dg/guality there are 45 fails for Og (while there are none for
O1), in these test-cases:
...
gcc.dg/guality/pr54200.c
gcc.dg/guality/pr54970.c
gcc.dg/guality/pr56154-1.c
gcc.dg/guality/pr59776.c
gcc.dg/guality/sra-1.c
...

Tested gcc.dg/guality on c-only compiler, currently doing bootstrap and
reg-test on x86_64.

OK for trunk if no issues found during testing?

Thanks,
- Tom

[testsuite/guality] Run guality tests with Og

2018-07-13  Tom de Vries  <tdevries@suse.de>

	* lib/gcc-gdb-test.exp (guality_minimal_options): New proc.
	* g++.dg/guality/guality.exp: Ensure Og is part of torture options.
	* gcc.dg/guality/guality.exp: Same.
	* gfortran.dg/guality/guality.exp: Same.

---
 gcc/testsuite/g++.dg/guality/guality.exp      |  9 +++++++++
 gcc/testsuite/gcc.dg/guality/guality.exp      |  3 ++-
 gcc/testsuite/gfortran.dg/guality/guality.exp |  9 +++++++++
 gcc/testsuite/lib/gcc-gdb-test.exp            | 14 ++++++++++++++
 4 files changed, 34 insertions(+), 1 deletion(-)

Comments

Richard Biener July 13, 2018, 11:27 a.m. UTC | #1
On Fri, 13 Jul 2018, Tom de Vries wrote:

> Hi,
> 
> we advertise Og as the optimization level of choice for the standard
> edit-compile-debug cycle, but do not run the guality tests for Og with the
> default torture options.
> 
> This patch ensures that we test -Og in the guality tests.
> 
> F.i., for gcc.dg/guality there are 45 fails for Og (while there are none for
> O1), in these test-cases:
> ...
> gcc.dg/guality/pr54200.c
> gcc.dg/guality/pr54970.c
> gcc.dg/guality/pr56154-1.c
> gcc.dg/guality/pr59776.c
> gcc.dg/guality/sra-1.c
> ...
> 
> Tested gcc.dg/guality on c-only compiler, currently doing bootstrap and
> reg-test on x86_64.
> 
> OK for trunk if no issues found during testing?

OK.

Richard.

> Thanks,
> - Tom
> 
> [testsuite/guality] Run guality tests with Og
> 
> 2018-07-13  Tom de Vries  <tdevries@suse.de>
> 
> 	* lib/gcc-gdb-test.exp (guality_minimal_options): New proc.
> 	* g++.dg/guality/guality.exp: Ensure Og is part of torture options.
> 	* gcc.dg/guality/guality.exp: Same.
> 	* gfortran.dg/guality/guality.exp: Same.
> 
> ---
>  gcc/testsuite/g++.dg/guality/guality.exp      |  9 +++++++++
>  gcc/testsuite/gcc.dg/guality/guality.exp      |  3 ++-
>  gcc/testsuite/gfortran.dg/guality/guality.exp |  9 +++++++++
>  gcc/testsuite/lib/gcc-gdb-test.exp            | 14 ++++++++++++++
>  4 files changed, 34 insertions(+), 1 deletion(-)
> 
> diff --git a/gcc/testsuite/g++.dg/guality/guality.exp b/gcc/testsuite/g++.dg/guality/guality.exp
> index 4be22baa19c..757b20b61e2 100644
> --- a/gcc/testsuite/g++.dg/guality/guality.exp
> +++ b/gcc/testsuite/g++.dg/guality/guality.exp
> @@ -48,6 +48,14 @@ if ![info exists ::env(GUALITY_GDB_NAME)] {
>  }
>  report_gdb $::env(GUALITY_GDB_NAME) [info script]
>  
> +global DG_TORTURE_OPTIONS LTO_TORTURE_OPTIONS
> +set guality_dg_torture_options [guality_minimal_options $DG_TORTURE_OPTIONS]
> +torture-init
> +set-torture-options \
> +    $guality_dg_torture_options \
> +    [list {}] \
> +    $LTO_TORTURE_OPTIONS
> +
>  if {[check_guality "
>    #include \"$srcdir/$subdir/guality.h\"
>    volatile long int varl = 6;
> @@ -65,4 +73,5 @@ if [info exists guality_gdb_name] {
>      unsetenv GUALITY_GDB_NAME
>  }
>  
> +torture-finish
>  dg-finish
> diff --git a/gcc/testsuite/gcc.dg/guality/guality.exp b/gcc/testsuite/gcc.dg/guality/guality.exp
> index d9994341477..ca77a446f86 100644
> --- a/gcc/testsuite/gcc.dg/guality/guality.exp
> +++ b/gcc/testsuite/gcc.dg/guality/guality.exp
> @@ -62,7 +62,8 @@ proc guality_transform_options { args } {
>  }
>  
>  global DG_TORTURE_OPTIONS
> -set guality_dg_torture_options [guality_transform_options $DG_TORTURE_OPTIONS]
> +set guality_dg_torture_options [guality_minimal_options $DG_TORTURE_OPTIONS]
> +set guality_dg_torture_options [guality_transform_options $guality_dg_torture_options]
>  set guality_lto_torture_options [guality_transform_options $LTO_TORTURE_OPTIONS]
>  torture-init
>  set-torture-options \
> diff --git a/gcc/testsuite/gfortran.dg/guality/guality.exp b/gcc/testsuite/gfortran.dg/guality/guality.exp
> index f76347dd52f..f224cdfefa5 100644
> --- a/gcc/testsuite/gfortran.dg/guality/guality.exp
> +++ b/gcc/testsuite/gfortran.dg/guality/guality.exp
> @@ -29,10 +29,19 @@ if ![info exists ::env(GUALITY_GDB_NAME)] {
>  }
>  report_gdb $::env(GUALITY_GDB_NAME) [info script]
>  
> +global DG_TORTURE_OPTIONS LTO_TORTURE_OPTIONS
> +set guality_dg_torture_options [guality_minimal_options $DG_TORTURE_OPTIONS]
> +torture-init
> +set-torture-options \
> +    $guality_dg_torture_options \
> +    [list {}] \
> +    $LTO_TORTURE_OPTIONS
> +
>  gfortran-dg-runtest [lsort [glob $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ]] "" ""
>  
>  if [info exists guality_gdb_name] {
>      unsetenv GUALITY_GDB_NAME
>  }
>  
> +torture-finish
>  dg-finish
> diff --git a/gcc/testsuite/lib/gcc-gdb-test.exp b/gcc/testsuite/lib/gcc-gdb-test.exp
> index bb966d43023..b13d3ec7f85 100644
> --- a/gcc/testsuite/lib/gcc-gdb-test.exp
> +++ b/gcc/testsuite/lib/gcc-gdb-test.exp
> @@ -166,3 +166,17 @@ proc report_gdb { gdb loc } {
>      }
>      send_log -- "---\n$gdb_version\n---\n"
>  }
> +
> +# Argument 0 is the option list.
> +# Return the option list, ensuring that at least -Og is present.
> +
> +proc guality_minimal_options { args } {
> +    set options [lindex $args 0]
> +    foreach opt $options {
> +	if { [regexp -- "-Og" $opt] } {
> +	    return $options
> +	}
> +    }
> +    
> +    return [lappend options "-Og"]
> +}
> 
>
Tom de Vries July 15, 2018, 4:32 p.m. UTC | #2
On Fri, Jul 13, 2018 at 01:27:25PM +0200, Richard Biener wrote:
> On Fri, 13 Jul 2018, Tom de Vries wrote:
> 
> > Hi,
> > 
> > we advertise Og as the optimization level of choice for the standard
> > edit-compile-debug cycle, but do not run the guality tests for Og with the
> > default torture options.
> > 
> > This patch ensures that we test -Og in the guality tests.
> > 
> > F.i., for gcc.dg/guality there are 45 fails for Og (while there are none for
> > O1), in these test-cases:
> > ...
> > gcc.dg/guality/pr54200.c
> > gcc.dg/guality/pr54970.c
> > gcc.dg/guality/pr56154-1.c
> > gcc.dg/guality/pr59776.c
> > gcc.dg/guality/sra-1.c
> > ...
> > 
> > Tested gcc.dg/guality on c-only compiler, currently doing bootstrap and
> > reg-test on x86_64.
> > 
> > OK for trunk if no issues found during testing?
> 
> OK.
> 

I ran into problems with gfortran-dg-runtest, which unconditionally calls
torture-init.  I've made that conditional, similar to wat is done in
gcc-dg-runtest.

Committed to trunk as attached.

Thanks,
- Tom

[testsuite/guality] Run guality tests with Og

We advertise Og as the optimization level of choice for the standard
edit-compile-debug cycle, but do not run the guality tests for Og with the
default torture options.

This patch ensures that we test -Og in the guality tests.

F.i., for gcc.dg/guality there are 45 fails for Og (while there are none for
O1), in these test-cases:
...
gcc.dg/guality/pr54200.c
gcc.dg/guality/pr54970.c
gcc.dg/guality/pr56154-1.c
gcc.dg/guality/pr59776.c
gcc.dg/guality/sra-1.c
...

2018-07-13  Tom de Vries  <tdevries@suse.de>

	* lib/gcc-gdb-test.exp (guality_minimal_options): New proc.
	* lib/gfortran-dg.exp (gfortran-dg-runtest): Don't call torture-init if
	already called.
	* g++.dg/guality/guality.exp: Ensure Og is part of torture options.
	* gcc.dg/guality/guality.exp: Same.
	* gfortran.dg/guality/guality.exp: Same.

---
 gcc/testsuite/g++.dg/guality/guality.exp      |  9 +++++++++
 gcc/testsuite/gcc.dg/guality/guality.exp      |  3 ++-
 gcc/testsuite/gfortran.dg/guality/guality.exp |  7 +++++++
 gcc/testsuite/lib/gcc-gdb-test.exp            | 14 ++++++++++++++
 gcc/testsuite/lib/gfortran-dg.exp             | 18 +++++++++++++-----
 5 files changed, 45 insertions(+), 6 deletions(-)

diff --git a/gcc/testsuite/g++.dg/guality/guality.exp b/gcc/testsuite/g++.dg/guality/guality.exp
index 4be22baa19c..757b20b61e2 100644
--- a/gcc/testsuite/g++.dg/guality/guality.exp
+++ b/gcc/testsuite/g++.dg/guality/guality.exp
@@ -48,6 +48,14 @@ if ![info exists ::env(GUALITY_GDB_NAME)] {
 }
 report_gdb $::env(GUALITY_GDB_NAME) [info script]
 
+global DG_TORTURE_OPTIONS LTO_TORTURE_OPTIONS
+set guality_dg_torture_options [guality_minimal_options $DG_TORTURE_OPTIONS]
+torture-init
+set-torture-options \
+    $guality_dg_torture_options \
+    [list {}] \
+    $LTO_TORTURE_OPTIONS
+
 if {[check_guality "
   #include \"$srcdir/$subdir/guality.h\"
   volatile long int varl = 6;
@@ -65,4 +73,5 @@ if [info exists guality_gdb_name] {
     unsetenv GUALITY_GDB_NAME
 }
 
+torture-finish
 dg-finish
diff --git a/gcc/testsuite/gcc.dg/guality/guality.exp b/gcc/testsuite/gcc.dg/guality/guality.exp
index d9994341477..ca77a446f86 100644
--- a/gcc/testsuite/gcc.dg/guality/guality.exp
+++ b/gcc/testsuite/gcc.dg/guality/guality.exp
@@ -62,7 +62,8 @@ proc guality_transform_options { args } {
 }
 
 global DG_TORTURE_OPTIONS
-set guality_dg_torture_options [guality_transform_options $DG_TORTURE_OPTIONS]
+set guality_dg_torture_options [guality_minimal_options $DG_TORTURE_OPTIONS]
+set guality_dg_torture_options [guality_transform_options $guality_dg_torture_options]
 set guality_lto_torture_options [guality_transform_options $LTO_TORTURE_OPTIONS]
 torture-init
 set-torture-options \
diff --git a/gcc/testsuite/gfortran.dg/guality/guality.exp b/gcc/testsuite/gfortran.dg/guality/guality.exp
index f76347dd52f..eaa7ae770d6 100644
--- a/gcc/testsuite/gfortran.dg/guality/guality.exp
+++ b/gcc/testsuite/gfortran.dg/guality/guality.exp
@@ -29,10 +29,17 @@ if ![info exists ::env(GUALITY_GDB_NAME)] {
 }
 report_gdb $::env(GUALITY_GDB_NAME) [info script]
 
+global DG_TORTURE_OPTIONS
+set guality_dg_torture_options [guality_minimal_options $DG_TORTURE_OPTIONS]
+torture-init
+set-torture-options \
+    $guality_dg_torture_options \
+
 gfortran-dg-runtest [lsort [glob $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ]] "" ""
 
 if [info exists guality_gdb_name] {
     unsetenv GUALITY_GDB_NAME
 }
 
+torture-finish
 dg-finish
diff --git a/gcc/testsuite/lib/gcc-gdb-test.exp b/gcc/testsuite/lib/gcc-gdb-test.exp
index bb966d43023..b13d3ec7f85 100644
--- a/gcc/testsuite/lib/gcc-gdb-test.exp
+++ b/gcc/testsuite/lib/gcc-gdb-test.exp
@@ -166,3 +166,17 @@ proc report_gdb { gdb loc } {
     }
     send_log -- "---\n$gdb_version\n---\n"
 }
+
+# Argument 0 is the option list.
+# Return the option list, ensuring that at least -Og is present.
+
+proc guality_minimal_options { args } {
+    set options [lindex $args 0]
+    foreach opt $options {
+	if { [regexp -- "-Og" $opt] } {
+	    return $options
+	}
+    }
+    
+    return [lappend options "-Og"]
+}
diff --git a/gcc/testsuite/lib/gfortran-dg.exp b/gcc/testsuite/lib/gfortran-dg.exp
index 37fb4f00aa9..4aec0a5826e 100644
--- a/gcc/testsuite/lib/gfortran-dg.exp
+++ b/gcc/testsuite/lib/gfortran-dg.exp
@@ -124,10 +124,16 @@ proc gfortran-dg-prune { system text } {
 # as c-torture does.
 proc gfortran-dg-runtest { testcases flags default-extra-flags } {
     global runtests
-    global DG_TORTURE_OPTIONS torture_with_loops
-
-    torture-init
-    set-torture-options $DG_TORTURE_OPTIONS
+    global torture_with_loops
+
+    # Some callers set torture options themselves; don't override those.
+    set existing_torture_options [torture-options-exist]
+    if { $existing_torture_options == 0 } {
+	global DG_TORTURE_OPTIONS
+	torture-init
+	set-torture-options $DG_TORTURE_OPTIONS
+    }
+    dump-torture-options
 
     foreach test $testcases {
 	# If we're only testing specific files and this isn't one of
@@ -154,7 +160,9 @@ proc gfortran-dg-runtest { testcases flags default-extra-flags } {
 	}
     }
 
-    torture-finish
+    if { $existing_torture_options == 0 } {
+	torture-finish
+    }
 }
 
 proc gfortran-dg-debug-runtest { target_compile trivial opt_opts testcases } {
diff mbox series

Patch

diff --git a/gcc/testsuite/g++.dg/guality/guality.exp b/gcc/testsuite/g++.dg/guality/guality.exp
index 4be22baa19c..757b20b61e2 100644
--- a/gcc/testsuite/g++.dg/guality/guality.exp
+++ b/gcc/testsuite/g++.dg/guality/guality.exp
@@ -48,6 +48,14 @@  if ![info exists ::env(GUALITY_GDB_NAME)] {
 }
 report_gdb $::env(GUALITY_GDB_NAME) [info script]
 
+global DG_TORTURE_OPTIONS LTO_TORTURE_OPTIONS
+set guality_dg_torture_options [guality_minimal_options $DG_TORTURE_OPTIONS]
+torture-init
+set-torture-options \
+    $guality_dg_torture_options \
+    [list {}] \
+    $LTO_TORTURE_OPTIONS
+
 if {[check_guality "
   #include \"$srcdir/$subdir/guality.h\"
   volatile long int varl = 6;
@@ -65,4 +73,5 @@  if [info exists guality_gdb_name] {
     unsetenv GUALITY_GDB_NAME
 }
 
+torture-finish
 dg-finish
diff --git a/gcc/testsuite/gcc.dg/guality/guality.exp b/gcc/testsuite/gcc.dg/guality/guality.exp
index d9994341477..ca77a446f86 100644
--- a/gcc/testsuite/gcc.dg/guality/guality.exp
+++ b/gcc/testsuite/gcc.dg/guality/guality.exp
@@ -62,7 +62,8 @@  proc guality_transform_options { args } {
 }
 
 global DG_TORTURE_OPTIONS
-set guality_dg_torture_options [guality_transform_options $DG_TORTURE_OPTIONS]
+set guality_dg_torture_options [guality_minimal_options $DG_TORTURE_OPTIONS]
+set guality_dg_torture_options [guality_transform_options $guality_dg_torture_options]
 set guality_lto_torture_options [guality_transform_options $LTO_TORTURE_OPTIONS]
 torture-init
 set-torture-options \
diff --git a/gcc/testsuite/gfortran.dg/guality/guality.exp b/gcc/testsuite/gfortran.dg/guality/guality.exp
index f76347dd52f..f224cdfefa5 100644
--- a/gcc/testsuite/gfortran.dg/guality/guality.exp
+++ b/gcc/testsuite/gfortran.dg/guality/guality.exp
@@ -29,10 +29,19 @@  if ![info exists ::env(GUALITY_GDB_NAME)] {
 }
 report_gdb $::env(GUALITY_GDB_NAME) [info script]
 
+global DG_TORTURE_OPTIONS LTO_TORTURE_OPTIONS
+set guality_dg_torture_options [guality_minimal_options $DG_TORTURE_OPTIONS]
+torture-init
+set-torture-options \
+    $guality_dg_torture_options \
+    [list {}] \
+    $LTO_TORTURE_OPTIONS
+
 gfortran-dg-runtest [lsort [glob $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ]] "" ""
 
 if [info exists guality_gdb_name] {
     unsetenv GUALITY_GDB_NAME
 }
 
+torture-finish
 dg-finish
diff --git a/gcc/testsuite/lib/gcc-gdb-test.exp b/gcc/testsuite/lib/gcc-gdb-test.exp
index bb966d43023..b13d3ec7f85 100644
--- a/gcc/testsuite/lib/gcc-gdb-test.exp
+++ b/gcc/testsuite/lib/gcc-gdb-test.exp
@@ -166,3 +166,17 @@  proc report_gdb { gdb loc } {
     }
     send_log -- "---\n$gdb_version\n---\n"
 }
+
+# Argument 0 is the option list.
+# Return the option list, ensuring that at least -Og is present.
+
+proc guality_minimal_options { args } {
+    set options [lindex $args 0]
+    foreach opt $options {
+	if { [regexp -- "-Og" $opt] } {
+	    return $options
+	}
+    }
+    
+    return [lappend options "-Og"]
+}