aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorPaul Gilliam <pgilliam@us.ibm.com>2005-05-03 00:41:49 +0000
committerPaul Gilliam <pgilliam@us.ibm.com>2005-05-03 00:41:49 +0000
commit3c95e6af3b96e8603713949ffb3e74cb5e8f2436 (patch)
treeecaece41e01cd3ca3068d019e65e3db4e318cfa9 /gdb/testsuite
parentb7be4033a10b569dec9686f5d02bde8129fcc6ff (diff)
downloadgdb-3c95e6af3b96e8603713949ffb3e74cb5e8f2436.zip
gdb-3c95e6af3b96e8603713949ffb3e74cb5e8f2436.tar.gz
gdb-3c95e6af3b96e8603713949ffb3e74cb5e8f2436.tar.bz2
2004-05-02 Paul Gilliam <pgilliam@us.ibm.com>
* lib/gdb.exp (skip_altivec_tests): New function, based on check_vmx_hw_available from the GCC testsuite. * lib/gdb.arch/altivec-abi.exp: Use skip_altivec_tests. * lib/gdb.arch/altivec-regs.exp: Likewise.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog7
-rw-r--r--gdb/testsuite/gdb.arch/altivec-abi.exp3
-rw-r--r--gdb/testsuite/gdb.arch/altivec-regs.exp3
-rw-r--r--gdb/testsuite/lib/gdb.exp88
4 files changed, 99 insertions, 2 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 7ccee46..87baff6 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2004-05-02 Paul Gilliam <pgilliam@us.ibm.com>
+
+ * lib/gdb.exp (skip_altivec_tests): New function, based on
+ check_vmx_hw_available from the GCC testsuite.
+ * lib/gdb.arch/altivec-abi.exp: Use skip_altivec_tests.
+ * lib/gdb.arch/altivec-regs.exp: Likewise.
+
2005-05-02 Jim Blandy <jimb@redhat.com>
* gdb.base/auxv.exp: Call 'untested' and return -1 instead of
diff --git a/gdb/testsuite/gdb.arch/altivec-abi.exp b/gdb/testsuite/gdb.arch/altivec-abi.exp
index 6b22c9a..91b625a 100644
--- a/gdb/testsuite/gdb.arch/altivec-abi.exp
+++ b/gdb/testsuite/gdb.arch/altivec-abi.exp
@@ -32,8 +32,9 @@ if $tracelevel then {
set prms_id 0
set bug_id 0
-if ![istarget "powerpc-*altivec"] then {
+if {![istarget "powerpc*"] || [skip_altivec_tests]} then {
verbose "Skipping altivec abi tests."
+ verbose -log "Skipping altivec abi tests."
return
}
diff --git a/gdb/testsuite/gdb.arch/altivec-regs.exp b/gdb/testsuite/gdb.arch/altivec-regs.exp
index a1330d0..52833a7 100644
--- a/gdb/testsuite/gdb.arch/altivec-regs.exp
+++ b/gdb/testsuite/gdb.arch/altivec-regs.exp
@@ -32,8 +32,9 @@ if $tracelevel then {
set prms_id 0
set bug_id 0
-if ![istarget "powerpc-*altivec"] then {
+if {![istarget "powerpc*"] || [skip_altivec_tests]} then {
verbose "Skipping altivec register tests."
+ verbose -log "Skipping altivec register tests."
return
}
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index ce9d6f1..c587c87 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1142,6 +1142,94 @@ proc skip_fortran_tests {} {
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.
+
+proc skip_altivec_tests {} {
+ global skip_vmx_tests_saved
+ global srcdir subdir gdb_prompt
+
+ # Use the cached value, if it exists.
+ set me "skip_altivec_tests"
+ if [info exists skip_vmx_tests_saved] {
+ verbose "$me: returning saved $skip_vmx_tests_saved" 2
+ return $skip_vmx_tests_saved
+ }
+
+ # 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 [set $skip_vmx_tests_saved 1]
+ }
+
+ # Make sure we have a compiler that understands altivec.
+ set compile_flags {debug additional_flags=-w}
+ if [get_compiler_info not-used] {
+ warning "Could not get compiler info"
+ return 1
+ }
+ if [test_compiler_info gcc*] {
+ set compile_flags "$compile_flags additional_flags=-maltivec"
+ } elseif [test_compiler_info xlc*] {
+ set compile_flags "$compile_flags additional_flags=-qaltivec"
+ } else {
+ verbose "Could not compile with altivec support, returning 1" 2
+ return 1
+ }
+
+ # Set up, compile, and execute a test program containing VMX instructions.
+ # Include the current process ID in the file names to prevent conflicts
+ # with invocations for multiple testsuites.
+ set src vmx[pid].c
+ set exe vmx[pid].x
+
+ set f [open $src "w"]
+ puts $f "int main() {"
+ puts $f "#ifdef __MACH__"
+ puts $f " asm volatile (\"vor v0,v0,v0\");"
+ puts $f "#else"
+ puts $f " asm volatile (\"vor 0,0,0\");"
+ puts $f "#endif"
+ puts $f " return 0; }"
+ close $f
+
+ verbose "$me: compiling testfile $src" 2
+ set lines [gdb_compile $src $exe executable $compile_flags]
+ file delete $src
+
+ if ![string match "" $lines] then {
+ verbose "$me: testfile compilation failed, returning 1" 2
+ return [set skip_vmx_tests_saved 1]
+ }
+
+ # No error message, compilation succeeded so now run it via gdb.
+
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+ gdb_load "$exe"
+ gdb_run_cmd
+ gdb_expect {
+ -re ".*Illegal instruction.*${gdb_prompt} $" {
+ verbose -log "\n$me altivec hardware not detected"
+ set skip_vmx_tests_saved 1
+ }
+ -re ".*Program exited normally.*${gdb_prompt} $" {
+ verbose -log "\n$me: altivec hardware detected"
+ set skip_vmx_tests_saved 0
+ }
+ default {
+ warning "\n$me: default case taken"
+ set skip_vmx_tests_saved 1
+ }
+ }
+ gdb_exit
+ remote_file build delete $exe
+
+ verbose "$me: returning $skip_vmx_tests_saved" 2
+ return $skip_vmx_tests_saved
+}
+
# Skip all the tests in the file if you are not on an hppa running
# hpux target.