summaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/lldbtest.py
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2016-02-13 15:01:33 +0000
committerDimitry Andric <dim@FreeBSD.org>2016-02-13 15:01:33 +0000
commit2fc5d2d1dfaf623ce4e24cd8590565902f8c557c (patch)
tree525149683974afa86747b749d45f0425749e972e /packages/Python/lldbsuite/test/lldbtest.py
parente195173fdf080138dbb42936dea88c605e4b9a56 (diff)
Notes
Diffstat (limited to 'packages/Python/lldbsuite/test/lldbtest.py')
-rw-r--r--packages/Python/lldbsuite/test/lldbtest.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/packages/Python/lldbsuite/test/lldbtest.py b/packages/Python/lldbsuite/test/lldbtest.py
index 3ad6d29a1d7ac..de8f57f63706a 100644
--- a/packages/Python/lldbsuite/test/lldbtest.py
+++ b/packages/Python/lldbsuite/test/lldbtest.py
@@ -633,6 +633,14 @@ def check_list_or_lambda(list_or_lambda, value):
else:
return list_or_lambda is None or value is None or list_or_lambda == value
+def matchArchitectures(archs, actual_arch):
+ retype = type(re.compile('hello, world'))
+ list_passes = isinstance(archs, list) and actual_arch in archs
+ basestring_passes = isinstance(archs, six.string_types) and actual_arch == archs
+ regex_passes = isinstance(archs, retype) and re.match(archs, actual_arch)
+
+ return (list_passes or basestring_passes or regex_passes)
+
# provide a function to xfail on defined oslist, compiler version, and archs
# if none is specified for any argument, that argument won't be checked and thus means for all
# for example,
@@ -1026,7 +1034,7 @@ def skipUnlessHostPlatform(oslist):
return unittest2.skipUnless(getHostPlatform() in oslist,
"requires on of %s" % (", ".join(oslist)))
-def skipUnlessArch(archlist):
+def skipUnlessArch(archs):
"""Decorate the item to skip tests unless running on one of the listed architectures."""
def myImpl(func):
if isinstance(func, type) and issubclass(func, unittest2.TestCase):
@@ -1035,9 +1043,8 @@ def skipUnlessArch(archlist):
@wraps(func)
def wrapper(*args, **kwargs):
self = args[0]
- if self.getArchitecture() not in archlist:
- self.skipTest("skipping for architecture %s (requires one of %s)" %
- (self.getArchitecture(), ", ".join(archlist)))
+ if not matchArchitectures(archs, self.getArchitecture()):
+ self.skipTest("skipping for architecture %s" % (self.getArchitecture()))
else:
func(*args, **kwargs)
return wrapper