]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Improve test for processor feature om MPX registers test.
authorWalfred Tedeschi <walfred.tedeschi@intel.com>
Mon, 8 Jun 2015 15:37:40 +0000 (17:37 +0200)
committerWalfred Tedeschi <walfred.tedeschi@intel.com>
Wed, 10 Jun 2015 07:58:05 +0000 (09:58 +0200)
Skips the MPX register test in case target is not Intel.
Improves the test for MPX feature making MPX and AVX512
tests more similar in terms of initialization.
Indentation was improved on sample file and final return added
to have_mpx.  On test file identation was improved and
gdb_send was exchanged by gdb_test_multiple.

2015-06-08  Walfred Tedeschi  <walfred.tedeschi@intel.com>

gdb/testsuite
* gdb.arch/i386-mpx.c: Added final return to the have_mpx
function and improved indentation.
* gdb.arch/i386-mpx.exp: Exchanging gdb_send and gdb_expect for
gdb_test_multiple. Added additional tests to skip the test.

gdb/testsuite/gdb.arch/i386-mpx.c
gdb/testsuite/gdb.arch/i386-mpx.exp

index b62a2725269275842354c88aa9bb555cf6361ad4..87c753c399bdbb31193b9feb0da6c42feffef904 100644 (file)
@@ -46,6 +46,7 @@ have_mpx (void)
        else
         return 0;
      }
+  return 0;
 }
 
 int
index 8b50aed3b2bbc6007491b0e9e687e72a80d8ef55..6835b244301315cbdf26ebd28ed5c87c695dd2ad 100644 (file)
@@ -22,6 +22,11 @@ if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } {
 
 standard_testfile
 
+if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } {
+    verbose "Skipping x86 MPX tests."
+    return
+}
+
 set comp_flags "-fmpx -I${srcdir}/../nat/"
 
 if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
@@ -34,23 +39,23 @@ if ![runto_main] {
     return -1
 }
 
-send_gdb "print have_mpx ()\r"
-gdb_expect {
-    -re ".. = 1\r\n$gdb_prompt " {
-        pass "check whether processor supports MPX"
+set supports_mpx 0
+set test "probe MPX support"
+gdb_test_multiple "print have_mpx()" $test {
+    -re ".. = 1\r\n$gdb_prompt $" {
+        pass $test
+        set supports_mpx 1
     }
-    -re ".. = 0\r\n$gdb_prompt " {
-        verbose "processor does not support MPX; skipping MPX tests"
-        return
-    }
-    -re ".*$gdb_prompt $" {
-        fail "check whether processor supports MPX"
-    }
-    timeout {
-        fail "check whether processor supports MPX (timeout)"
+    -re ".. = 0\r\n$gdb_prompt $" {
+        pass $test
     }
 }
 
+if { !$supports_mpx } {
+    unsupported "processor does not support MPX"
+    return
+}
+
 # Test bndcfg register and bndstatus at startup
 set test_string "\\\{raw = 0x\[0-9a-f\]+, config = \\\{base = \[0-9\]+,\
 reserved = \[0-9\]+, preserved = \[0-9\]+, enabled = \[0-9\]+\\\}\\\}"