[Lldb-commits] [PATCH] D32719: Don't attempt to use mpx registers on unsupported platforms
Francis Ricci via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon May 1 15:08:07 PDT 2017
fjricci created this revision.
The existing cpp-level checks using PR_MPX_ENABLE_MANAGEMENT aren't sufficient,
as this isn't defined for linux kernel versions below 3.19.
https://reviews.llvm.org/D32719
Files:
packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/TestMPXRegisters.py
packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/TestBoundViolation.py
Index: packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/TestBoundViolation.py
===================================================================
--- packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/TestBoundViolation.py
+++ packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/TestBoundViolation.py
@@ -19,13 +19,28 @@
mydir = TestBase.compute_mydir(__file__)
+ def hasMPX(self):
+ if lldb.remote_platform:
+ self.runCmd('platform get-file "/proc/cpuinfo" "cpuinfo"')
+ cpuinfo_path = "cpuinfo"
+ self.addTearDownHook(lambda: os.unlink("cpuinfo"))
+ else:
+ cpuinfo_path = "/proc/cpuinfo"
+
+ with open(cpuinfo_path, 'r') as f:
+ return " mpx " in f.read()
+
@skipIf(compiler="clang")
@skipIf(oslist=no_match(['linux']))
@skipIf(archs=no_match(['i386', 'x86_64']))
@skipIf(oslist=["linux"], compiler="gcc", compiler_version=["<", "5"]) #GCC version >= 5 supports Intel(R) MPX.
def test_mpx_boundary_violation(self):
"""Test Intel(R) MPX bound violation signal."""
self.build()
+
+ if !self.hasMPX():
+ return
+
self.mpx_boundary_violation()
def mpx_boundary_violation(self):
Index: packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/TestMPXRegisters.py
===================================================================
--- packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/TestMPXRegisters.py
+++ packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/TestMPXRegisters.py
@@ -22,13 +22,28 @@
def setUp(self):
TestBase.setUp(self)
+ def hasMPX(self):
+ if lldb.remote_platform:
+ self.runCmd('platform get-file "/proc/cpuinfo" "cpuinfo"')
+ cpuinfo_path = "cpuinfo"
+ self.addTearDownHook(lambda: os.unlink("cpuinfo"))
+ else:
+ cpuinfo_path = "/proc/cpuinfo"
+
+ with open(cpuinfo_path, 'r') as f:
+ return " mpx " in f.read()
+
@skipIf(compiler="clang")
@skipIf(oslist=no_match(['linux']))
@skipIf(archs=no_match(['i386', 'x86_64']))
@skipIf(oslist=["linux"], compiler="gcc", compiler_version=["<", "5"]) #GCC version >= 5 supports Intel(R) MPX.
def test_mpx_registers_with_example_code(self):
"""Test Intel(R) MPX registers with example code."""
self.build()
+
+ if !self.hasMPX():
+ return
+
self.mpx_registers_with_example_code()
def mpx_registers_with_example_code(self):
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32719.97345.patch
Type: text/x-patch
Size: 2750 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20170501/9f420e4b/attachment.bin>
More information about the lldb-commits
mailing list