public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] testsuite: Verify that module-mapper is avialable
@ 2022-09-23 12:03 Torbjörn SVENSSON
  2022-10-05  9:17 ` PING^1 [PATCH] testsuite: Verify that module-mapper is available Torbjorn SVENSSON
  0 siblings, 1 reply; 8+ messages in thread
From: Torbjörn SVENSSON @ 2022-09-23 12:03 UTC (permalink / raw)
  To: gcc-patches; +Cc: ro, mikestump, Torbjörn SVENSSON

For some test cases, it's required that the optional module mapper
"g++-mapper-server" is built. As the server is not required, the
test cases will fail if it can't be found.

gcc/testsuite/ChangeLog:

	* lib/target-supports.exp (check_is_prog_name_available):
	New.
	* lib/target-supports-dg.exp
	(dg-require-prog-name-available): New.
	* g++.dg/modules/modules.exp: Verify avilability of module
	mapper.

Signed-off-by: Torbjörn SVENSSON  <torbjorn.svensson@foss.st.com>
---
 gcc/testsuite/g++.dg/modules/modules.exp | 31 ++++++++++++++++++++++++
 gcc/testsuite/lib/target-supports-dg.exp | 15 ++++++++++++
 gcc/testsuite/lib/target-supports.exp    | 15 ++++++++++++
 3 files changed, 61 insertions(+)

diff --git a/gcc/testsuite/g++.dg/modules/modules.exp b/gcc/testsuite/g++.dg/modules/modules.exp
index afb323d0efd..4784803742a 100644
--- a/gcc/testsuite/g++.dg/modules/modules.exp
+++ b/gcc/testsuite/g++.dg/modules/modules.exp
@@ -279,6 +279,29 @@ proc module-init { src } {
     return $option_list
 }
 
+# Return 1 if requirements are met
+proc module-check-requirements { tests } {
+    foreach test $tests {
+	set tmp [dg-get-options $test]
+	foreach op $tmp {
+	    switch [lindex $op 0] {
+		"dg-additional-options" {
+		    # Example strings to match:
+		    # -fmodules-ts -fmodule-mapper=|@g++-mapper-server\\ -t\\ [srcdir]/inc-xlate-1.map
+		    # -fmodules-ts -fmodule-mapper=|@g++-mapper-server
+		    if [regexp -- {(^| )-fmodule-mapper=\|@([^\\ ]*)} [lindex $op 2] dummy dummy2 prog] {
+			verbose "Checking that mapper exist: $prog"
+			if { ![ check_is_prog_name_available $prog ] } {
+			    return 0
+			}
+		    }
+		}
+	    }
+	}
+    }
+    return 1
+}
+
 # cleanup any detritus from previous run
 cleanup_module_files [find $DEFAULT_REPO *.gcm]
 
@@ -307,6 +330,14 @@ foreach src [lsort [find $srcdir/$subdir {*_a.[CHX}]] {
 	set tests [lsort [find [file dirname $src] \
 			      [regsub {_a.[CHX]$} [file tail $src] {_[a-z].[CHX]}]]]
 
+	if { ![module-check-requirements $tests] } {
+	    set testcase [regsub {_a.[CH]} $src {}]
+	    set testcase \
+		[string range $testcase [string length "$srcdir/"] end]
+	    unsupported $testcase
+	    continue
+	}
+
 	set std_list [module-init $src]
 	foreach std $std_list {
 	    set mod_files {}
diff --git a/gcc/testsuite/lib/target-supports-dg.exp b/gcc/testsuite/lib/target-supports-dg.exp
index aa2164bc789..6ce3b2b1a1b 100644
--- a/gcc/testsuite/lib/target-supports-dg.exp
+++ b/gcc/testsuite/lib/target-supports-dg.exp
@@ -683,3 +683,18 @@ proc dg-require-symver { args } {
 	set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
     }
 }
+
+# If this target does not provide prog named "$args", skip this test.
+
+proc dg-require-prog-name-available { args } {
+    # The args are within another list; pull them out.
+    set args [lindex $args 0]
+
+    set prog [lindex $args 1]
+
+    if { ![ check_is_prog_name_available $prog ] } {
+        upvar dg-do-what dg-do-what
+        set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
+    }
+}
+
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 703aba412a6..c3b7a6c17b3 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -11928,3 +11928,18 @@ main:
 	.byte 0
   } ""]
 }
+ 
+# Return 1 if this target has prog named "$prog", 0 otherwise.
+
+proc check_is_prog_name_available { prog } {
+    global tool
+
+    set options [list "additional_flags=-print-prog-name=$prog"]
+    set output [lindex [${tool}_target_compile "" "" "none" $options] 0]
+
+    if { $output == $prog } {
+        return 0
+    }
+
+    return 1
+}
-- 
2.25.1


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

* PING^1 [PATCH] testsuite: Verify that module-mapper is available
  2022-09-23 12:03 [PATCH] testsuite: Verify that module-mapper is avialable Torbjörn SVENSSON
@ 2022-10-05  9:17 ` Torbjorn SVENSSON
  2022-10-14  7:42   ` PING^2 " Torbjorn SVENSSON
  0 siblings, 1 reply; 8+ messages in thread
From: Torbjorn SVENSSON @ 2022-10-05  9:17 UTC (permalink / raw)
  To: gcc-patches; +Cc: ro, mikestump, richard.earnshaw

Hi,

Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-September/602111.html

Kind regards,
Torbjörn

On 2022-09-23 14:03, Torbjörn SVENSSON wrote:
> For some test cases, it's required that the optional module mapper
> "g++-mapper-server" is built. As the server is not required, the
> test cases will fail if it can't be found.
> 
> gcc/testsuite/ChangeLog:
> 
> 	* lib/target-supports.exp (check_is_prog_name_available):
> 	New.
> 	* lib/target-supports-dg.exp
> 	(dg-require-prog-name-available): New.
> 	* g++.dg/modules/modules.exp: Verify avilability of module
> 	mapper.
> 
> Signed-off-by: Torbjörn SVENSSON  <torbjorn.svensson@foss.st.com>
> ---
>   gcc/testsuite/g++.dg/modules/modules.exp | 31 ++++++++++++++++++++++++
>   gcc/testsuite/lib/target-supports-dg.exp | 15 ++++++++++++
>   gcc/testsuite/lib/target-supports.exp    | 15 ++++++++++++
>   3 files changed, 61 insertions(+)
> 
> diff --git a/gcc/testsuite/g++.dg/modules/modules.exp b/gcc/testsuite/g++.dg/modules/modules.exp
> index afb323d0efd..4784803742a 100644
> --- a/gcc/testsuite/g++.dg/modules/modules.exp
> +++ b/gcc/testsuite/g++.dg/modules/modules.exp
> @@ -279,6 +279,29 @@ proc module-init { src } {
>       return $option_list
>   }
>   
> +# Return 1 if requirements are met
> +proc module-check-requirements { tests } {
> +    foreach test $tests {
> +	set tmp [dg-get-options $test]
> +	foreach op $tmp {
> +	    switch [lindex $op 0] {
> +		"dg-additional-options" {
> +		    # Example strings to match:
> +		    # -fmodules-ts -fmodule-mapper=|@g++-mapper-server\\ -t\\ [srcdir]/inc-xlate-1.map
> +		    # -fmodules-ts -fmodule-mapper=|@g++-mapper-server
> +		    if [regexp -- {(^| )-fmodule-mapper=\|@([^\\ ]*)} [lindex $op 2] dummy dummy2 prog] {
> +			verbose "Checking that mapper exist: $prog"
> +			if { ![ check_is_prog_name_available $prog ] } {
> +			    return 0
> +			}
> +		    }
> +		}
> +	    }
> +	}
> +    }
> +    return 1
> +}
> +
>   # cleanup any detritus from previous run
>   cleanup_module_files [find $DEFAULT_REPO *.gcm]
>   
> @@ -307,6 +330,14 @@ foreach src [lsort [find $srcdir/$subdir {*_a.[CHX}]] {
>   	set tests [lsort [find [file dirname $src] \
>   			      [regsub {_a.[CHX]$} [file tail $src] {_[a-z].[CHX]}]]]
>   
> +	if { ![module-check-requirements $tests] } {
> +	    set testcase [regsub {_a.[CH]} $src {}]
> +	    set testcase \
> +		[string range $testcase [string length "$srcdir/"] end]
> +	    unsupported $testcase
> +	    continue
> +	}
> +
>   	set std_list [module-init $src]
>   	foreach std $std_list {
>   	    set mod_files {}
> diff --git a/gcc/testsuite/lib/target-supports-dg.exp b/gcc/testsuite/lib/target-supports-dg.exp
> index aa2164bc789..6ce3b2b1a1b 100644
> --- a/gcc/testsuite/lib/target-supports-dg.exp
> +++ b/gcc/testsuite/lib/target-supports-dg.exp
> @@ -683,3 +683,18 @@ proc dg-require-symver { args } {
>   	set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
>       }
>   }
> +
> +# If this target does not provide prog named "$args", skip this test.
> +
> +proc dg-require-prog-name-available { args } {
> +    # The args are within another list; pull them out.
> +    set args [lindex $args 0]
> +
> +    set prog [lindex $args 1]
> +
> +    if { ![ check_is_prog_name_available $prog ] } {
> +        upvar dg-do-what dg-do-what
> +        set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
> +    }
> +}
> +
> diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
> index 703aba412a6..c3b7a6c17b3 100644
> --- a/gcc/testsuite/lib/target-supports.exp
> +++ b/gcc/testsuite/lib/target-supports.exp
> @@ -11928,3 +11928,18 @@ main:
>   	.byte 0
>     } ""]
>   }
> +
> +# Return 1 if this target has prog named "$prog", 0 otherwise.
> +
> +proc check_is_prog_name_available { prog } {
> +    global tool
> +
> +    set options [list "additional_flags=-print-prog-name=$prog"]
> +    set output [lindex [${tool}_target_compile "" "" "none" $options] 0]
> +
> +    if { $output == $prog } {
> +        return 0
> +    }
> +
> +    return 1
> +}

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

* PING^2 [PATCH] testsuite: Verify that module-mapper is available
  2022-10-05  9:17 ` PING^1 [PATCH] testsuite: Verify that module-mapper is available Torbjorn SVENSSON
@ 2022-10-14  7:42   ` Torbjorn SVENSSON
  2022-10-25 14:24     ` PING^3 " Torbjorn SVENSSON
  0 siblings, 1 reply; 8+ messages in thread
From: Torbjorn SVENSSON @ 2022-10-14  7:42 UTC (permalink / raw)
  To: gcc-patches; +Cc: ro, mikestump, richard.earnshaw

Hi,

Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602843.html

Kind regards,
Torbjörn

On 2022-10-05 11:17, Torbjorn SVENSSON wrote:
> Hi,
> 
> Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-September/602111.html
> 
> Kind regards,
> Torbjörn
> 
> On 2022-09-23 14:03, Torbjörn SVENSSON wrote:
>> For some test cases, it's required that the optional module mapper
>> "g++-mapper-server" is built. As the server is not required, the
>> test cases will fail if it can't be found.
>>
>> gcc/testsuite/ChangeLog:
>>
>>     * lib/target-supports.exp (check_is_prog_name_available):
>>     New.
>>     * lib/target-supports-dg.exp
>>     (dg-require-prog-name-available): New.
>>     * g++.dg/modules/modules.exp: Verify avilability of module
>>     mapper.
>>
>> Signed-off-by: Torbjörn SVENSSON  <torbjorn.svensson@foss.st.com>
>> ---
>>   gcc/testsuite/g++.dg/modules/modules.exp | 31 ++++++++++++++++++++++++
>>   gcc/testsuite/lib/target-supports-dg.exp | 15 ++++++++++++
>>   gcc/testsuite/lib/target-supports.exp    | 15 ++++++++++++
>>   3 files changed, 61 insertions(+)
>>
>> diff --git a/gcc/testsuite/g++.dg/modules/modules.exp 
>> b/gcc/testsuite/g++.dg/modules/modules.exp
>> index afb323d0efd..4784803742a 100644
>> --- a/gcc/testsuite/g++.dg/modules/modules.exp
>> +++ b/gcc/testsuite/g++.dg/modules/modules.exp
>> @@ -279,6 +279,29 @@ proc module-init { src } {
>>       return $option_list
>>   }
>> +# Return 1 if requirements are met
>> +proc module-check-requirements { tests } {
>> +    foreach test $tests {
>> +    set tmp [dg-get-options $test]
>> +    foreach op $tmp {
>> +        switch [lindex $op 0] {
>> +        "dg-additional-options" {
>> +            # Example strings to match:
>> +            # -fmodules-ts -fmodule-mapper=|@g++-mapper-server\\ -t\\ 
>> [srcdir]/inc-xlate-1.map
>> +            # -fmodules-ts -fmodule-mapper=|@g++-mapper-server
>> +            if [regexp -- {(^| )-fmodule-mapper=\|@([^\\ ]*)} [lindex 
>> $op 2] dummy dummy2 prog] {
>> +            verbose "Checking that mapper exist: $prog"
>> +            if { ![ check_is_prog_name_available $prog ] } {
>> +                return 0
>> +            }
>> +            }
>> +        }
>> +        }
>> +    }
>> +    }
>> +    return 1
>> +}
>> +
>>   # cleanup any detritus from previous run
>>   cleanup_module_files [find $DEFAULT_REPO *.gcm]
>> @@ -307,6 +330,14 @@ foreach src [lsort [find $srcdir/$subdir 
>> {*_a.[CHX}]] {
>>       set tests [lsort [find [file dirname $src] \
>>                     [regsub {_a.[CHX]$} [file tail $src] 
>> {_[a-z].[CHX]}]]]
>> +    if { ![module-check-requirements $tests] } {
>> +        set testcase [regsub {_a.[CH]} $src {}]
>> +        set testcase \
>> +        [string range $testcase [string length "$srcdir/"] end]
>> +        unsupported $testcase
>> +        continue
>> +    }
>> +
>>       set std_list [module-init $src]
>>       foreach std $std_list {
>>           set mod_files {}
>> diff --git a/gcc/testsuite/lib/target-supports-dg.exp 
>> b/gcc/testsuite/lib/target-supports-dg.exp
>> index aa2164bc789..6ce3b2b1a1b 100644
>> --- a/gcc/testsuite/lib/target-supports-dg.exp
>> +++ b/gcc/testsuite/lib/target-supports-dg.exp
>> @@ -683,3 +683,18 @@ proc dg-require-symver { args } {
>>       set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
>>       }
>>   }
>> +
>> +# If this target does not provide prog named "$args", skip this test.
>> +
>> +proc dg-require-prog-name-available { args } {
>> +    # The args are within another list; pull them out.
>> +    set args [lindex $args 0]
>> +
>> +    set prog [lindex $args 1]
>> +
>> +    if { ![ check_is_prog_name_available $prog ] } {
>> +        upvar dg-do-what dg-do-what
>> +        set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
>> +    }
>> +}
>> +
>> diff --git a/gcc/testsuite/lib/target-supports.exp 
>> b/gcc/testsuite/lib/target-supports.exp
>> index 703aba412a6..c3b7a6c17b3 100644
>> --- a/gcc/testsuite/lib/target-supports.exp
>> +++ b/gcc/testsuite/lib/target-supports.exp
>> @@ -11928,3 +11928,18 @@ main:
>>       .byte 0
>>     } ""]
>>   }
>> +
>> +# Return 1 if this target has prog named "$prog", 0 otherwise.
>> +
>> +proc check_is_prog_name_available { prog } {
>> +    global tool
>> +
>> +    set options [list "additional_flags=-print-prog-name=$prog"]
>> +    set output [lindex [${tool}_target_compile "" "" "none" $options] 0]
>> +
>> +    if { $output == $prog } {
>> +        return 0
>> +    }
>> +
>> +    return 1
>> +}

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

* PING^3 [PATCH] testsuite: Verify that module-mapper is available
  2022-10-14  7:42   ` PING^2 " Torbjorn SVENSSON
@ 2022-10-25 14:24     ` Torbjorn SVENSSON
  2022-11-02 18:13       ` PING^4 " Torbjorn SVENSSON
  0 siblings, 1 reply; 8+ messages in thread
From: Torbjorn SVENSSON @ 2022-10-25 14:24 UTC (permalink / raw)
  To: gcc-patches; +Cc: ro, mikestump, richard.earnshaw, nathan

Hi,

Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/603544.html

Kind regards,
Torbjörn

On 2022-10-14 09:42, Torbjorn SVENSSON wrote:
> Hi,
> 
> Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602843.html
> 
> Kind regards,
> Torbjörn
> 
> On 2022-10-05 11:17, Torbjorn SVENSSON wrote:
>> Hi,
>>
>> Ping, 
>> https://gcc.gnu.org/pipermail/gcc-patches/2022-September/602111.html
>>
>> Kind regards,
>> Torbjörn
>>
>> On 2022-09-23 14:03, Torbjörn SVENSSON wrote:
>>> For some test cases, it's required that the optional module mapper
>>> "g++-mapper-server" is built. As the server is not required, the
>>> test cases will fail if it can't be found.
>>>
>>> gcc/testsuite/ChangeLog:
>>>
>>>     * lib/target-supports.exp (check_is_prog_name_available):
>>>     New.
>>>     * lib/target-supports-dg.exp
>>>     (dg-require-prog-name-available): New.
>>>     * g++.dg/modules/modules.exp: Verify avilability of module
>>>     mapper.
>>>
>>> Signed-off-by: Torbjörn SVENSSON  <torbjorn.svensson@foss.st.com>
>>> ---
>>>   gcc/testsuite/g++.dg/modules/modules.exp | 31 ++++++++++++++++++++++++
>>>   gcc/testsuite/lib/target-supports-dg.exp | 15 ++++++++++++
>>>   gcc/testsuite/lib/target-supports.exp    | 15 ++++++++++++
>>>   3 files changed, 61 insertions(+)
>>>
>>> diff --git a/gcc/testsuite/g++.dg/modules/modules.exp 
>>> b/gcc/testsuite/g++.dg/modules/modules.exp
>>> index afb323d0efd..4784803742a 100644
>>> --- a/gcc/testsuite/g++.dg/modules/modules.exp
>>> +++ b/gcc/testsuite/g++.dg/modules/modules.exp
>>> @@ -279,6 +279,29 @@ proc module-init { src } {
>>>       return $option_list
>>>   }
>>> +# Return 1 if requirements are met
>>> +proc module-check-requirements { tests } {
>>> +    foreach test $tests {
>>> +    set tmp [dg-get-options $test]
>>> +    foreach op $tmp {
>>> +        switch [lindex $op 0] {
>>> +        "dg-additional-options" {
>>> +            # Example strings to match:
>>> +            # -fmodules-ts -fmodule-mapper=|@g++-mapper-server\\ 
>>> -t\\ [srcdir]/inc-xlate-1.map
>>> +            # -fmodules-ts -fmodule-mapper=|@g++-mapper-server
>>> +            if [regexp -- {(^| )-fmodule-mapper=\|@([^\\ ]*)} 
>>> [lindex $op 2] dummy dummy2 prog] {
>>> +            verbose "Checking that mapper exist: $prog"
>>> +            if { ![ check_is_prog_name_available $prog ] } {
>>> +                return 0
>>> +            }
>>> +            }
>>> +        }
>>> +        }
>>> +    }
>>> +    }
>>> +    return 1
>>> +}
>>> +
>>>   # cleanup any detritus from previous run
>>>   cleanup_module_files [find $DEFAULT_REPO *.gcm]
>>> @@ -307,6 +330,14 @@ foreach src [lsort [find $srcdir/$subdir 
>>> {*_a.[CHX}]] {
>>>       set tests [lsort [find [file dirname $src] \
>>>                     [regsub {_a.[CHX]$} [file tail $src] 
>>> {_[a-z].[CHX]}]]]
>>> +    if { ![module-check-requirements $tests] } {
>>> +        set testcase [regsub {_a.[CH]} $src {}]
>>> +        set testcase \
>>> +        [string range $testcase [string length "$srcdir/"] end]
>>> +        unsupported $testcase
>>> +        continue
>>> +    }
>>> +
>>>       set std_list [module-init $src]
>>>       foreach std $std_list {
>>>           set mod_files {}
>>> diff --git a/gcc/testsuite/lib/target-supports-dg.exp 
>>> b/gcc/testsuite/lib/target-supports-dg.exp
>>> index aa2164bc789..6ce3b2b1a1b 100644
>>> --- a/gcc/testsuite/lib/target-supports-dg.exp
>>> +++ b/gcc/testsuite/lib/target-supports-dg.exp
>>> @@ -683,3 +683,18 @@ proc dg-require-symver { args } {
>>>       set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
>>>       }
>>>   }
>>> +
>>> +# If this target does not provide prog named "$args", skip this test.
>>> +
>>> +proc dg-require-prog-name-available { args } {
>>> +    # The args are within another list; pull them out.
>>> +    set args [lindex $args 0]
>>> +
>>> +    set prog [lindex $args 1]
>>> +
>>> +    if { ![ check_is_prog_name_available $prog ] } {
>>> +        upvar dg-do-what dg-do-what
>>> +        set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
>>> +    }
>>> +}
>>> +
>>> diff --git a/gcc/testsuite/lib/target-supports.exp 
>>> b/gcc/testsuite/lib/target-supports.exp
>>> index 703aba412a6..c3b7a6c17b3 100644
>>> --- a/gcc/testsuite/lib/target-supports.exp
>>> +++ b/gcc/testsuite/lib/target-supports.exp
>>> @@ -11928,3 +11928,18 @@ main:
>>>       .byte 0
>>>     } ""]
>>>   }
>>> +
>>> +# Return 1 if this target has prog named "$prog", 0 otherwise.
>>> +
>>> +proc check_is_prog_name_available { prog } {
>>> +    global tool
>>> +
>>> +    set options [list "additional_flags=-print-prog-name=$prog"]
>>> +    set output [lindex [${tool}_target_compile "" "" "none" 
>>> $options] 0]
>>> +
>>> +    if { $output == $prog } {
>>> +        return 0
>>> +    }
>>> +
>>> +    return 1
>>> +}

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

* Re: PING^4 [PATCH] testsuite: Verify that module-mapper is available
  2022-10-25 14:24     ` PING^3 " Torbjorn SVENSSON
@ 2022-11-02 18:13       ` Torbjorn SVENSSON
  2022-11-17 16:45         ` PING^5 " Torbjorn SVENSSON
  0 siblings, 1 reply; 8+ messages in thread
From: Torbjorn SVENSSON @ 2022-11-02 18:13 UTC (permalink / raw)
  To: gcc-patches; +Cc: richard.earnshaw, nathan

Hi,

Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602844.html

Ok for trunk?

Kind regards,
Torbjörn

On 2022-10-25 16:24, Torbjorn SVENSSON via Gcc-patches wrote:
> Hi,
> 
> Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/603544.html
> 
> Kind regards,
> Torbjörn
> 
> On 2022-10-14 09:42, Torbjorn SVENSSON wrote:
>> Hi,
>>
>> Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602843.html
>>
>> Kind regards,
>> Torbjörn
>>
>> On 2022-10-05 11:17, Torbjorn SVENSSON wrote:
>>> Hi,
>>>
>>> Ping, 
>>> https://gcc.gnu.org/pipermail/gcc-patches/2022-September/602111.html
>>>
>>> Kind regards,
>>> Torbjörn
>>>
>>> On 2022-09-23 14:03, Torbjörn SVENSSON wrote:
>>>> For some test cases, it's required that the optional module mapper
>>>> "g++-mapper-server" is built. As the server is not required, the
>>>> test cases will fail if it can't be found.
>>>>
>>>> gcc/testsuite/ChangeLog:
>>>>
>>>>     * lib/target-supports.exp (check_is_prog_name_available):
>>>>     New.
>>>>     * lib/target-supports-dg.exp
>>>>     (dg-require-prog-name-available): New.
>>>>     * g++.dg/modules/modules.exp: Verify avilability of module
>>>>     mapper.
>>>>
>>>> Signed-off-by: Torbjörn SVENSSON  <torbjorn.svensson@foss.st.com>
>>>> ---
>>>>   gcc/testsuite/g++.dg/modules/modules.exp | 31 
>>>> ++++++++++++++++++++++++
>>>>   gcc/testsuite/lib/target-supports-dg.exp | 15 ++++++++++++
>>>>   gcc/testsuite/lib/target-supports.exp    | 15 ++++++++++++
>>>>   3 files changed, 61 insertions(+)
>>>>
>>>> diff --git a/gcc/testsuite/g++.dg/modules/modules.exp 
>>>> b/gcc/testsuite/g++.dg/modules/modules.exp
>>>> index afb323d0efd..4784803742a 100644
>>>> --- a/gcc/testsuite/g++.dg/modules/modules.exp
>>>> +++ b/gcc/testsuite/g++.dg/modules/modules.exp
>>>> @@ -279,6 +279,29 @@ proc module-init { src } {
>>>>       return $option_list
>>>>   }
>>>> +# Return 1 if requirements are met
>>>> +proc module-check-requirements { tests } {
>>>> +    foreach test $tests {
>>>> +    set tmp [dg-get-options $test]
>>>> +    foreach op $tmp {
>>>> +        switch [lindex $op 0] {
>>>> +        "dg-additional-options" {
>>>> +            # Example strings to match:
>>>> +            # -fmodules-ts -fmodule-mapper=|@g++-mapper-server\\ 
>>>> -t\\ [srcdir]/inc-xlate-1.map
>>>> +            # -fmodules-ts -fmodule-mapper=|@g++-mapper-server
>>>> +            if [regexp -- {(^| )-fmodule-mapper=\|@([^\\ ]*)} 
>>>> [lindex $op 2] dummy dummy2 prog] {
>>>> +            verbose "Checking that mapper exist: $prog"
>>>> +            if { ![ check_is_prog_name_available $prog ] } {
>>>> +                return 0
>>>> +            }
>>>> +            }
>>>> +        }
>>>> +        }
>>>> +    }
>>>> +    }
>>>> +    return 1
>>>> +}
>>>> +
>>>>   # cleanup any detritus from previous run
>>>>   cleanup_module_files [find $DEFAULT_REPO *.gcm]
>>>> @@ -307,6 +330,14 @@ foreach src [lsort [find $srcdir/$subdir 
>>>> {*_a.[CHX}]] {
>>>>       set tests [lsort [find [file dirname $src] \
>>>>                     [regsub {_a.[CHX]$} [file tail $src] 
>>>> {_[a-z].[CHX]}]]]
>>>> +    if { ![module-check-requirements $tests] } {
>>>> +        set testcase [regsub {_a.[CH]} $src {}]
>>>> +        set testcase \
>>>> +        [string range $testcase [string length "$srcdir/"] end]
>>>> +        unsupported $testcase
>>>> +        continue
>>>> +    }
>>>> +
>>>>       set std_list [module-init $src]
>>>>       foreach std $std_list {
>>>>           set mod_files {}
>>>> diff --git a/gcc/testsuite/lib/target-supports-dg.exp 
>>>> b/gcc/testsuite/lib/target-supports-dg.exp
>>>> index aa2164bc789..6ce3b2b1a1b 100644
>>>> --- a/gcc/testsuite/lib/target-supports-dg.exp
>>>> +++ b/gcc/testsuite/lib/target-supports-dg.exp
>>>> @@ -683,3 +683,18 @@ proc dg-require-symver { args } {
>>>>       set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
>>>>       }
>>>>   }
>>>> +
>>>> +# If this target does not provide prog named "$args", skip this test.
>>>> +
>>>> +proc dg-require-prog-name-available { args } {
>>>> +    # The args are within another list; pull them out.
>>>> +    set args [lindex $args 0]
>>>> +
>>>> +    set prog [lindex $args 1]
>>>> +
>>>> +    if { ![ check_is_prog_name_available $prog ] } {
>>>> +        upvar dg-do-what dg-do-what
>>>> +        set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
>>>> +    }
>>>> +}
>>>> +
>>>> diff --git a/gcc/testsuite/lib/target-supports.exp 
>>>> b/gcc/testsuite/lib/target-supports.exp
>>>> index 703aba412a6..c3b7a6c17b3 100644
>>>> --- a/gcc/testsuite/lib/target-supports.exp
>>>> +++ b/gcc/testsuite/lib/target-supports.exp
>>>> @@ -11928,3 +11928,18 @@ main:
>>>>       .byte 0
>>>>     } ""]
>>>>   }
>>>> +
>>>> +# Return 1 if this target has prog named "$prog", 0 otherwise.
>>>> +
>>>> +proc check_is_prog_name_available { prog } {
>>>> +    global tool
>>>> +
>>>> +    set options [list "additional_flags=-print-prog-name=$prog"]
>>>> +    set output [lindex [${tool}_target_compile "" "" "none" 
>>>> $options] 0]
>>>> +
>>>> +    if { $output == $prog } {
>>>> +        return 0
>>>> +    }
>>>> +
>>>> +    return 1
>>>> +}

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

* PING^5 [PATCH] testsuite: Verify that module-mapper is available
  2022-11-02 18:13       ` PING^4 " Torbjorn SVENSSON
@ 2022-11-17 16:45         ` Torbjorn SVENSSON
  2022-11-18  8:14           ` Richard Biener
  0 siblings, 1 reply; 8+ messages in thread
From: Torbjorn SVENSSON @ 2022-11-17 16:45 UTC (permalink / raw)
  To: gcc-patches; +Cc: richard.earnshaw, nathan

Hi,

Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-November/604895.html

Ok for trunk?

Kind regards,
Torbjörn

On 2022-11-02 19:13, Torbjorn SVENSSON wrote:
> Hi,
> 
> Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602844.html
> 
> Ok for trunk?
> 
> Kind regards,
> Torbjörn
> 
> On 2022-10-25 16:24, Torbjorn SVENSSON via Gcc-patches wrote:
>> Hi,
>>
>> Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/603544.html
>>
>> Kind regards,
>> Torbjörn
>>
>> On 2022-10-14 09:42, Torbjorn SVENSSON wrote:
>>> Hi,
>>>
>>> Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602843.html
>>>
>>> Kind regards,
>>> Torbjörn
>>>
>>> On 2022-10-05 11:17, Torbjorn SVENSSON wrote:
>>>> Hi,
>>>>
>>>> Ping, 
>>>> https://gcc.gnu.org/pipermail/gcc-patches/2022-September/602111.html
>>>>
>>>> Kind regards,
>>>> Torbjörn
>>>>
>>>> On 2022-09-23 14:03, Torbjörn SVENSSON wrote:
>>>>> For some test cases, it's required that the optional module mapper
>>>>> "g++-mapper-server" is built. As the server is not required, the
>>>>> test cases will fail if it can't be found.
>>>>>
>>>>> gcc/testsuite/ChangeLog:
>>>>>
>>>>>     * lib/target-supports.exp (check_is_prog_name_available):
>>>>>     New.
>>>>>     * lib/target-supports-dg.exp
>>>>>     (dg-require-prog-name-available): New.
>>>>>     * g++.dg/modules/modules.exp: Verify avilability of module
>>>>>     mapper.
>>>>>
>>>>> Signed-off-by: Torbjörn SVENSSON  <torbjorn.svensson@foss.st.com>
>>>>> ---
>>>>>   gcc/testsuite/g++.dg/modules/modules.exp | 31 
>>>>> ++++++++++++++++++++++++
>>>>>   gcc/testsuite/lib/target-supports-dg.exp | 15 ++++++++++++
>>>>>   gcc/testsuite/lib/target-supports.exp    | 15 ++++++++++++
>>>>>   3 files changed, 61 insertions(+)
>>>>>
>>>>> diff --git a/gcc/testsuite/g++.dg/modules/modules.exp 
>>>>> b/gcc/testsuite/g++.dg/modules/modules.exp
>>>>> index afb323d0efd..4784803742a 100644
>>>>> --- a/gcc/testsuite/g++.dg/modules/modules.exp
>>>>> +++ b/gcc/testsuite/g++.dg/modules/modules.exp
>>>>> @@ -279,6 +279,29 @@ proc module-init { src } {
>>>>>       return $option_list
>>>>>   }
>>>>> +# Return 1 if requirements are met
>>>>> +proc module-check-requirements { tests } {
>>>>> +    foreach test $tests {
>>>>> +    set tmp [dg-get-options $test]
>>>>> +    foreach op $tmp {
>>>>> +        switch [lindex $op 0] {
>>>>> +        "dg-additional-options" {
>>>>> +            # Example strings to match:
>>>>> +            # -fmodules-ts -fmodule-mapper=|@g++-mapper-server\\ 
>>>>> -t\\ [srcdir]/inc-xlate-1.map
>>>>> +            # -fmodules-ts -fmodule-mapper=|@g++-mapper-server
>>>>> +            if [regexp -- {(^| )-fmodule-mapper=\|@([^\\ ]*)} 
>>>>> [lindex $op 2] dummy dummy2 prog] {
>>>>> +            verbose "Checking that mapper exist: $prog"
>>>>> +            if { ![ check_is_prog_name_available $prog ] } {
>>>>> +                return 0
>>>>> +            }
>>>>> +            }
>>>>> +        }
>>>>> +        }
>>>>> +    }
>>>>> +    }
>>>>> +    return 1
>>>>> +}
>>>>> +
>>>>>   # cleanup any detritus from previous run
>>>>>   cleanup_module_files [find $DEFAULT_REPO *.gcm]
>>>>> @@ -307,6 +330,14 @@ foreach src [lsort [find $srcdir/$subdir 
>>>>> {*_a.[CHX}]] {
>>>>>       set tests [lsort [find [file dirname $src] \
>>>>>                     [regsub {_a.[CHX]$} [file tail $src] 
>>>>> {_[a-z].[CHX]}]]]
>>>>> +    if { ![module-check-requirements $tests] } {
>>>>> +        set testcase [regsub {_a.[CH]} $src {}]
>>>>> +        set testcase \
>>>>> +        [string range $testcase [string length "$srcdir/"] end]
>>>>> +        unsupported $testcase
>>>>> +        continue
>>>>> +    }
>>>>> +
>>>>>       set std_list [module-init $src]
>>>>>       foreach std $std_list {
>>>>>           set mod_files {}
>>>>> diff --git a/gcc/testsuite/lib/target-supports-dg.exp 
>>>>> b/gcc/testsuite/lib/target-supports-dg.exp
>>>>> index aa2164bc789..6ce3b2b1a1b 100644
>>>>> --- a/gcc/testsuite/lib/target-supports-dg.exp
>>>>> +++ b/gcc/testsuite/lib/target-supports-dg.exp
>>>>> @@ -683,3 +683,18 @@ proc dg-require-symver { args } {
>>>>>       set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
>>>>>       }
>>>>>   }
>>>>> +
>>>>> +# If this target does not provide prog named "$args", skip this test.
>>>>> +
>>>>> +proc dg-require-prog-name-available { args } {
>>>>> +    # The args are within another list; pull them out.
>>>>> +    set args [lindex $args 0]
>>>>> +
>>>>> +    set prog [lindex $args 1]
>>>>> +
>>>>> +    if { ![ check_is_prog_name_available $prog ] } {
>>>>> +        upvar dg-do-what dg-do-what
>>>>> +        set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
>>>>> +    }
>>>>> +}
>>>>> +
>>>>> diff --git a/gcc/testsuite/lib/target-supports.exp 
>>>>> b/gcc/testsuite/lib/target-supports.exp
>>>>> index 703aba412a6..c3b7a6c17b3 100644
>>>>> --- a/gcc/testsuite/lib/target-supports.exp
>>>>> +++ b/gcc/testsuite/lib/target-supports.exp
>>>>> @@ -11928,3 +11928,18 @@ main:
>>>>>       .byte 0
>>>>>     } ""]
>>>>>   }
>>>>> +
>>>>> +# Return 1 if this target has prog named "$prog", 0 otherwise.
>>>>> +
>>>>> +proc check_is_prog_name_available { prog } {
>>>>> +    global tool
>>>>> +
>>>>> +    set options [list "additional_flags=-print-prog-name=$prog"]
>>>>> +    set output [lindex [${tool}_target_compile "" "" "none" 
>>>>> $options] 0]
>>>>> +
>>>>> +    if { $output == $prog } {
>>>>> +        return 0
>>>>> +    }
>>>>> +
>>>>> +    return 1
>>>>> +}

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

* Re: PING^5 [PATCH] testsuite: Verify that module-mapper is available
  2022-11-17 16:45         ` PING^5 " Torbjorn SVENSSON
@ 2022-11-18  8:14           ` Richard Biener
  2022-11-18 10:32             ` Torbjorn SVENSSON
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Biener @ 2022-11-18  8:14 UTC (permalink / raw)
  To: Torbjorn SVENSSON; +Cc: gcc-patches, richard.earnshaw, nathan

On Thu, Nov 17, 2022 at 6:09 PM Torbjorn SVENSSON via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Hi,
>
> Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-November/604895.html
>
> Ok for trunk?

OK.

> Kind regards,
> Torbjörn
>
> On 2022-11-02 19:13, Torbjorn SVENSSON wrote:
> > Hi,
> >
> > Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602844.html
> >
> > Ok for trunk?
> >
> > Kind regards,
> > Torbjörn
> >
> > On 2022-10-25 16:24, Torbjorn SVENSSON via Gcc-patches wrote:
> >> Hi,
> >>
> >> Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/603544.html
> >>
> >> Kind regards,
> >> Torbjörn
> >>
> >> On 2022-10-14 09:42, Torbjorn SVENSSON wrote:
> >>> Hi,
> >>>
> >>> Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602843.html
> >>>
> >>> Kind regards,
> >>> Torbjörn
> >>>
> >>> On 2022-10-05 11:17, Torbjorn SVENSSON wrote:
> >>>> Hi,
> >>>>
> >>>> Ping,
> >>>> https://gcc.gnu.org/pipermail/gcc-patches/2022-September/602111.html
> >>>>
> >>>> Kind regards,
> >>>> Torbjörn
> >>>>
> >>>> On 2022-09-23 14:03, Torbjörn SVENSSON wrote:
> >>>>> For some test cases, it's required that the optional module mapper
> >>>>> "g++-mapper-server" is built. As the server is not required, the
> >>>>> test cases will fail if it can't be found.
> >>>>>
> >>>>> gcc/testsuite/ChangeLog:
> >>>>>
> >>>>>     * lib/target-supports.exp (check_is_prog_name_available):
> >>>>>     New.
> >>>>>     * lib/target-supports-dg.exp
> >>>>>     (dg-require-prog-name-available): New.
> >>>>>     * g++.dg/modules/modules.exp: Verify avilability of module
> >>>>>     mapper.
> >>>>>
> >>>>> Signed-off-by: Torbjörn SVENSSON  <torbjorn.svensson@foss.st.com>
> >>>>> ---
> >>>>>   gcc/testsuite/g++.dg/modules/modules.exp | 31
> >>>>> ++++++++++++++++++++++++
> >>>>>   gcc/testsuite/lib/target-supports-dg.exp | 15 ++++++++++++
> >>>>>   gcc/testsuite/lib/target-supports.exp    | 15 ++++++++++++
> >>>>>   3 files changed, 61 insertions(+)
> >>>>>
> >>>>> diff --git a/gcc/testsuite/g++.dg/modules/modules.exp
> >>>>> b/gcc/testsuite/g++.dg/modules/modules.exp
> >>>>> index afb323d0efd..4784803742a 100644
> >>>>> --- a/gcc/testsuite/g++.dg/modules/modules.exp
> >>>>> +++ b/gcc/testsuite/g++.dg/modules/modules.exp
> >>>>> @@ -279,6 +279,29 @@ proc module-init { src } {
> >>>>>       return $option_list
> >>>>>   }
> >>>>> +# Return 1 if requirements are met
> >>>>> +proc module-check-requirements { tests } {
> >>>>> +    foreach test $tests {
> >>>>> +    set tmp [dg-get-options $test]
> >>>>> +    foreach op $tmp {
> >>>>> +        switch [lindex $op 0] {
> >>>>> +        "dg-additional-options" {
> >>>>> +            # Example strings to match:
> >>>>> +            # -fmodules-ts -fmodule-mapper=|@g++-mapper-server\\
> >>>>> -t\\ [srcdir]/inc-xlate-1.map
> >>>>> +            # -fmodules-ts -fmodule-mapper=|@g++-mapper-server
> >>>>> +            if [regexp -- {(^| )-fmodule-mapper=\|@([^\\ ]*)}
> >>>>> [lindex $op 2] dummy dummy2 prog] {
> >>>>> +            verbose "Checking that mapper exist: $prog"
> >>>>> +            if { ![ check_is_prog_name_available $prog ] } {
> >>>>> +                return 0
> >>>>> +            }
> >>>>> +            }
> >>>>> +        }
> >>>>> +        }
> >>>>> +    }
> >>>>> +    }
> >>>>> +    return 1
> >>>>> +}
> >>>>> +
> >>>>>   # cleanup any detritus from previous run
> >>>>>   cleanup_module_files [find $DEFAULT_REPO *.gcm]
> >>>>> @@ -307,6 +330,14 @@ foreach src [lsort [find $srcdir/$subdir
> >>>>> {*_a.[CHX}]] {
> >>>>>       set tests [lsort [find [file dirname $src] \
> >>>>>                     [regsub {_a.[CHX]$} [file tail $src]
> >>>>> {_[a-z].[CHX]}]]]
> >>>>> +    if { ![module-check-requirements $tests] } {
> >>>>> +        set testcase [regsub {_a.[CH]} $src {}]
> >>>>> +        set testcase \
> >>>>> +        [string range $testcase [string length "$srcdir/"] end]
> >>>>> +        unsupported $testcase
> >>>>> +        continue
> >>>>> +    }
> >>>>> +
> >>>>>       set std_list [module-init $src]
> >>>>>       foreach std $std_list {
> >>>>>           set mod_files {}
> >>>>> diff --git a/gcc/testsuite/lib/target-supports-dg.exp
> >>>>> b/gcc/testsuite/lib/target-supports-dg.exp
> >>>>> index aa2164bc789..6ce3b2b1a1b 100644
> >>>>> --- a/gcc/testsuite/lib/target-supports-dg.exp
> >>>>> +++ b/gcc/testsuite/lib/target-supports-dg.exp
> >>>>> @@ -683,3 +683,18 @@ proc dg-require-symver { args } {
> >>>>>       set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
> >>>>>       }
> >>>>>   }
> >>>>> +
> >>>>> +# If this target does not provide prog named "$args", skip this test.
> >>>>> +
> >>>>> +proc dg-require-prog-name-available { args } {
> >>>>> +    # The args are within another list; pull them out.
> >>>>> +    set args [lindex $args 0]
> >>>>> +
> >>>>> +    set prog [lindex $args 1]
> >>>>> +
> >>>>> +    if { ![ check_is_prog_name_available $prog ] } {
> >>>>> +        upvar dg-do-what dg-do-what
> >>>>> +        set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
> >>>>> +    }
> >>>>> +}
> >>>>> +
> >>>>> diff --git a/gcc/testsuite/lib/target-supports.exp
> >>>>> b/gcc/testsuite/lib/target-supports.exp
> >>>>> index 703aba412a6..c3b7a6c17b3 100644
> >>>>> --- a/gcc/testsuite/lib/target-supports.exp
> >>>>> +++ b/gcc/testsuite/lib/target-supports.exp
> >>>>> @@ -11928,3 +11928,18 @@ main:
> >>>>>       .byte 0
> >>>>>     } ""]
> >>>>>   }
> >>>>> +
> >>>>> +# Return 1 if this target has prog named "$prog", 0 otherwise.
> >>>>> +
> >>>>> +proc check_is_prog_name_available { prog } {
> >>>>> +    global tool
> >>>>> +
> >>>>> +    set options [list "additional_flags=-print-prog-name=$prog"]
> >>>>> +    set output [lindex [${tool}_target_compile "" "" "none"
> >>>>> $options] 0]
> >>>>> +
> >>>>> +    if { $output == $prog } {
> >>>>> +        return 0
> >>>>> +    }
> >>>>> +
> >>>>> +    return 1
> >>>>> +}

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

* Re: PING^5 [PATCH] testsuite: Verify that module-mapper is available
  2022-11-18  8:14           ` Richard Biener
@ 2022-11-18 10:32             ` Torbjorn SVENSSON
  0 siblings, 0 replies; 8+ messages in thread
From: Torbjorn SVENSSON @ 2022-11-18 10:32 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches, richard.earnshaw, nathan



On 2022-11-18 09:14, Richard Biener wrote:
> On Thu, Nov 17, 2022 at 6:09 PM Torbjorn SVENSSON via Gcc-patches
> <gcc-patches@gcc.gnu.org> wrote:
>>
>> Hi,
>>
>> Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-November/604895.html
>>
>> Ok for trunk?
> 
> OK.

Pushed.

> 
>> Kind regards,
>> Torbjörn
>>
>> On 2022-11-02 19:13, Torbjorn SVENSSON wrote:
>>> Hi,
>>>
>>> Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602844.html
>>>
>>> Ok for trunk?
>>>
>>> Kind regards,
>>> Torbjörn
>>>
>>> On 2022-10-25 16:24, Torbjorn SVENSSON via Gcc-patches wrote:
>>>> Hi,
>>>>
>>>> Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/603544.html
>>>>
>>>> Kind regards,
>>>> Torbjörn
>>>>
>>>> On 2022-10-14 09:42, Torbjorn SVENSSON wrote:
>>>>> Hi,
>>>>>
>>>>> Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602843.html
>>>>>
>>>>> Kind regards,
>>>>> Torbjörn
>>>>>
>>>>> On 2022-10-05 11:17, Torbjorn SVENSSON wrote:
>>>>>> Hi,
>>>>>>
>>>>>> Ping,
>>>>>> https://gcc.gnu.org/pipermail/gcc-patches/2022-September/602111.html
>>>>>>
>>>>>> Kind regards,
>>>>>> Torbjörn
>>>>>>
>>>>>> On 2022-09-23 14:03, Torbjörn SVENSSON wrote:
>>>>>>> For some test cases, it's required that the optional module mapper
>>>>>>> "g++-mapper-server" is built. As the server is not required, the
>>>>>>> test cases will fail if it can't be found.
>>>>>>>
>>>>>>> gcc/testsuite/ChangeLog:
>>>>>>>
>>>>>>>      * lib/target-supports.exp (check_is_prog_name_available):
>>>>>>>      New.
>>>>>>>      * lib/target-supports-dg.exp
>>>>>>>      (dg-require-prog-name-available): New.
>>>>>>>      * g++.dg/modules/modules.exp: Verify avilability of module
>>>>>>>      mapper.
>>>>>>>
>>>>>>> Signed-off-by: Torbjörn SVENSSON  <torbjorn.svensson@foss.st.com>
>>>>>>> ---
>>>>>>>    gcc/testsuite/g++.dg/modules/modules.exp | 31
>>>>>>> ++++++++++++++++++++++++
>>>>>>>    gcc/testsuite/lib/target-supports-dg.exp | 15 ++++++++++++
>>>>>>>    gcc/testsuite/lib/target-supports.exp    | 15 ++++++++++++
>>>>>>>    3 files changed, 61 insertions(+)
>>>>>>>
>>>>>>> diff --git a/gcc/testsuite/g++.dg/modules/modules.exp
>>>>>>> b/gcc/testsuite/g++.dg/modules/modules.exp
>>>>>>> index afb323d0efd..4784803742a 100644
>>>>>>> --- a/gcc/testsuite/g++.dg/modules/modules.exp
>>>>>>> +++ b/gcc/testsuite/g++.dg/modules/modules.exp
>>>>>>> @@ -279,6 +279,29 @@ proc module-init { src } {
>>>>>>>        return $option_list
>>>>>>>    }
>>>>>>> +# Return 1 if requirements are met
>>>>>>> +proc module-check-requirements { tests } {
>>>>>>> +    foreach test $tests {
>>>>>>> +    set tmp [dg-get-options $test]
>>>>>>> +    foreach op $tmp {
>>>>>>> +        switch [lindex $op 0] {
>>>>>>> +        "dg-additional-options" {
>>>>>>> +            # Example strings to match:
>>>>>>> +            # -fmodules-ts -fmodule-mapper=|@g++-mapper-server\\
>>>>>>> -t\\ [srcdir]/inc-xlate-1.map
>>>>>>> +            # -fmodules-ts -fmodule-mapper=|@g++-mapper-server
>>>>>>> +            if [regexp -- {(^| )-fmodule-mapper=\|@([^\\ ]*)}
>>>>>>> [lindex $op 2] dummy dummy2 prog] {
>>>>>>> +            verbose "Checking that mapper exist: $prog"
>>>>>>> +            if { ![ check_is_prog_name_available $prog ] } {
>>>>>>> +                return 0
>>>>>>> +            }
>>>>>>> +            }
>>>>>>> +        }
>>>>>>> +        }
>>>>>>> +    }
>>>>>>> +    }
>>>>>>> +    return 1
>>>>>>> +}
>>>>>>> +
>>>>>>>    # cleanup any detritus from previous run
>>>>>>>    cleanup_module_files [find $DEFAULT_REPO *.gcm]
>>>>>>> @@ -307,6 +330,14 @@ foreach src [lsort [find $srcdir/$subdir
>>>>>>> {*_a.[CHX}]] {
>>>>>>>        set tests [lsort [find [file dirname $src] \
>>>>>>>                      [regsub {_a.[CHX]$} [file tail $src]
>>>>>>> {_[a-z].[CHX]}]]]
>>>>>>> +    if { ![module-check-requirements $tests] } {
>>>>>>> +        set testcase [regsub {_a.[CH]} $src {}]
>>>>>>> +        set testcase \
>>>>>>> +        [string range $testcase [string length "$srcdir/"] end]
>>>>>>> +        unsupported $testcase
>>>>>>> +        continue
>>>>>>> +    }
>>>>>>> +
>>>>>>>        set std_list [module-init $src]
>>>>>>>        foreach std $std_list {
>>>>>>>            set mod_files {}
>>>>>>> diff --git a/gcc/testsuite/lib/target-supports-dg.exp
>>>>>>> b/gcc/testsuite/lib/target-supports-dg.exp
>>>>>>> index aa2164bc789..6ce3b2b1a1b 100644
>>>>>>> --- a/gcc/testsuite/lib/target-supports-dg.exp
>>>>>>> +++ b/gcc/testsuite/lib/target-supports-dg.exp
>>>>>>> @@ -683,3 +683,18 @@ proc dg-require-symver { args } {
>>>>>>>        set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
>>>>>>>        }
>>>>>>>    }
>>>>>>> +
>>>>>>> +# If this target does not provide prog named "$args", skip this test.
>>>>>>> +
>>>>>>> +proc dg-require-prog-name-available { args } {
>>>>>>> +    # The args are within another list; pull them out.
>>>>>>> +    set args [lindex $args 0]
>>>>>>> +
>>>>>>> +    set prog [lindex $args 1]
>>>>>>> +
>>>>>>> +    if { ![ check_is_prog_name_available $prog ] } {
>>>>>>> +        upvar dg-do-what dg-do-what
>>>>>>> +        set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
>>>>>>> +    }
>>>>>>> +}
>>>>>>> +
>>>>>>> diff --git a/gcc/testsuite/lib/target-supports.exp
>>>>>>> b/gcc/testsuite/lib/target-supports.exp
>>>>>>> index 703aba412a6..c3b7a6c17b3 100644
>>>>>>> --- a/gcc/testsuite/lib/target-supports.exp
>>>>>>> +++ b/gcc/testsuite/lib/target-supports.exp
>>>>>>> @@ -11928,3 +11928,18 @@ main:
>>>>>>>        .byte 0
>>>>>>>      } ""]
>>>>>>>    }
>>>>>>> +
>>>>>>> +# Return 1 if this target has prog named "$prog", 0 otherwise.
>>>>>>> +
>>>>>>> +proc check_is_prog_name_available { prog } {
>>>>>>> +    global tool
>>>>>>> +
>>>>>>> +    set options [list "additional_flags=-print-prog-name=$prog"]
>>>>>>> +    set output [lindex [${tool}_target_compile "" "" "none"
>>>>>>> $options] 0]
>>>>>>> +
>>>>>>> +    if { $output == $prog } {
>>>>>>> +        return 0
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    return 1
>>>>>>> +}

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

end of thread, other threads:[~2022-11-18 10:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-23 12:03 [PATCH] testsuite: Verify that module-mapper is avialable Torbjörn SVENSSON
2022-10-05  9:17 ` PING^1 [PATCH] testsuite: Verify that module-mapper is available Torbjorn SVENSSON
2022-10-14  7:42   ` PING^2 " Torbjorn SVENSSON
2022-10-25 14:24     ` PING^3 " Torbjorn SVENSSON
2022-11-02 18:13       ` PING^4 " Torbjorn SVENSSON
2022-11-17 16:45         ` PING^5 " Torbjorn SVENSSON
2022-11-18  8:14           ` Richard Biener
2022-11-18 10:32             ` Torbjorn SVENSSON

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).