[v2,1/9] Convert skip_altivec_tests to allow form

Message ID 20230124230243.2471957-2-tom@tromey.com
State Committed
Headers
Series Use 'require' even more |

Commit Message

Tom Tromey Jan. 24, 2023, 11:02 p.m. UTC
  This renames skip_altivec_tests to allow_altivec_tests and updates its
users to use require.
---
 gdb/testsuite/gdb.arch/altivec-abi.exp        |  3 +-
 gdb/testsuite/gdb.arch/altivec-regs.exp       |  4 +--
 .../gdb.arch/powerpc-vector-regs.exp          |  3 +-
 gdb/testsuite/lib/gdb.exp                     | 28 +++++++++----------
 4 files changed, 20 insertions(+), 18 deletions(-)
  

Comments

Pedro Alves Jan. 25, 2023, 10:54 a.m. UTC | #1
On 2023-01-24 11:02 p.m., Tom Tromey wrote:
> -if {![istarget "powerpc*"] || [skip_altivec_tests]} {
> +require allow_altivec_tests
> +if {![istarget "powerpc*"]} {
>      verbose "Skipping altivec abi tests."
>      return
>  }

I noticed that this transformation changed one thing -- we'd now run allow_altivec_tests,
and hence the compilation tests that allow_altivec_tests does, on all targets, while
before we wouldn't, since the istarget check used to be before the skip_altivec_tests check.

Functionally, it's the same, even though it slows down testing a tiny bit for non-powerpc targets.

In the end, you'd now added the patch that removes this istarget check in the last patch of the
series, so it's good as is, no need to change anything here.

I went to look whether the skip_power_isa_3_1_tests and skip_vsx_tests patches (patches #3 and #4) were
likewise affected (as those are similar and could also have the istarget check pushed
down), but in those you've kept the order:

 -if {![istarget "powerpc*-*-linux*"] || [skip_vsx_tests]} {
 +if {![istarget "powerpc*-*-linux*"]} {
      verbose "Skipping PowerPC test for corefiles with VSX registers."
      return
  }
 +require allow_vsx_tests

... so we're all good.

The whole series looks good to me.
  

Patch

diff --git a/gdb/testsuite/gdb.arch/altivec-abi.exp b/gdb/testsuite/gdb.arch/altivec-abi.exp
index 28d0ae1fff9..1c3cda451e4 100644
--- a/gdb/testsuite/gdb.arch/altivec-abi.exp
+++ b/gdb/testsuite/gdb.arch/altivec-abi.exp
@@ -21,7 +21,8 @@ 
 # This file uses altivec-abi.c for input.
 #
 
-if {![istarget "powerpc*"] || [skip_altivec_tests]} {
+require allow_altivec_tests
+if {![istarget "powerpc*"]} {
     verbose "Skipping altivec abi tests."
     return
 }
diff --git a/gdb/testsuite/gdb.arch/altivec-regs.exp b/gdb/testsuite/gdb.arch/altivec-regs.exp
index 21e019122ce..8a7fd2e502c 100644
--- a/gdb/testsuite/gdb.arch/altivec-regs.exp
+++ b/gdb/testsuite/gdb.arch/altivec-regs.exp
@@ -21,8 +21,8 @@ 
 # This file uses altivec-regs.c for input.
 #
 
-
-if {![istarget "powerpc*"] || [skip_altivec_tests]} {
+require allow_altivec_tests
+if {![istarget "powerpc*"]} {
     verbose "Skipping altivec register tests."
     return
 }
diff --git a/gdb/testsuite/gdb.arch/powerpc-vector-regs.exp b/gdb/testsuite/gdb.arch/powerpc-vector-regs.exp
index f9d404b4835..bbcf45a555d 100644
--- a/gdb/testsuite/gdb.arch/powerpc-vector-regs.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-vector-regs.exp
@@ -20,7 +20,8 @@ 
 # 0 to 31 in each of the 16 bytes of each corresponding register, and
 # we then check if gdb sees these same values.
 
-if {![istarget "powerpc*"] || [skip_altivec_tests]} {
+require allow_altivec_tests
+if {![istarget "powerpc*"]} {
     verbose "Skipping PowerPC vector register tests."
     return
 }
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 3188f2de615..4346c858579 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3457,18 +3457,18 @@  proc support_displaced_stepping {} {
     return 0
 }
 
-# Run a test on the target to see if it supports vmx hardware.  Return 0 if so, 
-# 1 if it does not.  Based on 'check_vmx_hw_available' from the GCC testsuite.
+# Run a test on the target to see if it supports vmx hardware.  Return 1 if so, 
+# 0 if it does not.  Based on 'check_vmx_hw_available' from the GCC testsuite.
 
-gdb_caching_proc skip_altivec_tests {
+gdb_caching_proc allow_altivec_tests {
     global srcdir subdir gdb_prompt inferior_exited_re
 
-    set me "skip_altivec_tests"
+    set me "allow_altivec_tests"
 
     # Some simulators are known to not support VMX instructions.
     if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] } {
-        verbose "$me:  target known to not support VMX, returning 1" 2
-        return 1
+	verbose "$me:  target known to not support VMX, returning 0" 2
+	return 0
     }
 
     # Make sure we have a compiler that understands altivec.
@@ -3477,8 +3477,8 @@  gdb_caching_proc skip_altivec_tests {
     } elseif [test_compiler_info xlc*] {
         set compile_flags "additional_flags=-qaltivec"
     } else {
-        verbose "Could not compile with altivec support, returning 1" 2
-        return 1
+	verbose "Could not compile with altivec support, returning 0" 2
+	return 0
     }
 
     # Compile a test program containing VMX instructions.
@@ -3493,7 +3493,7 @@  gdb_caching_proc skip_altivec_tests {
 	}
     }
     if {![gdb_simple_compile $me $src executable $compile_flags]} {
-        return 1
+	return 0
     }
 
     # Compilation succeeded so now run it via gdb.
@@ -3506,22 +3506,22 @@  gdb_caching_proc skip_altivec_tests {
     gdb_expect {
         -re ".*Illegal instruction.*${gdb_prompt} $" {
             verbose -log "\n$me altivec hardware not detected" 
-            set skip_vmx_tests 1
+	    set allow_vmx_tests 0
         }
         -re ".*$inferior_exited_re normally.*${gdb_prompt} $" {
             verbose -log "\n$me: altivec hardware detected" 
-            set skip_vmx_tests 0
+	    set allow_vmx_tests 1
         }
         default {
           warning "\n$me: default case taken"
-            set skip_vmx_tests 1
+	    set allow_vmx_tests 0
         }
     }
     gdb_exit
     remote_file build delete $obj
 
-    verbose "$me:  returning $skip_vmx_tests" 2
-    return $skip_vmx_tests
+    verbose "$me:  returning $allow_vmx_tests" 2
+    return $allow_vmx_tests
 }
 
 # Run a test on the power target to see if it supports ISA 3.1 instructions