[3/4] testsuite, jit: Allow for target-specific assembler scans.

Message ID 20240113135718.57643-4-iain@sandoe.co.uk
State Unresolved
Headers
Series [1/4] testsuite, jit: test-alias-attribute.c requires alias support. |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Iain Sandoe Jan. 13, 2024, 1:57 p.m. UTC
  If we want to support multiple object formats and to allow for
scan-assembler tests, we need to make it possible to adjust the
tests on a per-target basis.

This adds similar mechamisms to jit-verify-assembler-output{,-not}
to those used for the general scan-assembler dg directives.

As an aside; it would, perhaps, be possible to integrate this more
with scanasm.exp (which would also give access to function body
scanning) but I did not attempt that for this patch.

After this, we can accept things like:
... { jit-verify-assembler-output-not "......" { target { ! *-*-darwin* } } } }
or
... { jit-verify-assembler-output "......" { target *-*-darwin* } } }

gcc/testsuite/ChangeLog:

	* jit.dg/jit.exp: Accept target clauses in jit-verify-assembler
	handling.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
---
 gcc/testsuite/jit.dg/jit.exp | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
  

Comments

David Malcolm Jan. 16, 2024, 7:43 p.m. UTC | #1
On Sat, 2024-01-13 at 13:57 +0000, Iain Sandoe wrote:
> If we want to support multiple object formats and to allow for
> scan-assembler tests, we need to make it possible to adjust the
> tests on a per-target basis.
> 
> This adds similar mechamisms to jit-verify-assembler-output{,-not}
> to those used for the general scan-assembler dg directives.
> 
> As an aside; it would, perhaps, be possible to integrate this more
> with scanasm.exp (which would also give access to function body
> scanning) but I did not attempt that for this patch.
> 
> After this, we can accept things like:
> ... { jit-verify-assembler-output-not "......" { target { ! *-*-
> darwin* } } } }
> or
> ... { jit-verify-assembler-output "......" { target *-*-darwin* } } }


Thanks; LGTM for trunk, assuming your testing was successful

Dave

> 
> gcc/testsuite/ChangeLog:
> 
>         * jit.dg/jit.exp: Accept target clauses in jit-verify-
> assembler
>         handling.
> 
> Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
> ---
>  gcc/testsuite/jit.dg/jit.exp | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
> 
> diff --git a/gcc/testsuite/jit.dg/jit.exp
> b/gcc/testsuite/jit.dg/jit.exp
> index 56972064d30..286cfa8192a 100644
> --- a/gcc/testsuite/jit.dg/jit.exp
> +++ b/gcc/testsuite/jit.dg/jit.exp
> @@ -875,9 +875,23 @@ proc jit-verify-assembler { args } {
>  proc jit-verify-assembler-output { args } {
>      verbose "jit-verify-assembler: $args"
>  
> +    if { [llength $args] > 3 } {
> +       error "jit-verify-assembler-output: too many arguments"
> +       return
> +    }
> +
>      set dg-output-text [lindex $args 0]
>      verbose "dg-output-text: ${dg-output-text}"
>  
> +    if { [llength $args] >= 2 } {
> +       switch [dg-process-target [lindex $args 1]] {
> +           "S" { }
> +           "N" { return }
> +           "F" { setup_xfail "*-*-*" }
> +           "P" { }
> +       }
> +    }
> +
>      upvar 2 name name
>      verbose "name: $name"
>  
> @@ -907,9 +921,23 @@ proc jit-verify-assembler-output { args } {
>  proc jit-verify-assembler-output-not { args } {
>      verbose "jit-verify-assembler: $args"
>  
> +    if { [llength $args] > 3 } {
> +       error "jit-verify-assembler-output-not: too many arguments"
> +       return
> +    }
> +
>      set dg-output-text [lindex $args 0]
>      verbose "dg-output-text: ${dg-output-text}"
>  
> +    if { [llength $args] >= 2 } {
> +       switch [dg-process-target [lindex $args 1]] {
> +           "S" { }
> +           "N" { return }
> +           "F" { setup_xfail "*-*-*" }
> +           "P" { }
> +       }
> +    }
> +
>      upvar 2 name name
>      verbose "name: $name"
>
  

Patch

diff --git a/gcc/testsuite/jit.dg/jit.exp b/gcc/testsuite/jit.dg/jit.exp
index 56972064d30..286cfa8192a 100644
--- a/gcc/testsuite/jit.dg/jit.exp
+++ b/gcc/testsuite/jit.dg/jit.exp
@@ -875,9 +875,23 @@  proc jit-verify-assembler { args } {
 proc jit-verify-assembler-output { args } {
     verbose "jit-verify-assembler: $args"
 
+    if { [llength $args] > 3 } {
+	error "jit-verify-assembler-output: too many arguments"
+	return
+    }
+
     set dg-output-text [lindex $args 0]
     verbose "dg-output-text: ${dg-output-text}"
 
+    if { [llength $args] >= 2 } {
+	switch [dg-process-target [lindex $args 1]] {
+	    "S" { }
+	    "N" { return }
+	    "F" { setup_xfail "*-*-*" }
+	    "P" { }
+	}
+    }
+
     upvar 2 name name
     verbose "name: $name"
 
@@ -907,9 +921,23 @@  proc jit-verify-assembler-output { args } {
 proc jit-verify-assembler-output-not { args } {
     verbose "jit-verify-assembler: $args"
 
+    if { [llength $args] > 3 } {
+	error "jit-verify-assembler-output-not: too many arguments"
+	return
+    }
+
     set dg-output-text [lindex $args 0]
     verbose "dg-output-text: ${dg-output-text}"
 
+    if { [llength $args] >= 2 } {
+	switch [dg-process-target [lindex $args 1]] {
+	    "S" { }
+	    "N" { return }
+	    "F" { setup_xfail "*-*-*" }
+	    "P" { }
+	}
+    }
+
     upvar 2 name name
     verbose "name: $name"