public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Skip module_cmi_p and related unsupported module test
@ 2023-02-17  6:55 Alexandre Oliva
  2023-02-20  4:27 ` Jason Merrill
  0 siblings, 1 reply; 15+ messages in thread
From: Alexandre Oliva @ 2023-02-17  6:55 UTC (permalink / raw)
  To: gcc-patches; +Cc: ro, mikestump, jason, nathan


When a multi-source module is found to be unsupported, we fail
module_cmi_p and subsequent sources.  Override proc unsupported to
mark the result in module_do, and test it to skip module_cmp_p and
subsequent related tests.

Regstrapped on x86_64-linux-gnu.
Tested on arm-vxworks7 (gcc-12) and arm-eabi (trunk).  Ok to install?

for  gcc/testsuite/ChangeLog

	* g++.dg/modules/modules.exp: Override unsupported to update
	module_do, and test it after dg-test.
---
 gcc/testsuite/g++.dg/modules/modules.exp |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/gcc/testsuite/g++.dg/modules/modules.exp b/gcc/testsuite/g++.dg/modules/modules.exp
index 61994b059457b..ba1287427bf05 100644
--- a/gcc/testsuite/g++.dg/modules/modules.exp
+++ b/gcc/testsuite/g++.dg/modules/modules.exp
@@ -315,6 +315,14 @@ proc module-check-requirements { tests } {
 # cleanup any detritus from previous run
 cleanup_module_files [find $DEFAULT_REPO *.gcm]
 
+set module_do {"compile" "P"}
+rename unsupported saved-unsupported
+proc unsupported { args } {
+    global module_do
+    lset module_do 1 "N"
+    return [saved-unsupported $args]
+}
+
 # not grouped tests, sadly tcl doesn't have negated glob
 foreach test [prune [lsort [find $srcdir/$subdir {*.[CH]}]] \
 		  "$srcdir/$subdir/*_?.\[CH\]"] {
@@ -327,6 +335,9 @@ foreach test [prune [lsort [find $srcdir/$subdir {*.[CH]}]] \
 	    set module_cmis {}
 	    verbose "Testing $nshort $std" 1
 	    dg-test $test "$std" $DEFAULT_MODFLAGS
+	    if { [lindex $module_do 1] == "N" } {
+		continue
+	    }
 	    set testcase [string range $test [string length "$srcdir/"] end]
 	    cleanup_module_files [module_cmi_p $testcase $module_cmis]
 	}
@@ -372,6 +383,9 @@ foreach src [lsort [find $srcdir/$subdir {*_a.[CHX}]] {
 			}
 		    }
 		    dg-test -keep-output $test "$std" $DEFAULT_MODFLAGS
+		    if { [lindex $module_do 1] == "N" } {
+			break
+		    }
 		    set testcase [string range $test [string length "$srcdir/"] end]
 		    lappend mod_files [module_cmi_p $testcase $module_cmis]
 		}

-- 
Alexandre Oliva, happy hacker                https://FSFLA.org/blogs/lxo/
   Free Software Activist                       GNU Toolchain Engineer
Disinformation flourishes because many people care deeply about injustice
but very few check the facts.  Ask me about <https://stallmansupport.org>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Skip module_cmi_p and related unsupported module test
  2023-02-17  6:55 [PATCH] Skip module_cmi_p and related unsupported module test Alexandre Oliva
@ 2023-02-20  4:27 ` Jason Merrill
  2023-02-22 17:33   ` Alexandre Oliva
  0 siblings, 1 reply; 15+ messages in thread
From: Jason Merrill @ 2023-02-20  4:27 UTC (permalink / raw)
  To: Alexandre Oliva, gcc-patches; +Cc: ro, mikestump, nathan

On 2/17/23 22:55, Alexandre Oliva wrote:
> 
> When a multi-source module is found to be unsupported, we fail
> module_cmi_p and subsequent sources.  Override proc unsupported to
> mark the result in module_do, and test it to skip module_cmp_p and
> subsequent related tests.

Hmm, I guess the problem that the modules tests are trying to use 
dg-test as a subroutine, and can't get at the result of the test to skip 
later processing?  Seems like LTO deals with the same issue by not using 
dg-test at all.

This seems like an ugly kludge around that problem, but I don't have any 
clever ideas of a better approach short of rewriting everything.  So, OK 
with a comment explaining the rationale above your overridden "unsupported".

Also, your commit subject line needs a subsystem tag, I guess 
"testsuite:" in this case.

> Regstrapped on x86_64-linux-gnu.
> Tested on arm-vxworks7 (gcc-12) and arm-eabi (trunk).  Ok to install?
> 
> for  gcc/testsuite/ChangeLog
> 
> 	* g++.dg/modules/modules.exp: Override unsupported to update
> 	module_do, and test it after dg-test.
> ---
>   gcc/testsuite/g++.dg/modules/modules.exp |   14 ++++++++++++++
>   1 file changed, 14 insertions(+)
> 
> diff --git a/gcc/testsuite/g++.dg/modules/modules.exp b/gcc/testsuite/g++.dg/modules/modules.exp
> index 61994b059457b..ba1287427bf05 100644
> --- a/gcc/testsuite/g++.dg/modules/modules.exp
> +++ b/gcc/testsuite/g++.dg/modules/modules.exp
> @@ -315,6 +315,14 @@ proc module-check-requirements { tests } {
>   # cleanup any detritus from previous run
>   cleanup_module_files [find $DEFAULT_REPO *.gcm]
>   
> +set module_do {"compile" "P"}
> +rename unsupported saved-unsupported
> +proc unsupported { args } {
> +    global module_do
> +    lset module_do 1 "N"
> +    return [saved-unsupported $args]
> +}
> +
>   # not grouped tests, sadly tcl doesn't have negated glob
>   foreach test [prune [lsort [find $srcdir/$subdir {*.[CH]}]] \
>   		  "$srcdir/$subdir/*_?.\[CH\]"] {
> @@ -327,6 +335,9 @@ foreach test [prune [lsort [find $srcdir/$subdir {*.[CH]}]] \
>   	    set module_cmis {}
>   	    verbose "Testing $nshort $std" 1
>   	    dg-test $test "$std" $DEFAULT_MODFLAGS
> +	    if { [lindex $module_do 1] == "N" } {
> +		continue
> +	    }
>   	    set testcase [string range $test [string length "$srcdir/"] end]
>   	    cleanup_module_files [module_cmi_p $testcase $module_cmis]
>   	}
> @@ -372,6 +383,9 @@ foreach src [lsort [find $srcdir/$subdir {*_a.[CHX}]] {
>   			}
>   		    }
>   		    dg-test -keep-output $test "$std" $DEFAULT_MODFLAGS
> +		    if { [lindex $module_do 1] == "N" } {
> +			break
> +		    }
>   		    set testcase [string range $test [string length "$srcdir/"] end]
>   		    lappend mod_files [module_cmi_p $testcase $module_cmis]
>   		}
> 


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Skip module_cmi_p and related unsupported module test
  2023-02-20  4:27 ` Jason Merrill
@ 2023-02-22 17:33   ` Alexandre Oliva
  2023-02-23 14:18     ` [PATCH] testsuite: Fix up modules.exp [PR108899] Jakub Jelinek
  0 siblings, 1 reply; 15+ messages in thread
From: Alexandre Oliva @ 2023-02-22 17:33 UTC (permalink / raw)
  To: Jason Merrill; +Cc: gcc-patches, ro, mikestump, nathan

On Feb 20, 2023, Jason Merrill <jason@redhat.com> wrote:

> This seems like an ugly kludge around that problem, but I don't have
> any clever ideas of a better approach short of rewriting everything.
> So, OK with a comment explaining the rationale above your overridden
> "unsupported".

> Also, your commit subject line needs a subsystem tag, I guess
> "testsuite:" in this case.

*nod*, thanks, I'm checking in the adjusted patch below.


testsuite: Skip module_cmi_p and related unsupported module test

From: Alexandre Oliva <oliva@adacore.com>

When a multi-source module is found to be unsupported, we fail
module_cmi_p and subsequent sources.  Override proc unsupported to
mark the result in module_do, and test it to skip module_cmp_p and
subsequent related tests.


for  gcc/testsuite/ChangeLog

	* g++.dg/modules/modules.exp: Override unsupported to update
	module_do, and test it after dg-test.
---
 gcc/testsuite/g++.dg/modules/modules.exp |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/gcc/testsuite/g++.dg/modules/modules.exp b/gcc/testsuite/g++.dg/modules/modules.exp
index 61994b059457b..e66b2082f2055 100644
--- a/gcc/testsuite/g++.dg/modules/modules.exp
+++ b/gcc/testsuite/g++.dg/modules/modules.exp
@@ -315,6 +315,17 @@ proc module-check-requirements { tests } {
 # cleanup any detritus from previous run
 cleanup_module_files [find $DEFAULT_REPO *.gcm]
 
+# Override unsupported to set the second element of module_do to "N",
+# so that, after an unsupported result in dg-test, we can skip rather
+# than fail subsequent related tests.
+set module_do {"compile" "P"}
+rename unsupported saved-unsupported
+proc unsupported { args } {
+    global module_do
+    lset module_do 1 "N"
+    return [saved-unsupported $args]
+}
+
 # not grouped tests, sadly tcl doesn't have negated glob
 foreach test [prune [lsort [find $srcdir/$subdir {*.[CH]}]] \
 		  "$srcdir/$subdir/*_?.\[CH\]"] {
@@ -327,6 +338,9 @@ foreach test [prune [lsort [find $srcdir/$subdir {*.[CH]}]] \
 	    set module_cmis {}
 	    verbose "Testing $nshort $std" 1
 	    dg-test $test "$std" $DEFAULT_MODFLAGS
+	    if { [lindex $module_do 1] == "N" } {
+		continue
+	    }
 	    set testcase [string range $test [string length "$srcdir/"] end]
 	    cleanup_module_files [module_cmi_p $testcase $module_cmis]
 	}
@@ -372,6 +386,9 @@ foreach src [lsort [find $srcdir/$subdir {*_a.[CHX}]] {
 			}
 		    }
 		    dg-test -keep-output $test "$std" $DEFAULT_MODFLAGS
+		    if { [lindex $module_do 1] == "N" } {
+			break
+		    }
 		    set testcase [string range $test [string length "$srcdir/"] end]
 		    lappend mod_files [module_cmi_p $testcase $module_cmis]
 		}


-- 
Alexandre Oliva, happy hacker                https://FSFLA.org/blogs/lxo/
   Free Software Activist                       GNU Toolchain Engineer
Disinformation flourishes because many people care deeply about injustice
but very few check the facts.  Ask me about <https://stallmansupport.org>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH] testsuite: Fix up modules.exp [PR108899]
  2023-02-22 17:33   ` Alexandre Oliva
@ 2023-02-23 14:18     ` Jakub Jelinek
  2023-02-23 15:02       ` Richard Biener
  2023-03-29 19:59       ` 'g++.dg/modules/modules.exp': don't leak local 'unsupported' proc [PR108899] (was: [PATCH] testsuite: Fix up modules.exp [PR108899]) Thomas Schwinge
  0 siblings, 2 replies; 15+ messages in thread
From: Jakub Jelinek @ 2023-02-23 14:18 UTC (permalink / raw)
  To: Richard Biener, Jason Merrill, Alexandre Oliva, ro, mikestump
  Cc: gcc-patches, nathan

Hi!

On Wed, Feb 22, 2023 at 02:33:42PM -0300, Alexandre Oliva via Gcc-patches wrote:
> When a multi-source module is found to be unsupported, we fail
> module_cmi_p and subsequent sources.  Override proc unsupported to
> mark the result in module_do, and test it to skip module_cmp_p and
> subsequent related tests.
> 
> for  gcc/testsuite/ChangeLog
> 
> 	* g++.dg/modules/modules.exp: Override unsupported to update
> 	module_do, and test it after dg-test.

This patch breaks testing with more than one set of options in
target board, like
make check-g++ RUNTESTFLAGS='--target_board=unix\{-m32,-m64\} modules.exp'
yields:
...
		=== g++ Summary for unix/-m32 ===

# of expected passes		7217
# of unexpected failures	1
# of expected failures		18
# of unsupported tests		2
Running target unix/-m64
...
ERROR: tcl error sourcing /home/jakub/src/gcc/gcc/testsuite/g++.dg/modules/modules.exp.
ERROR: tcl error code TCL OPERATION RENAME TARGET_EXISTS
ERROR: can't rename to "saved-unsupported": command already exists
    while executing
"rename unsupported saved-unsupported"
    (file "/home/jakub/src/gcc/gcc/testsuite/g++.dg/modules/modules.exp" line 322)
    invoked from within
"source /home/jakub/src/gcc/gcc/testsuite/g++.dg/modules/modules.exp"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 source /home/jakub/src/gcc/gcc/testsuite/g++.dg/modules/modules.exp"
    invoked from within
"catch "uplevel #0 source $test_file_name" msg"

In other spots where we in *.exp files rename some routine, we guard that
and the following patch does that for modules.exp too.

Tested with running
make check-g++ RUNTESTFLAGS='--target_board=unix\{-m32,-m64\} modules.exp'
again which now works properly again.

Ok for trunk?

2023-02-23  Jakub Jelinek  <jakub@redhat.com>

	PR testsuite/108899
	* g++.dg/modules/modules.exp: Only override unsupported if it
	exists and saved-unsupported doesn't.

--- gcc/testsuite/g++.dg/modules/modules.exp.jj	2023-02-22 20:50:34.208421799 +0100
+++ gcc/testsuite/g++.dg/modules/modules.exp	2023-02-23 13:07:40.207320104 +0100
@@ -319,11 +319,15 @@ cleanup_module_files [find $DEFAULT_REPO
 # so that, after an unsupported result in dg-test, we can skip rather
 # than fail subsequent related tests.
 set module_do {"compile" "P"}
-rename unsupported saved-unsupported
-proc unsupported { args } {
-    global module_do
-    lset module_do 1 "N"
-    return [saved-unsupported $args]
+if { [info procs unsupported] != [list] \
+      && [info procs saved-unsupported] == [list] } {
+    rename unsupported saved-unsupported
+
+    proc unsupported { args } {
+	global module_do
+	lset module_do 1 "N"
+	return [saved-unsupported $args]
+    }
 }
 
 # not grouped tests, sadly tcl doesn't have negated glob


	Jakub


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] testsuite: Fix up modules.exp [PR108899]
  2023-02-23 14:18     ` [PATCH] testsuite: Fix up modules.exp [PR108899] Jakub Jelinek
@ 2023-02-23 15:02       ` Richard Biener
  2023-03-29 19:59       ` 'g++.dg/modules/modules.exp': don't leak local 'unsupported' proc [PR108899] (was: [PATCH] testsuite: Fix up modules.exp [PR108899]) Thomas Schwinge
  1 sibling, 0 replies; 15+ messages in thread
From: Richard Biener @ 2023-02-23 15:02 UTC (permalink / raw)
  To: Jakub Jelinek
  Cc: Jason Merrill, Alexandre Oliva, ro, mikestump, gcc-patches, nathan

On Thu, 23 Feb 2023, Jakub Jelinek wrote:

> Hi!
> 
> On Wed, Feb 22, 2023 at 02:33:42PM -0300, Alexandre Oliva via Gcc-patches wrote:
> > When a multi-source module is found to be unsupported, we fail
> > module_cmi_p and subsequent sources.  Override proc unsupported to
> > mark the result in module_do, and test it to skip module_cmp_p and
> > subsequent related tests.
> > 
> > for  gcc/testsuite/ChangeLog
> > 
> > 	* g++.dg/modules/modules.exp: Override unsupported to update
> > 	module_do, and test it after dg-test.
> 
> This patch breaks testing with more than one set of options in
> target board, like
> make check-g++ RUNTESTFLAGS='--target_board=unix\{-m32,-m64\} modules.exp'
> yields:
> ...
> 		=== g++ Summary for unix/-m32 ===
> 
> # of expected passes		7217
> # of unexpected failures	1
> # of expected failures		18
> # of unsupported tests		2
> Running target unix/-m64
> ...
> ERROR: tcl error sourcing /home/jakub/src/gcc/gcc/testsuite/g++.dg/modules/modules.exp.
> ERROR: tcl error code TCL OPERATION RENAME TARGET_EXISTS
> ERROR: can't rename to "saved-unsupported": command already exists
>     while executing
> "rename unsupported saved-unsupported"
>     (file "/home/jakub/src/gcc/gcc/testsuite/g++.dg/modules/modules.exp" line 322)
>     invoked from within
> "source /home/jakub/src/gcc/gcc/testsuite/g++.dg/modules/modules.exp"
>     ("uplevel" body line 1)
>     invoked from within
> "uplevel #0 source /home/jakub/src/gcc/gcc/testsuite/g++.dg/modules/modules.exp"
>     invoked from within
> "catch "uplevel #0 source $test_file_name" msg"
> 
> In other spots where we in *.exp files rename some routine, we guard that
> and the following patch does that for modules.exp too.
> 
> Tested with running
> make check-g++ RUNTESTFLAGS='--target_board=unix\{-m32,-m64\} modules.exp'
> again which now works properly again.
> 
> Ok for trunk?

OK.

> 2023-02-23  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR testsuite/108899
> 	* g++.dg/modules/modules.exp: Only override unsupported if it
> 	exists and saved-unsupported doesn't.
> 
> --- gcc/testsuite/g++.dg/modules/modules.exp.jj	2023-02-22 20:50:34.208421799 +0100
> +++ gcc/testsuite/g++.dg/modules/modules.exp	2023-02-23 13:07:40.207320104 +0100
> @@ -319,11 +319,15 @@ cleanup_module_files [find $DEFAULT_REPO
>  # so that, after an unsupported result in dg-test, we can skip rather
>  # than fail subsequent related tests.
>  set module_do {"compile" "P"}
> -rename unsupported saved-unsupported
> -proc unsupported { args } {
> -    global module_do
> -    lset module_do 1 "N"
> -    return [saved-unsupported $args]
> +if { [info procs unsupported] != [list] \
> +      && [info procs saved-unsupported] == [list] } {
> +    rename unsupported saved-unsupported
> +
> +    proc unsupported { args } {
> +	global module_do
> +	lset module_do 1 "N"
> +	return [saved-unsupported $args]
> +    }
>  }
>  
>  # not grouped tests, sadly tcl doesn't have negated glob
> 
> 
> 	Jakub
> 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg,
Germany; GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman;
HRB 36809 (AG Nuernberg)

^ permalink raw reply	[flat|nested] 15+ messages in thread

* 'g++.dg/modules/modules.exp': don't leak local 'unsupported' proc [PR108899] (was: [PATCH] testsuite: Fix up modules.exp [PR108899])
  2023-02-23 14:18     ` [PATCH] testsuite: Fix up modules.exp [PR108899] Jakub Jelinek
  2023-02-23 15:02       ` Richard Biener
@ 2023-03-29 19:59       ` Thomas Schwinge
  2023-03-30  7:00         ` 'g++.dg/modules/modules.exp': don't leak local 'unsupported' proc [PR108899] Alexandre Oliva
  1 sibling, 1 reply; 15+ messages in thread
From: Thomas Schwinge @ 2023-03-29 19:59 UTC (permalink / raw)
  To: gcc-patches, Jakub Jelinek, Richard Biener, Jason Merrill,
	Alexandre Oliva, ro, mikestump
  Cc: nathan

[-- Attachment #1: Type: text/plain, Size: 8179 bytes --]

Hi!

This changed needs more attention I'm afraid:

On 2023-02-23T15:18:04+0100, Jakub Jelinek via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> On Wed, Feb 22, 2023 at 02:33:42PM -0300, Alexandre Oliva via Gcc-patches wrote:
>> When a multi-source module is found to be unsupported, we fail
>> module_cmi_p and subsequent sources.  Override proc unsupported to
>> mark the result in module_do, and test it to skip module_cmp_p and
>> subsequent related tests.
>>
>> for  gcc/testsuite/ChangeLog
>>
>>      * g++.dg/modules/modules.exp: Override unsupported to update
>>      module_do, and test it after dg-test.

That's commit r13-6288-g5344482c4d3ae0618fa8f5ed38f8309db43fdb82
"testsuite: Skip module_cmi_p and related unsupported module test":

    --- gcc/testsuite/g++.dg/modules/modules.exp
    +++ gcc/testsuite/g++.dg/modules/modules.exp
    @@ -315,6 +315,17 @@ proc module-check-requirements { tests } {
     # cleanup any detritus from previous run
     cleanup_module_files [find $DEFAULT_REPO *.gcm]

    +# Override unsupported to set the second element of module_do to "N",
    +# so that, after an unsupported result in dg-test, we can skip rather
    +# than fail subsequent related tests.
    +set module_do {"compile" "P"}
    +rename unsupported saved-unsupported
    +proc unsupported { args } {
    +    global module_do
    +    lset module_do 1 "N"
    +    return [saved-unsupported $args]
    +}
    +
     # not grouped tests, sadly tcl doesn't have negated glob
     foreach test [prune [lsort [find $srcdir/$subdir {*.[CH]}]] \
                  "$srcdir/$subdir/*_?.\[CH\]"] {
    @@ -327,6 +338,9 @@ foreach test [prune [lsort [find $srcdir/$subdir {*.[CH]}]] \
            set module_cmis {}
            verbose "Testing $nshort $std" 1
            dg-test $test "$std" $DEFAULT_MODFLAGS
    +       if { [lindex $module_do 1] == "N" } {
    +           continue
    +       }
            set testcase [string range $test [string length "$srcdir/"] end]
            cleanup_module_files [module_cmi_p $testcase $module_cmis]
        }
    @@ -372,6 +386,9 @@ foreach src [lsort [find $srcdir/$subdir {*_a.[CHX}]] {
                        }
                    }
                    dg-test -keep-output $test "$std" $DEFAULT_MODFLAGS
    +               if { [lindex $module_do 1] == "N" } {
    +                   break
    +               }
                    set testcase [string range $test [string length "$srcdir/"] end]
                    lappend mod_files [module_cmi_p $testcase $module_cmis]
                }

First, I'm seeing this change my 'g++.dg/modules/modules.exp' '*.sum'
output as follows:

    -UNSUPPORTED: g++.dg/modules/explicit-bool-1_a.H -std=c++17
     PASS: g++.dg/modules/explicit-bool-1_a.H -std=c++2a (test for excess errors)
     PASS: g++.dg/modules/explicit-bool-1_a.H -std=c++2b (test for excess errors)
    -UNSUPPORTED: g++.dg/modules/explicit-bool-1_b.C -std=c++17
     PASS: g++.dg/modules/explicit-bool-1_b.C -std=c++2a (test for excess errors)
     PASS: g++.dg/modules/explicit-bool-1_b.C -std=c++2b (test for excess errors)
     PASS: g++.dg/modules/export-1.C -std=c++17  (test for errors, line 10)
    @@ -7247,6 +7245,7 @@
     PASS: g++.dg/modules/xtreme-tr1_b.C -std=c++17 (test for excess errors)
     PASS: g++.dg/modules/xtreme-tr1_b.C -std=c++2a (test for excess errors)
     PASS: g++.dg/modules/xtreme-tr1_b.C -std=c++2b (test for excess errors)
    +UNSUPPORTED: {g++.dg/modules/explicit-bool-1_a.H -std=c++17}

I assume that the second UNSUPPORTED:

    -UNSUPPORTED: g++.dg/modules/explicit-bool-1_b.C -std=c++17

... disappears is the intention of this patch?

But surely the curly braces in:

    -UNSUPPORTED: g++.dg/modules/explicit-bool-1_a.H -std=c++17

    +UNSUPPORTED: {g++.dg/modules/explicit-bool-1_a.H -std=c++17}

... are not intentional?  (Alexandre?)


But worse, the latter also "bleeds into" all other testing that's
executing as part of the same 'runtest' invocation (that is, further
'*.exp' files).  (I've ranted before about how much I don't like this
aspect of DejaGnu/'runtest'...)  For example (random; there are many,
many more):

    [...]
     PASS: c-c++-common/tsan/sanitize-thread-macro.c   -O0  (test for excess errors)
    -UNSUPPORTED: c-c++-common/tsan/sanitize-thread-macro.c   -O2
    [...]
     PASS: g++.dg/tsan/pr88018.C   -O0  (test for excess errors)
    -UNSUPPORTED: g++.dg/tsan/pr88018.C   -O2
    [...]
    +UNSUPPORTED: {c-c++-common/tsan/sanitize-thread-macro.c   -O2 }
    +UNSUPPORTED: {g++.dg/tsan/pr88018.C   -O2 }
    [...]

That's undesirable.


Per Jakub:

> This patch breaks testing with more than one set of options in
> target board, like
> make check-g++ RUNTESTFLAGS='--target_board=unix\{-m32,-m64\} modules.exp'
> yields:
> ...
>               === g++ Summary for unix/-m32 ===
>
> # of expected passes          7217
> # of unexpected failures      1
> # of expected failures                18
> # of unsupported tests                2
> Running target unix/-m64
> ...
> ERROR: tcl error sourcing /home/jakub/src/gcc/gcc/testsuite/g++.dg/modules/modules.exp.
> ERROR: tcl error code TCL OPERATION RENAME TARGET_EXISTS
> ERROR: can't rename to "saved-unsupported": command already exists
>     while executing
> "rename unsupported saved-unsupported"
>     (file "/home/jakub/src/gcc/gcc/testsuite/g++.dg/modules/modules.exp" line 322)
>     invoked from within
> "source /home/jakub/src/gcc/gcc/testsuite/g++.dg/modules/modules.exp"
>     ("uplevel" body line 1)
>     invoked from within
> "uplevel #0 source /home/jakub/src/gcc/gcc/testsuite/g++.dg/modules/modules.exp"
>     invoked from within
> "catch "uplevel #0 source $test_file_name" msg"

ACK.

> In other spots where we in *.exp files rename some routine, we guard that

ACK, but that's -- as far as I can tell -- done for procs that are then
used only locally, or where all global use should use the 'rename'd proc.

However, we don't globally want 'UNSUPPORTED: {[...]}' (... in 'runtest'
invocations where 'g++.dg/modules/modules.exp' happened to have ran
before...), so...

> and the following patch does that for modules.exp too.
>
> Tested with running
> make check-g++ RUNTESTFLAGS='--target_board=unix\{-m32,-m64\} modules.exp'
> again which now works properly again.

>       PR testsuite/108899
>       * g++.dg/modules/modules.exp: Only override unsupported if it
>       exists and saved-unsupported doesn't.
>
> --- gcc/testsuite/g++.dg/modules/modules.exp.jj       2023-02-22 20:50:34.208421799 +0100
> +++ gcc/testsuite/g++.dg/modules/modules.exp  2023-02-23 13:07:40.207320104 +0100
> @@ -319,11 +319,15 @@ cleanup_module_files [find $DEFAULT_REPO
>  # so that, after an unsupported result in dg-test, we can skip rather
>  # than fail subsequent related tests.
>  set module_do {"compile" "P"}
> -rename unsupported saved-unsupported
> -proc unsupported { args } {
> -    global module_do
> -    lset module_do 1 "N"
> -    return [saved-unsupported $args]
> +if { [info procs unsupported] != [list] \
> +      && [info procs saved-unsupported] == [list] } {
> +    rename unsupported saved-unsupported
> +
> +    proc unsupported { args } {
> +     global module_do
> +     lset module_do 1 "N"
> +     return [saved-unsupported $args]
> +    }
>  }

..., this isn't sufficient.  Instead, we should undo the 'rename' at the
end of 'g++.dg/modules/modules.exp'.  OK to push the attached
"'g++.dg/modules/modules.exp': don't leak local 'unsupported' proc [PR108899]"
after proper testing?


And, Alexandre, please have a look at the -- now local to
'g++.dg/modules/modules.exp' -- issue about curly braces in
'UNSUPPORTED: [...]' -> 'UNSUPPORTED: {[...]}'?


Grüße
 Thomas


-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-g-.dg-modules-modules.exp-don-t-leak-local-unsupport.patch --]
[-- Type: text/x-diff, Size: 1019 bytes --]

From b5c6fae2467cf4245f379269792559b8c00eca58 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Wed, 29 Mar 2023 21:11:19 +0200
Subject: [PATCH] 'g++.dg/modules/modules.exp': don't leak local 'unsupported'
 proc [PR108899]

Fix-up for commit 5344482c4d3ae0618fa8f5ed38f8309db43fdb82
"testsuite: Skip module_cmi_p and related unsupported module test".

	PR testsuite/108899
	gcc/testsuite/
	* g++.dg/modules/modules.exp: Don't leak local 'unsupported' proc.
---
 gcc/testsuite/g++.dg/modules/modules.exp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/testsuite/g++.dg/modules/modules.exp b/gcc/testsuite/g++.dg/modules/modules.exp
index e66b2082f20..23c4bac2e89 100644
--- a/gcc/testsuite/g++.dg/modules/modules.exp
+++ b/gcc/testsuite/g++.dg/modules/modules.exp
@@ -408,4 +408,8 @@ foreach src [lsort [find $srcdir/$subdir {*_a.[CHX}]] {
     }
 }
 
+# Restore the saved 'unsupported' proc.
+rename unsupported {}
+rename saved-unsupported unsupported
+
 dg-finish
-- 
2.25.1


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: 'g++.dg/modules/modules.exp': don't leak local 'unsupported' proc [PR108899]
  2023-03-29 19:59       ` 'g++.dg/modules/modules.exp': don't leak local 'unsupported' proc [PR108899] (was: [PATCH] testsuite: Fix up modules.exp [PR108899]) Thomas Schwinge
@ 2023-03-30  7:00         ` Alexandre Oliva
  2023-03-30  9:39           ` Thomas Schwinge
  2023-03-30 13:51           ` Alexandre Oliva
  0 siblings, 2 replies; 15+ messages in thread
From: Alexandre Oliva @ 2023-03-30  7:00 UTC (permalink / raw)
  To: Thomas Schwinge
  Cc: gcc-patches, Jakub Jelinek, Richard Biener, Jason Merrill, ro,
	mikestump, nathan

On Mar 29, 2023, Thomas Schwinge <thomas@codesourcery.com> wrote:

> I assume that the second UNSUPPORTED:

>     -UNSUPPORTED: g++.dg/modules/explicit-bool-1_b.C -std=c++17

> ... disappears is the intention of this patch?

Yup

> But surely the curly braces in:

>     -UNSUPPORTED: g++.dg/modules/explicit-bool-1_a.H -std=c++17

>     +UNSUPPORTED: {g++.dg/modules/explicit-bool-1_a.H -std=c++17}

> ... are not intentional?  (Alexandre?)

Unintended indeed, will look, thanks for letting me know


> But worse, the latter also "bleeds into" all other testing

Eeek

Yeah, that's a much bigger problem indeed.

> ..., this isn't sufficient.  Instead, we should undo the 'rename' at the
> end of 'g++.dg/modules/modules.exp'.  OK to push the attached
> "'g++.dg/modules/modules.exp': don't leak local 'unsupported' proc [PR108899]"
> after proper testing?

Ooh, nice, I didn't know how to drop the renaming after we were done
with it, and hoped the end of the .exp would have accomplished that by
ending a scope.  Jakub had already pointed out this wasn't the case, but
I didn't realize, when he did, that this would carry over onto other
modules.


If we're dropping the renaming, I suppose we could also revert Jakub's
change.  I suppose this patch will take care of it, pending testing...


diff --git a/gcc/testsuite/g++.dg/modules/modules.exp b/gcc/testsuite/g++.dg/modules/modules.exp
index 80aa392bc7f3b..6fd5050cef79b 100644
--- a/gcc/testsuite/g++.dg/modules/modules.exp
+++ b/gcc/testsuite/g++.dg/modules/modules.exp
@@ -319,15 +319,11 @@ cleanup_module_files [find $DEFAULT_REPO *.gcm]
 # so that, after an unsupported result in dg-test, we can skip rather
 # than fail subsequent related tests.
 set module_do {"compile" "P"}
-if { [info procs unsupported] != [list] \
-      && [info procs saved-unsupported] == [list] } {
-    rename unsupported saved-unsupported
-
-    proc unsupported { args } {
-	global module_do
-	lset module_do 1 "N"
-	return [saved-unsupported $args]
-    }
+rename unsupported modules-saved-unsupported
+proc unsupported { args } {
+    global module_do
+    lset module_do 1 "N"
+    return [eval modules-saved-unsupported $args]
 }
 
 # not grouped tests, sadly tcl doesn't have negated glob
@@ -412,4 +408,10 @@ foreach src [lsort [find $srcdir/$subdir {*_a.[CHX}]] {
     }
 }
 
+# Restore the original unsupported proc, lest it will affect
+# subsequent test runs, or even fail renaming if we run modules.exp
+# for multiple targets/multilibs/options.
+rename unsupported {}
+rename modules-saved-unsupported unsupported
+
 dg-finish


-- 
Alexandre Oliva, happy hacker                https://FSFLA.org/blogs/lxo/
   Free Software Activist                       GNU Toolchain Engineer
Disinformation flourishes because many people care deeply about injustice
but very few check the facts.  Ask me about <https://stallmansupport.org>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: 'g++.dg/modules/modules.exp': don't leak local 'unsupported' proc [PR108899]
  2023-03-30  7:00         ` 'g++.dg/modules/modules.exp': don't leak local 'unsupported' proc [PR108899] Alexandre Oliva
@ 2023-03-30  9:39           ` Thomas Schwinge
  2023-03-30 13:51           ` Alexandre Oliva
  1 sibling, 0 replies; 15+ messages in thread
From: Thomas Schwinge @ 2023-03-30  9:39 UTC (permalink / raw)
  To: Alexandre Oliva, gcc-patches
  Cc: Jakub Jelinek, Richard Biener, Jason Merrill, ro, mikestump, nathan

[-- Attachment #1: Type: text/plain, Size: 2114 bytes --]

Hi!

On 2023-03-30T04:00:03-0300, Alexandre Oliva <oliva@adacore.com> wrote:
> On Mar 29, 2023, Thomas Schwinge <thomas@codesourcery.com> wrote:
>> But surely the curly braces in:
>
>>     -UNSUPPORTED: g++.dg/modules/explicit-bool-1_a.H -std=c++17
>
>>     +UNSUPPORTED: {g++.dg/modules/explicit-bool-1_a.H -std=c++17}
>
>> ... are not intentional?  (Alexandre?)
>
> Unintended indeed, will look, thanks for letting me know
>
>
>> But worse, the latter also "bleeds into" all other testing
>
> Eeek
>
> Yeah, that's a much bigger problem indeed.
>
>> ..., this isn't sufficient.  Instead, we should undo the 'rename' at the
>> end of 'g++.dg/modules/modules.exp'.  OK to push the attached
>> "'g++.dg/modules/modules.exp': don't leak local 'unsupported' proc [PR108899]"
>> after proper testing?
>
> Ooh, nice, I didn't know how to drop the renaming after we were done
> with it, and hoped the end of the .exp would have accomplished that by
> ending a scope.  Jakub had already pointed out this wasn't the case, but
> I didn't realize, when he did, that this would carry over onto other
> modules.
>
> If we're dropping the renaming, I suppose we could also revert Jakub's
> change.

Yes, my plan was to push a 'git revert' of Jakub's change as a follow-up
(clean-up) *after* my proposed
"'g++.dg/modules/modules.exp': don't leak local 'unsupported' proc [PR108899]",
see attached again.

My testing has completed without issues; OK to push that one?

> +# Restore the original unsupported proc, lest it will affect
> +# subsequent test runs, or even fail renaming if we run modules.exp
> +# for multiple targets/multilibs/options.
> +rename unsupported {}
> +rename modules-saved-unsupported unsupported

Should I incorporate that comment instead of my simpler one?


Grüße
 Thomas


-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-g-.dg-modules-modules.exp-don-t-leak-local-unsupport.patch --]
[-- Type: text/x-diff, Size: 1019 bytes --]

From b5c6fae2467cf4245f379269792559b8c00eca58 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Wed, 29 Mar 2023 21:11:19 +0200
Subject: [PATCH] 'g++.dg/modules/modules.exp': don't leak local 'unsupported'
 proc [PR108899]

Fix-up for commit 5344482c4d3ae0618fa8f5ed38f8309db43fdb82
"testsuite: Skip module_cmi_p and related unsupported module test".

	PR testsuite/108899
	gcc/testsuite/
	* g++.dg/modules/modules.exp: Don't leak local 'unsupported' proc.
---
 gcc/testsuite/g++.dg/modules/modules.exp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/testsuite/g++.dg/modules/modules.exp b/gcc/testsuite/g++.dg/modules/modules.exp
index e66b2082f20..23c4bac2e89 100644
--- a/gcc/testsuite/g++.dg/modules/modules.exp
+++ b/gcc/testsuite/g++.dg/modules/modules.exp
@@ -408,4 +408,8 @@ foreach src [lsort [find $srcdir/$subdir {*_a.[CHX}]] {
     }
 }
 
+# Restore the saved 'unsupported' proc.
+rename unsupported {}
+rename saved-unsupported unsupported
+
 dg-finish
-- 
2.25.1


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: 'g++.dg/modules/modules.exp': don't leak local 'unsupported' proc [PR108899]
  2023-03-30  7:00         ` 'g++.dg/modules/modules.exp': don't leak local 'unsupported' proc [PR108899] Alexandre Oliva
  2023-03-30  9:39           ` Thomas Schwinge
@ 2023-03-30 13:51           ` Alexandre Oliva
  2023-03-31 18:52             ` Jason Merrill
                               ` (2 more replies)
  1 sibling, 3 replies; 15+ messages in thread
From: Alexandre Oliva @ 2023-03-30 13:51 UTC (permalink / raw)
  To: Thomas Schwinge
  Cc: gcc-patches, Jakub Jelinek, Richard Biener, Jason Merrill, ro,
	mikestump, nathan

On Mar 30, 2023, Alexandre Oliva <oliva@adacore.com> wrote:

> If we're dropping the renaming, I suppose we could also revert Jakub's
> change.  I suppose this patch will take care of it, pending testing...

Regstrapped on x86_64-linux-gnu and also tested on arm-vx7r2 (with
gcc-12), where I used to get fails after an unsupported modules.exp
test, but there are no curly braces in the log files after the patch.
Ok to install?


[PR108899] testsuite: fix proc unsupported overriding in modules.exp

The overrider of proc unsupported in modules.exp had two problems
reported by Thomas Schwinge, even after Jakub Jelínek's fix:

- it remained in effect while running other dejagnu testsets

- it didn't quote correctly the argument list passed to it, which
  caused test names to be surrounded by curly braces, as in:

UNSUPPORTED: {...}

This patch fixes both issues, obsoleting and reverting Jakub's change,
by dropping the overrider and renaming the saved proc back, and by
using uplevel's argument list splicing.


for  gcc/testsuite/ChangeLog

	PR testsuite/108899
	* g++.dg/modules/modules.exp (unsupported): Drop renaming.
	Fix quoting.
---
 gcc/testsuite/g++.dg/modules/modules.exp |   20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/gcc/testsuite/g++.dg/modules/modules.exp b/gcc/testsuite/g++.dg/modules/modules.exp
index 80aa392bc7f3b..dc302d3d0af48 100644
--- a/gcc/testsuite/g++.dg/modules/modules.exp
+++ b/gcc/testsuite/g++.dg/modules/modules.exp
@@ -319,15 +319,11 @@ cleanup_module_files [find $DEFAULT_REPO *.gcm]
 # so that, after an unsupported result in dg-test, we can skip rather
 # than fail subsequent related tests.
 set module_do {"compile" "P"}
-if { [info procs unsupported] != [list] \
-      && [info procs saved-unsupported] == [list] } {
-    rename unsupported saved-unsupported
-
-    proc unsupported { args } {
-	global module_do
-	lset module_do 1 "N"
-	return [saved-unsupported $args]
-    }
+rename unsupported modules-saved-unsupported
+proc unsupported { args } {
+    global module_do
+    lset module_do 1 "N"
+    return [uplevel 1 modules-saved-unsupported $args]
 }
 
 # not grouped tests, sadly tcl doesn't have negated glob
@@ -412,4 +408,10 @@ foreach src [lsort [find $srcdir/$subdir {*_a.[CHX}]] {
     }
 }
 
+# Restore the original unsupported proc, lest it will affect
+# subsequent test runs, or even fail renaming if we run modules.exp
+# for multiple targets/multilibs/options.
+rename unsupported {}
+rename modules-saved-unsupported unsupported
+
 dg-finish


-- 
Alexandre Oliva, happy hacker                https://FSFLA.org/blogs/lxo/
   Free Software Activist                       GNU Toolchain Engineer
Disinformation flourishes because many people care deeply about injustice
but very few check the facts.  Ask me about <https://stallmansupport.org>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: 'g++.dg/modules/modules.exp': don't leak local 'unsupported' proc [PR108899]
  2023-03-30 13:51           ` Alexandre Oliva
@ 2023-03-31 18:52             ` Jason Merrill
  2023-04-01 18:06             ` Mike Stump
  2023-04-05  7:47             ` Thomas Schwinge
  2 siblings, 0 replies; 15+ messages in thread
From: Jason Merrill @ 2023-03-31 18:52 UTC (permalink / raw)
  To: Alexandre Oliva, Thomas Schwinge
  Cc: gcc-patches, Jakub Jelinek, Richard Biener, ro, mikestump, nathan

On 3/30/23 09:51, Alexandre Oliva wrote:
> On Mar 30, 2023, Alexandre Oliva <oliva@adacore.com> wrote:
> 
>> If we're dropping the renaming, I suppose we could also revert Jakub's
>> change.  I suppose this patch will take care of it, pending testing...
> 
> Regstrapped on x86_64-linux-gnu and also tested on arm-vx7r2 (with
> gcc-12), where I used to get fails after an unsupported modules.exp
> test, but there are no curly braces in the log files after the patch.
> Ok to install?
> 
> 
> [PR108899] testsuite: fix proc unsupported overriding in modules.exp

The [PR] tag should go at the end of the subject line, not the start. 
OK with that change.

> The overrider of proc unsupported in modules.exp had two problems
> reported by Thomas Schwinge, even after Jakub Jelínek's fix:
> 
> - it remained in effect while running other dejagnu testsets
> 
> - it didn't quote correctly the argument list passed to it, which
>    caused test names to be surrounded by curly braces, as in:
> 
> UNSUPPORTED: {...}
> 
> This patch fixes both issues, obsoleting and reverting Jakub's change,
> by dropping the overrider and renaming the saved proc back, and by
> using uplevel's argument list splicing.
> 
> 
> for  gcc/testsuite/ChangeLog
> 
> 	PR testsuite/108899
> 	* g++.dg/modules/modules.exp (unsupported): Drop renaming.
> 	Fix quoting.
> ---
>   gcc/testsuite/g++.dg/modules/modules.exp |   20 +++++++++++---------
>   1 file changed, 11 insertions(+), 9 deletions(-)
> 
> diff --git a/gcc/testsuite/g++.dg/modules/modules.exp b/gcc/testsuite/g++.dg/modules/modules.exp
> index 80aa392bc7f3b..dc302d3d0af48 100644
> --- a/gcc/testsuite/g++.dg/modules/modules.exp
> +++ b/gcc/testsuite/g++.dg/modules/modules.exp
> @@ -319,15 +319,11 @@ cleanup_module_files [find $DEFAULT_REPO *.gcm]
>   # so that, after an unsupported result in dg-test, we can skip rather
>   # than fail subsequent related tests.
>   set module_do {"compile" "P"}
> -if { [info procs unsupported] != [list] \
> -      && [info procs saved-unsupported] == [list] } {
> -    rename unsupported saved-unsupported
> -
> -    proc unsupported { args } {
> -	global module_do
> -	lset module_do 1 "N"
> -	return [saved-unsupported $args]
> -    }
> +rename unsupported modules-saved-unsupported
> +proc unsupported { args } {
> +    global module_do
> +    lset module_do 1 "N"
> +    return [uplevel 1 modules-saved-unsupported $args]
>   }
>   
>   # not grouped tests, sadly tcl doesn't have negated glob
> @@ -412,4 +408,10 @@ foreach src [lsort [find $srcdir/$subdir {*_a.[CHX}]] {
>       }
>   }
>   
> +# Restore the original unsupported proc, lest it will affect
> +# subsequent test runs, or even fail renaming if we run modules.exp
> +# for multiple targets/multilibs/options.
> +rename unsupported {}
> +rename modules-saved-unsupported unsupported
> +
>   dg-finish
> 
> 


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: 'g++.dg/modules/modules.exp': don't leak local 'unsupported' proc [PR108899]
  2023-03-30 13:51           ` Alexandre Oliva
  2023-03-31 18:52             ` Jason Merrill
@ 2023-04-01 18:06             ` Mike Stump
  2023-04-05  7:47             ` Thomas Schwinge
  2 siblings, 0 replies; 15+ messages in thread
From: Mike Stump @ 2023-04-01 18:06 UTC (permalink / raw)
  To: Alexandre Oliva
  Cc: Thomas Schwinge, gcc-patches, Jakub Jelinek, Richard Biener,
	Jason Merrill, ro, nathan

On Mar 30, 2023, at 6:51 AM, Alexandre Oliva <oliva@adacore.com> wrote:
> 
> On Mar 30, 2023, Alexandre Oliva <oliva@adacore.com> wrote:
> 
>> If we're dropping the renaming, I suppose we could also revert Jakub's
>> change.  I suppose this patch will take care of it, pending testing...
> 
> Regstrapped on x86_64-linux-gnu and also tested on arm-vx7r2 (with
> gcc-12), where I used to get fails after an unsupported modules.exp
> test, but there are no curly braces in the log files after the patch.
> Ok to install?

Ok.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: 'g++.dg/modules/modules.exp': don't leak local 'unsupported' proc [PR108899]
  2023-03-30 13:51           ` Alexandre Oliva
  2023-03-31 18:52             ` Jason Merrill
  2023-04-01 18:06             ` Mike Stump
@ 2023-04-05  7:47             ` Thomas Schwinge
  2023-04-06  2:38               ` Alexandre Oliva
  2 siblings, 1 reply; 15+ messages in thread
From: Thomas Schwinge @ 2023-04-05  7:47 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: gcc-patches

Hi Alexandre!

On 2023-03-30T10:51:32-0300, Alexandre Oliva via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> On Mar 30, 2023, Alexandre Oliva <oliva@adacore.com> wrote:
>
>> If we're dropping the renaming, I suppose we could also revert Jakub's
>> change.  I suppose this patch will take care of it, pending testing...
>
> Regstrapped on x86_64-linux-gnu and also tested on arm-vx7r2 (with
> gcc-12), where I used to get fails after an unsupported modules.exp
> test, but there are no curly braces in the log files after the patch.
> Ok to install?

Given the two "OK"s that you got end of last week, are you going to push
that anytime soon, please?

With...

    Co-authored-by: Thomas Schwinge <thomas@codesourcery.com>

... added, I suppose.


Grüße
 Thomas


> [PR108899] testsuite: fix proc unsupported overriding in modules.exp
>
> The overrider of proc unsupported in modules.exp had two problems
> reported by Thomas Schwinge, even after Jakub Jelínek's fix:
>
> - it remained in effect while running other dejagnu testsets
>
> - it didn't quote correctly the argument list passed to it, which
>   caused test names to be surrounded by curly braces, as in:
>
> UNSUPPORTED: {...}
>
> This patch fixes both issues, obsoleting and reverting Jakub's change,
> by dropping the overrider and renaming the saved proc back, and by
> using uplevel's argument list splicing.
>
>
> for  gcc/testsuite/ChangeLog
>
>       PR testsuite/108899
>       * g++.dg/modules/modules.exp (unsupported): Drop renaming.
>       Fix quoting.
> ---
>  gcc/testsuite/g++.dg/modules/modules.exp |   20 +++++++++++---------
>  1 file changed, 11 insertions(+), 9 deletions(-)
>
> diff --git a/gcc/testsuite/g++.dg/modules/modules.exp b/gcc/testsuite/g++.dg/modules/modules.exp
> index 80aa392bc7f3b..dc302d3d0af48 100644
> --- a/gcc/testsuite/g++.dg/modules/modules.exp
> +++ b/gcc/testsuite/g++.dg/modules/modules.exp
> @@ -319,15 +319,11 @@ cleanup_module_files [find $DEFAULT_REPO *.gcm]
>  # so that, after an unsupported result in dg-test, we can skip rather
>  # than fail subsequent related tests.
>  set module_do {"compile" "P"}
> -if { [info procs unsupported] != [list] \
> -      && [info procs saved-unsupported] == [list] } {
> -    rename unsupported saved-unsupported
> -
> -    proc unsupported { args } {
> -     global module_do
> -     lset module_do 1 "N"
> -     return [saved-unsupported $args]
> -    }
> +rename unsupported modules-saved-unsupported
> +proc unsupported { args } {
> +    global module_do
> +    lset module_do 1 "N"
> +    return [uplevel 1 modules-saved-unsupported $args]
>  }
>
>  # not grouped tests, sadly tcl doesn't have negated glob
> @@ -412,4 +408,10 @@ foreach src [lsort [find $srcdir/$subdir {*_a.[CHX}]] {
>      }
>  }
>
> +# Restore the original unsupported proc, lest it will affect
> +# subsequent test runs, or even fail renaming if we run modules.exp
> +# for multiple targets/multilibs/options.
> +rename unsupported {}
> +rename modules-saved-unsupported unsupported
> +
>  dg-finish
>
>
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: 'g++.dg/modules/modules.exp': don't leak local 'unsupported' proc [PR108899]
  2023-04-05  7:47             ` Thomas Schwinge
@ 2023-04-06  2:38               ` Alexandre Oliva
  2023-04-06 20:11                 ` Thomas Schwinge
  0 siblings, 1 reply; 15+ messages in thread
From: Alexandre Oliva @ 2023-04-06  2:38 UTC (permalink / raw)
  To: Thomas Schwinge; +Cc: gcc-patches

On Apr  5, 2023, Thomas Schwinge <thomas@codesourcery.com> wrote:

> Given the two "OK"s that you got end of last week, are you going to push
> that anytime soon, please?

Apologies for the delay.

> With...

>     Co-authored-by: Thomas Schwinge <thomas@codesourcery.com>

> ... added, I suppose.

I wrote the patch based on your report, before even seeing your patch,
though I only posted mine later, so I tried to give you credit for the
report in the commit message, but if you feel that the note is
appropriate, sure :-)  Thanks again!

Here's what I'm checking in.


testsuite: fix proc unsupported overriding in modules.exp [PR108899]

The overrider of proc unsupported in modules.exp had two problems
reported by Thomas Schwinge, even after Jakub Jelínek's fix:

- it remained in effect while running other dejagnu testsets

- it didn't quote correctly the argument list passed to it, which
  caused test names to be surrounded by curly braces, as in:

UNSUPPORTED: {...}

This patch fixes both issues, obsoleting and reverting Jakub's change,
by dropping the overrider and renaming the saved proc back, and by
using uplevel's argument list splicing.


Co-authored-by: Thomas Schwinge <thomas@codesourcery.com>

for  gcc/testsuite/ChangeLog

	PR testsuite/108899
	* g++.dg/modules/modules.exp (unsupported): Drop renaming.
	Fix quoting.
---
 gcc/testsuite/g++.dg/modules/modules.exp |   20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/gcc/testsuite/g++.dg/modules/modules.exp b/gcc/testsuite/g++.dg/modules/modules.exp
index 80aa392bc7f3b..dc302d3d0af48 100644
--- a/gcc/testsuite/g++.dg/modules/modules.exp
+++ b/gcc/testsuite/g++.dg/modules/modules.exp
@@ -319,15 +319,11 @@ cleanup_module_files [find $DEFAULT_REPO *.gcm]
 # so that, after an unsupported result in dg-test, we can skip rather
 # than fail subsequent related tests.
 set module_do {"compile" "P"}
-if { [info procs unsupported] != [list] \
-      && [info procs saved-unsupported] == [list] } {
-    rename unsupported saved-unsupported
-
-    proc unsupported { args } {
-	global module_do
-	lset module_do 1 "N"
-	return [saved-unsupported $args]
-    }
+rename unsupported modules-saved-unsupported
+proc unsupported { args } {
+    global module_do
+    lset module_do 1 "N"
+    return [uplevel 1 modules-saved-unsupported $args]
 }
 
 # not grouped tests, sadly tcl doesn't have negated glob
@@ -412,4 +408,10 @@ foreach src [lsort [find $srcdir/$subdir {*_a.[CHX}]] {
     }
 }
 
+# Restore the original unsupported proc, lest it will affect
+# subsequent test runs, or even fail renaming if we run modules.exp
+# for multiple targets/multilibs/options.
+rename unsupported {}
+rename modules-saved-unsupported unsupported
+
 dg-finish



-- 
Alexandre Oliva, happy hacker                https://FSFLA.org/blogs/lxo/
   Free Software Activist                       GNU Toolchain Engineer
Disinformation flourishes because many people care deeply about injustice
but very few check the facts.  Ask me about <https://stallmansupport.org>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: 'g++.dg/modules/modules.exp': don't leak local 'unsupported' proc [PR108899]
  2023-04-06  2:38               ` Alexandre Oliva
@ 2023-04-06 20:11                 ` Thomas Schwinge
  2023-04-06 23:40                   ` Alexandre Oliva
  0 siblings, 1 reply; 15+ messages in thread
From: Thomas Schwinge @ 2023-04-06 20:11 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: gcc-patches

Hi Alexandre!

On 2023-04-05T23:38:43-0300, Alexandre Oliva via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> On Apr  5, 2023, Thomas Schwinge <thomas@codesourcery.com> wrote:
>> With...
>
>>     Co-authored-by: Thomas Schwinge <thomas@codesourcery.com>
>
>> ... added, I suppose.
>
> I wrote the patch based on your report, before even seeing your patch

Eh, given your "Ooh, nice, I didn't know [...]" comment in
<https://inbox.sourceware.org/gcc/orr0t6n2q4.fsf@lxoliva.fsfla.org>:

On 2023-03-30T04:00:03-0300, Alexandre Oliva via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
| On Mar 29, 2023, Thomas Schwinge <thomas@codesourcery.com> wrote:
|> ..., this isn't sufficient.  Instead, we should undo the 'rename' at the
|> end of 'g++.dg/modules/modules.exp'.  OK to push the attached
|> "'g++.dg/modules/modules.exp': don't leak local 'unsupported' proc [PR108899]"
|> after proper testing?
|
| Ooh, nice, I didn't know how to drop the renaming after we were done
| with it, [...]

..., I had certainly assumed that you'd learned "how to drop [...]" from
looking at my patch.

> though I only posted mine later, so I tried to give you credit for the
> report in the commit message, but if you feel that the note is
> appropriate, sure :-)  Thanks again!

Thanks.


> Here's what I'm checking in.
>
>
> testsuite: fix proc unsupported overriding in modules.exp [PR108899]
>
> The overrider of proc unsupported in modules.exp had two problems
> reported by Thomas Schwinge, even after Jakub Jelínek's fix:
>
> - it remained in effect while running other dejagnu testsets
>
> - it didn't quote correctly the argument list passed to it, which
>   caused test names to be surrounded by curly braces, as in:
>
> UNSUPPORTED: {...}
>
> This patch fixes both issues

Confirmed, thanks.


Grüße
 Thomas


> obsoleting and reverting Jakub's change,
> by dropping the overrider and renaming the saved proc back, and by
> using uplevel's argument list splicing.
>
>
> Co-authored-by: Thomas Schwinge <thomas@codesourcery.com>
>
> for  gcc/testsuite/ChangeLog
>
>       PR testsuite/108899
>       * g++.dg/modules/modules.exp (unsupported): Drop renaming.
>       Fix quoting.
> ---
>  gcc/testsuite/g++.dg/modules/modules.exp |   20 +++++++++++---------
>  1 file changed, 11 insertions(+), 9 deletions(-)
>
> diff --git a/gcc/testsuite/g++.dg/modules/modules.exp b/gcc/testsuite/g++.dg/modules/modules.exp
> index 80aa392bc7f3b..dc302d3d0af48 100644
> --- a/gcc/testsuite/g++.dg/modules/modules.exp
> +++ b/gcc/testsuite/g++.dg/modules/modules.exp
> @@ -319,15 +319,11 @@ cleanup_module_files [find $DEFAULT_REPO *.gcm]
>  # so that, after an unsupported result in dg-test, we can skip rather
>  # than fail subsequent related tests.
>  set module_do {"compile" "P"}
> -if { [info procs unsupported] != [list] \
> -      && [info procs saved-unsupported] == [list] } {
> -    rename unsupported saved-unsupported
> -
> -    proc unsupported { args } {
> -     global module_do
> -     lset module_do 1 "N"
> -     return [saved-unsupported $args]
> -    }
> +rename unsupported modules-saved-unsupported
> +proc unsupported { args } {
> +    global module_do
> +    lset module_do 1 "N"
> +    return [uplevel 1 modules-saved-unsupported $args]
>  }
>
>  # not grouped tests, sadly tcl doesn't have negated glob
> @@ -412,4 +408,10 @@ foreach src [lsort [find $srcdir/$subdir {*_a.[CHX}]] {
>      }
>  }
>
> +# Restore the original unsupported proc, lest it will affect
> +# subsequent test runs, or even fail renaming if we run modules.exp
> +# for multiple targets/multilibs/options.
> +rename unsupported {}
> +rename modules-saved-unsupported unsupported
> +
>  dg-finish
>
>
>
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: 'g++.dg/modules/modules.exp': don't leak local 'unsupported' proc [PR108899]
  2023-04-06 20:11                 ` Thomas Schwinge
@ 2023-04-06 23:40                   ` Alexandre Oliva
  0 siblings, 0 replies; 15+ messages in thread
From: Alexandre Oliva @ 2023-04-06 23:40 UTC (permalink / raw)
  To: Thomas Schwinge; +Cc: gcc-patches

On Apr  6, 2023, Thomas Schwinge <thomas@codesourcery.com> wrote:

> Eh, given your "Ooh, nice, I didn't know [...]" comment in
> <https://inbox.sourceware.org/gcc/orr0t6n2q4.fsf@lxoliva.fsfla.org>:

Oh my, you're right, I apologize, I misremembered.  When I wrote "before
I saw your patch" yesterday, I meant the formal, already-tested patch
submission, that I recall seeing while I tested the patchlet I'd posted.
I forgot you had included that patch also in the initial report, but I
see it there too.
https://gcc.gnu.org/pipermail/gcc-patches/2023-March/614884.html
https://gcc.gnu.org/pipermail/gcc-patches/2023-March/614880.html
https://gcc.gnu.org/pipermail/gcc-patches/2023-March/614857.html

I learned that tcl trick from you indeed, and that much I remember
clearly: I've long sought but failed to find a way to do that.

Alas, for some reason, I had a misrecollection that you had merely
recommended using that trick, instead of including an actual patch, in
the report I claimed to have based the patch on.  I suppose I may have
drawn that wrong conclusion from my having set out to write a patch
myself, instead of recommending the approval of yours.  That, in turn,
was presumably because there was an additional issue that needed fixing,
and that you had asked me to look into.  Anyhow, it's probably a safe
bet that I based our patch on yours indeed, but I wouldn't be able to
confirm or deny it either way: those details have unfortunately faded
away from my memory.

Anyway, it was based on the misrecollection that I stated "before even
seeing your patch", and I acknowledge that I was wrong, and probably
also overthinking the whole issue ;-)

Please accept my embarrassed apologies.  I think I had better memory
when I was younger, but I'm not really sure, I can't recall ;-D

-- 
Alexandre Oliva, happy hacker                https://FSFLA.org/blogs/lxo/
   Free Software Activist                       GNU Toolchain Engineer
Disinformation flourishes because many people care deeply about injustice
but very few check the facts.  Ask me about <https://stallmansupport.org>

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2023-04-06 23:40 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-17  6:55 [PATCH] Skip module_cmi_p and related unsupported module test Alexandre Oliva
2023-02-20  4:27 ` Jason Merrill
2023-02-22 17:33   ` Alexandre Oliva
2023-02-23 14:18     ` [PATCH] testsuite: Fix up modules.exp [PR108899] Jakub Jelinek
2023-02-23 15:02       ` Richard Biener
2023-03-29 19:59       ` 'g++.dg/modules/modules.exp': don't leak local 'unsupported' proc [PR108899] (was: [PATCH] testsuite: Fix up modules.exp [PR108899]) Thomas Schwinge
2023-03-30  7:00         ` 'g++.dg/modules/modules.exp': don't leak local 'unsupported' proc [PR108899] Alexandre Oliva
2023-03-30  9:39           ` Thomas Schwinge
2023-03-30 13:51           ` Alexandre Oliva
2023-03-31 18:52             ` Jason Merrill
2023-04-01 18:06             ` Mike Stump
2023-04-05  7:47             ` Thomas Schwinge
2023-04-06  2:38               ` Alexandre Oliva
2023-04-06 20:11                 ` Thomas Schwinge
2023-04-06 23:40                   ` Alexandre Oliva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).