diff mbox series

Skip module_cmi_p and related unsupported module test

Message ID or5yc0u6f9.fsf@lxoliva.fsfla.org
State New
Headers show
Series Skip module_cmi_p and related unsupported module test | expand

Commit Message

Alexandre Oliva Feb. 17, 2023, 6:55 a.m. UTC
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(+)

Comments

Jason Merrill Feb. 20, 2023, 4:27 a.m. UTC | #1
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]
>   		}
>
Alexandre Oliva Feb. 22, 2023, 5:33 p.m. UTC | #2
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]
 		}
diff mbox series

Patch

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]
 		}