Index: packages/Python/lldbsuite/test/decorators.py =================================================================== --- packages/Python/lldbsuite/test/decorators.py +++ packages/Python/lldbsuite/test/decorators.py @@ -4,6 +4,7 @@ # System modules from distutils.version import LooseVersion, StrictVersion from functools import wraps +import itertools import os import re import sys @@ -138,8 +139,8 @@ swig_version=None, py_version=None, remote=None): def fn(self): - skip_for_os = _match_decorator_property(oslist, self.getPlatform()) - skip_for_hostos = _match_decorator_property(hostoslist, lldbplatformutil.getHostPlatform()) + skip_for_os = _match_decorator_property(lldbplatformutil.target.translate(oslist), self.getPlatform()) + skip_for_hostos = _match_decorator_property(lldbplatformutil.host.translate(hostoslist), lldbplatformutil.getHostPlatform()) skip_for_compiler = _match_decorator_property(compiler, self.getCompiler()) and self.expectedCompilerVersion(compiler_version) skip_for_arch = _match_decorator_property(archs, self.getArchitecture()) skip_for_debug_info = _match_decorator_property(debug_info, self.debug_info) @@ -296,10 +297,10 @@ def expectedFailureDarwin(bugnumber=None, compilers=None, debug_info=None): # For legacy reasons, we support both "darwin" and "macosx" as OS X triples. - return expectedFailureOS(lldbplatformutil.getDarwinOSTriples(), bugnumber, compilers, debug_info=debug_info) + return expectedFailureOS(lldbplatformutil.target.darwin_all, bugnumber, compilers, debug_info=debug_info) def expectedFailureFreeBSD(bugnumber=None, compilers=None, debug_info=None): - return expectedFailureOS(['freebsd'], bugnumber, compilers, debug_info=debug_info) + return expectedFailureOS(lldbplatformutil.target.freebsd, bugnumber, compilers, debug_info=debug_info) def expectedFailureAndroid(bugnumber=None, api_levels=None, archs=None): """ Mark a test as xfail for Android. @@ -426,7 +427,7 @@ def skipIfDarwin(func): """Decorate the item to skip tests that should be skipped on Darwin.""" - return skipIfPlatform(lldbplatformutil.getDarwinOSTriples())(func) + return skipIfPlatform(lldbplatformutil.target.translate(lldbplatformutil.target.darwin_all))(func) def skipIfLinux(func): """Decorate the item to skip tests that should be skipped on Linux.""" Index: packages/Python/lldbsuite/test/functionalities/asan/TestMemoryHistory.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/asan/TestMemoryHistory.py +++ packages/Python/lldbsuite/test/functionalities/asan/TestMemoryHistory.py @@ -11,6 +11,7 @@ from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil +from lldbsuite.test.lldbplatformutil import target class AsanTestCase(TestBase): @@ -20,7 +21,7 @@ @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default @skipIfRemote @skipUnlessCompilerRt - @expectedFailureDarwin + @expectedFailureAll(oslist=target.darwin_all) def test (self): self.build () self.asan_tests () Index: packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py +++ packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py @@ -11,6 +11,7 @@ from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil +from lldbsuite.test.lldbplatformutil import target class CommandLineCompletionTestCase(TestBase): @@ -256,7 +257,7 @@ self.complete_from_to('target va', 'target variable ') @expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679") - @expectedFailureDarwin("llvm.org/pr25485") + @expectedFailureAll(oslist=target.darwin_all, bugnumber="llvm.org/pr25485") def test_symbol_name(self): self.build() self.complete_from_to('''file a.out Index: packages/Python/lldbsuite/test/lldbplatformutil.py =================================================================== --- packages/Python/lldbsuite/test/lldbplatformutil.py +++ packages/Python/lldbsuite/test/lldbplatformutil.py @@ -4,11 +4,13 @@ from __future__ import absolute_import # System modules +import itertools import re import subprocess import sys # Third-party modules +import six from six.moves.urllib import parse as urlparse # LLDB modules @@ -16,6 +18,53 @@ import use_lldb_suite import lldb +def _translate_platform_list(platforms, names): + if isinstance(platforms, six.integer_types): + # This is a value from lldbplatformutil.target, translate it. + return names[platforms] + elif isinstance(platforms, six.string_types): + # This is a raw string, return it. + return [platforms] + elif hasattr(platforms, "__iter__"): + # This is an iterable, convert each item. + result = [_translate_platform_list(x, names) for x in platforms] + result = list(itertools.chain(*result)) + return result + return platforms + +class target: + windows, linux, macosx, darwin, ios, darwin_all, freebsd, netbsd, bsd_all, android = range(10) + + @staticmethod + def translate(values): + platform_names = { + target.windows : ["windows"], + target.linux : ["linux"], + target.macosx : ["macosx"], + target.darwin : ["darwin"], + target.ios : ["ios"], + target.darwin_all : ["macosx", "darwin", "ios"], + target.freebsd : ["freebsd"], + target.netbsd : ["netbsd"], + target.bsd_all : ["freebsd", "netbsd"], + target.android : ["android"] + } + return _translate_platform_list(values, platform_names) + +class host: + windows, linux, darwin, freebsd, netbsd = range(5) + + @staticmethod + def translate(values): + platform_names = { + target.windows : ["windows"], + target.linux : ["linux"], + target.darwin : ["darwin"], + target.freebsd : ["freebsd"], + target.netbsd : ["netbsd"] + } + return _translate_platform_list(values, platform_names) + def check_first_register_readable(test_case): arch = test_case.getArchitecture()