Added a decorator for the macOS version and switched over testcases that used platform.release

llvm-svn: 284674
This commit is contained in:
Sean Callanan 2016-10-20 00:03:39 +00:00
parent 6f42740707
commit 7ef7b449a0
7 changed files with 17 additions and 13 deletions

View File

@ -157,6 +157,7 @@ def _decorateTest(mode,
archs=None, triple=None,
debug_info=None,
swig_version=None, py_version=None,
macos_version=None,
remote=None):
def fn(self):
skip_for_os = _match_decorator_property(
@ -187,6 +188,11 @@ def _decorateTest(mode,
skip_for_py_version = (
py_version is None) or _check_expected_version(
py_version[0], py_version[1], sys.version_info)
skip_for_macos_version = (macos_version is None) or (
_check_expected_version(
macos_version[0],
macos_version[1],
platform.mac_ver()[0]))
# For the test to be skipped, all specified (e.g. not None) parameters must be True.
# An unspecified parameter means "any", so those are marked skip by default. And we skip
@ -199,6 +205,7 @@ def _decorateTest(mode,
(triple, skip_for_triple, "target triple"),
(swig_version, skip_for_swig_version, "swig version"),
(py_version, skip_for_py_version, "python version"),
(macos_version, skip_for_macos_version, "macOS version"),
(remote, skip_for_remote, "platform locality (remote/local)")]
reasons = []
final_skip_result = True
@ -242,6 +249,7 @@ def expectedFailureAll(bugnumber=None,
archs=None, triple=None,
debug_info=None,
swig_version=None, py_version=None,
macos_version=None,
remote=None):
return _decorateTest(DecorateMode.Xfail,
bugnumber=bugnumber,
@ -250,6 +258,7 @@ def expectedFailureAll(bugnumber=None,
archs=archs, triple=triple,
debug_info=debug_info,
swig_version=swig_version, py_version=py_version,
macos_version=None,
remote=remote)
@ -265,6 +274,7 @@ def skipIf(bugnumber=None,
archs=None, triple=None,
debug_info=None,
swig_version=None, py_version=None,
macos_version=None,
remote=None):
return _decorateTest(DecorateMode.Skip,
bugnumber=bugnumber,
@ -273,6 +283,7 @@ def skipIf(bugnumber=None,
archs=archs, triple=triple,
debug_info=debug_info,
swig_version=swig_version, py_version=py_version,
macos_version=macos_version,
remote=remote)

View File

@ -25,10 +25,8 @@ class CModulesTestCase(TestBase):
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24489: Name lookup not working correctly on Windows")
@skipIf(macos_version=["<", "10.12"])
def test_expr(self):
if platform.system() == "Darwin" and platform.release() < StrictVersion('12.0.0'):
self.skipTest()
self.build()
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)

View File

@ -26,8 +26,7 @@ class ObjCModulesAutoImportTestCase(TestBase):
self.line = line_number('main.m', '// Set breakpoint 0 here.')
@skipUnlessDarwin
@unittest2.skipIf(platform.system() != "Darwin" or StrictVersion(
'12.0.0') > platform.release(), "Only supported on Darwin 12.0.0+")
@skipIf(macos_version=["<", "10.12"])
def test_expr(self):
self.build()
exe = os.path.join(os.getcwd(), "a.out")

View File

@ -24,8 +24,7 @@ class IncompleteModulesTestCase(TestBase):
@skipUnlessDarwin
@unittest2.expectedFailure("rdar://20416388")
@unittest2.skipIf(platform.system() != "Darwin" or StrictVersion(
'12.0.0') > platform.release(), "Only supported on Darwin 12.0.0+")
@skipIf(macos_version=["<", "10.12"])
def test_expr(self):
self.build()
exe = os.path.join(os.getcwd(), "a.out")

View File

@ -27,8 +27,7 @@ class ModulesInlineFunctionsTestCase(TestBase):
self.line = line_number('main.m', '// Set breakpoint here.')
@skipUnlessDarwin
@unittest2.skipIf(platform.system() != "Darwin" or StrictVersion(
'12.0.0') > platform.release(), "Only supported on Darwin 12.0.0+")
@skipIf(macos_version=["<", "10.12"])
@expectedFailureDarwin("llvm.org/pr25743")
def test_expr(self):
self.build()

View File

@ -27,8 +27,7 @@ class ObjCModulesTestCase(TestBase):
@skipUnlessDarwin
@unittest2.expectedFailure("rdar://20416388")
@unittest2.skipIf(platform.system() != "Darwin" or StrictVersion(
'12.0.0') > platform.release(), "Only supported on Darwin 12.0.0+")
@skipIf(macos_version=["<", "10.12"])
def test_expr(self):
if not self.applies():
return

View File

@ -37,8 +37,7 @@ class ObjCNewSyntaxTestCase(TestBase):
oslist=['macosx'],
debug_info=['gmodules'],
bugnumber='rdar://27792848')
@unittest2.skipIf(platform.system() != "Darwin" or StrictVersion(
'12.0.0') > platform.release(), "Only supported on Darwin 12.0.0+")
@skipIf(macos_version=["<", "10.12"])
@expectedFailureAll(archs=["i[3-6]86"])
def test_expr(self):
self.build()