This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix MPX and AVX512 tests for path changes.


Changes on the path for i386-cpuid.h file lead to failure in compiling
tests for MPX and AVX512.  Conformity between both tests is also
addressed with this path.

2014-08-12  Walfred Tedeschi  <walfred.tedeschi@intel.com>

gdb/testsuite
	* gdb.arch/i386-avx512.c: Change path in include file.
	* gdb.arch/i386-mpx.c: Change path in include file.
	* gdb.arch/i386-avx512.exp: Change include dir path
	compilation flag.
	* gdb.arch/i386-mpx.exp: Change include dir path
	compilation flag.

---
 gdb/testsuite/gdb.arch/i386-avx512.c   |  2 +-
 gdb/testsuite/gdb.arch/i386-avx512.exp |  2 +-
 gdb/testsuite/gdb.arch/i386-mpx.c      | 22 +++++++++++----------
 gdb/testsuite/gdb.arch/i386-mpx.exp    | 35 ++++++++++++++++++++--------------
 4 files changed, 35 insertions(+), 26 deletions(-)

diff --git a/gdb/testsuite/gdb.arch/i386-avx512.c b/gdb/testsuite/gdb.arch/i386-avx512.c
index 77fc347..77cdbec 100644
--- a/gdb/testsuite/gdb.arch/i386-avx512.c
+++ b/gdb/testsuite/gdb.arch/i386-avx512.c
@@ -17,7 +17,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "nat/x86-cpuid.h"
+#include "x86-cpuid.h"
 
 typedef struct
 {
diff --git a/gdb/testsuite/gdb.arch/i386-avx512.exp b/gdb/testsuite/gdb.arch/i386-avx512.exp
index c30ff23..57d553e 100644
--- a/gdb/testsuite/gdb.arch/i386-avx512.exp
+++ b/gdb/testsuite/gdb.arch/i386-avx512.exp
@@ -26,7 +26,7 @@ if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } {
 
 standard_testfile
 
-set comp_flags "-mavx512f -I${srcdir}/../common"
+set comp_flags "-mavx512f -I${srcdir}/../nat"
 
 if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
      [list debug nowarnings additional_flags=${comp_flags}]] } {
diff --git a/gdb/testsuite/gdb.arch/i386-mpx.c b/gdb/testsuite/gdb.arch/i386-mpx.c
index 8e5096d..3d33b80 100644
--- a/gdb/testsuite/gdb.arch/i386-mpx.c
+++ b/gdb/testsuite/gdb.arch/i386-mpx.c
@@ -18,7 +18,8 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <stdio.h>
-#include "nat/x86-cpuid.h"
+#include "x86-cpuid.h"
+
 
 #ifndef NOINLINE
 #define NOINLINE __attribute__ ((noinline))
@@ -35,17 +36,18 @@ have_mpx (void)
     return 0;
 
   if ((ecx & bit_OSXSAVE) == bit_OSXSAVE)
-     {
-       if (__get_cpuid_max (0, NULL) < 7)
-         return 0;
+    {
+      if (__get_cpuid_max (0, NULL) < 7)
+	return 0;
 
-       __cpuid_count (7, 0, eax, ebx, ecx, edx);
+      __cpuid_count (7, 0, eax, ebx, ecx, edx);
 
-       if ((ebx & bit_MPX) == bit_MPX)
-	 return 1;
-       else
-	 return 0;
-     }
+      if ((ebx & bit_MPX) == bit_MPX)
+	return 1;
+      else
+	return 0;
+    }
+  return 0;
 }
 
 int
diff --git a/gdb/testsuite/gdb.arch/i386-mpx.exp b/gdb/testsuite/gdb.arch/i386-mpx.exp
index 5ed89da..d56a4cc 100644
--- a/gdb/testsuite/gdb.arch/i386-mpx.exp
+++ b/gdb/testsuite/gdb.arch/i386-mpx.exp
@@ -22,10 +22,15 @@ if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } {
 
 standard_testfile
 
-set comp_flags "-fmpx -I${srcdir}/../common"
+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} \
- [list debug nowarnings additional_flags=${comp_flags}]] } {
+     [list debug nowarnings additional_flags=${comp_flags}]] } {
     return -1
 }
 
@@ -34,23 +39,25 @@ if ![runto_main] {
     return -1
 }
 
+set supports_mpx 0
+set test "probe MPX support"
 send_gdb "print have_mpx ()\r"
-gdb_expect {
-    -re ".. = 1\r\n$gdb_prompt " {
-        pass "check whether processor supports MPX"
-    }
-    -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"
+
+gdb_test_multiple "print have_mpx()" $test {
+    -re ".. = 1\r\n$gdb_prompt $" {
+        pass $test
+        set supports_mpx 1
     }
-    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\]+\\\}\\\}"
-- 
1.9.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]