diff mbox series

[[PATCH,V9] 2/7] dejagnu: modularize gcc-dg-debug-runtest a bit

Message ID 20210531165802.5686-3-jose.marchesi@oracle.com
State New
Headers show
Series [[PATCH,V9] 2/7] dejagnu: modularize gcc-dg-debug-runtest a bit | expand

Commit Message

Jose E. Marchesi May 31, 2021, 4:57 p.m. UTC
Move some functionality into a procedure of its own. This is only so that when
the patch for ctf comes along, the gcc-dg-debug-runtest procedure looks bit
more uniform.

gcc/testsuite/ChangeLog:

	* lib/gcc-dg.exp (gcc-dg-target-supports-debug-format): New procedure.
---
 gcc/testsuite/lib/gcc-dg.exp | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

Comments

Richard Biener June 21, 2021, 1:47 p.m. UTC | #1
On Mon, May 31, 2021 at 7:15 PM Jose E. Marchesi via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Move some functionality into a procedure of its own. This is only so that when
> the patch for ctf comes along, the gcc-dg-debug-runtest procedure looks bit
> more uniform.

OK (you can apply this separately).

Richard.

> gcc/testsuite/ChangeLog:
>
>         * lib/gcc-dg.exp (gcc-dg-target-supports-debug-format): New procedure.
> ---
>  gcc/testsuite/lib/gcc-dg.exp | 23 ++++++++++++++++-------
>  1 file changed, 16 insertions(+), 7 deletions(-)
>
> diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
> index fce0989cd9c..c7722ba07da 100644
> --- a/gcc/testsuite/lib/gcc-dg.exp
> +++ b/gcc/testsuite/lib/gcc-dg.exp
> @@ -621,18 +621,27 @@ proc gcc-dg-runtest { testcases flags default-extra-flags } {
>      }
>  }
>
> -proc gcc-dg-debug-runtest { target_compile trivial opt_opts testcases } {
> +# Check if the target system supports the debug format
> +proc gcc-dg-target-supports-debug-format { target_compile trivial type } {
>      global srcdir subdir
>
> +    set comp_output [$target_compile \
> +           "$srcdir/$subdir/$trivial" "trivial.S" assembly \
> +           "additional_flags=$type"]
> +    if { ! [string match "*: target system does not support the * debug format*" \
> +           $comp_output] } {
> +       remove-build-file "trivial.S"
> +       return 1
> +    }
> +    return 0
> +}
> +
> +proc gcc-dg-debug-runtest { target_compile trivial opt_opts testcases } {
>      if ![info exists DEBUG_TORTURE_OPTIONS] {
>         set DEBUG_TORTURE_OPTIONS ""
>         foreach type {-gdwarf-2 -gstabs -gstabs+ -gxcoff -gxcoff+} {
> -           set comp_output [$target_compile \
> -                   "$srcdir/$subdir/$trivial" "trivial.S" assembly \
> -                   "additional_flags=$type"]
> -           if { ! [string match "*: target system does not support the * debug format*" \
> -                   $comp_output] } {
> -               remove-build-file "trivial.S"
> +           if [expr [gcc-dg-target-supports-debug-format \
> +                     $target_compile $trivial $type]] {
>                 foreach level {1 "" 3} {
>                     if { ($type == "-gdwarf-2") && ($level != "") } {
>                         lappend DEBUG_TORTURE_OPTIONS [list "${type}" "-g${level}"]
> --
> 2.25.0.2.g232378479e
>
diff mbox series

Patch

diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index fce0989cd9c..c7722ba07da 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -621,18 +621,27 @@  proc gcc-dg-runtest { testcases flags default-extra-flags } {
     }
 }
 
-proc gcc-dg-debug-runtest { target_compile trivial opt_opts testcases } {
+# Check if the target system supports the debug format
+proc gcc-dg-target-supports-debug-format { target_compile trivial type } {
     global srcdir subdir
 
+    set comp_output [$target_compile \
+	    "$srcdir/$subdir/$trivial" "trivial.S" assembly \
+	    "additional_flags=$type"]
+    if { ! [string match "*: target system does not support the * debug format*" \
+	    $comp_output] } {
+	remove-build-file "trivial.S"
+	return 1
+    }
+    return 0
+}
+
+proc gcc-dg-debug-runtest { target_compile trivial opt_opts testcases } {
     if ![info exists DEBUG_TORTURE_OPTIONS] {
 	set DEBUG_TORTURE_OPTIONS ""
 	foreach type {-gdwarf-2 -gstabs -gstabs+ -gxcoff -gxcoff+} {
-	    set comp_output [$target_compile \
-		    "$srcdir/$subdir/$trivial" "trivial.S" assembly \
-		    "additional_flags=$type"]
-	    if { ! [string match "*: target system does not support the * debug format*" \
-		    $comp_output] } {
-		remove-build-file "trivial.S"
+	    if [expr [gcc-dg-target-supports-debug-format \
+		      $target_compile $trivial $type]] {
 		foreach level {1 "" 3} {
 		    if { ($type == "-gdwarf-2") && ($level != "") } {
 			lappend DEBUG_TORTURE_OPTIONS [list "${type}" "-g${level}"]