diff options
| author | Robert Flack <flackr@gmail.com> | 2015-05-15 12:39:33 +0000 |
|---|---|---|
| committer | Robert Flack <flackr@gmail.com> | 2015-05-15 12:39:33 +0000 |
| commit | 6e1fd35bfe8618b2eedacfff632dc631fa80da1c (patch) | |
| tree | 934b86efcbdbdddc4d95396d24bd471583542d27 | |
| parent | 3ac979c4da2d240ad8e108d9bf2d435a23425316 (diff) | |
| download | bcm5719-llvm-6e1fd35bfe8618b2eedacfff632dc631fa80da1c.tar.gz bcm5719-llvm-6e1fd35bfe8618b2eedacfff632dc631fa80da1c.zip | |
Skip TestPluginCommands.py if host lldb library is incompatible with remote.
TestPluginCommands.py attempts to build a library which links against the host
built lldb library. This will only work if the remote is compatible with
binaries produced by the host.
Test Plan:
./dotest.py $DOTEST_OPTS -v -t -p TestPluginCommands.py
Test is skipped if remote platform is incompatible with host platform (i.e. mac
-> linux).
Differential Revision: http://reviews.llvm.org/D9770
llvm-svn: 237444
| -rw-r--r-- | lldb/test/functionalities/plugins/commands/TestPluginCommands.py | 2 | ||||
| -rw-r--r-- | lldb/test/lldbtest.py | 36 |
2 files changed, 36 insertions, 2 deletions
diff --git a/lldb/test/functionalities/plugins/commands/TestPluginCommands.py b/lldb/test/functionalities/plugins/commands/TestPluginCommands.py index 9b63ead8134..7f796b84e36 100644 --- a/lldb/test/functionalities/plugins/commands/TestPluginCommands.py +++ b/lldb/test/functionalities/plugins/commands/TestPluginCommands.py @@ -20,8 +20,8 @@ class PluginCommandTestCase(TestBase): self.implib_dir = os.environ["LLDB_IMPLIB_DIR"] @expectedFailureFreeBSD('llvm.org/pr17430') - @skipIfi386 # This test links against liblldb.so. Thus, the test requires a 32-bit liblldb.so. @skipIfNoSBHeaders + @skipIfHostIncompatibleWithRemote # Requires a compatible arch and platform to link against the host's built lldb lib. def test_load_plugin(self): """Test that plugins that load commands work correctly.""" diff --git a/lldb/test/lldbtest.py b/lldb/test/lldbtest.py index 6887ec5d932..a9f4d667723 100644 --- a/lldb/test/lldbtest.py +++ b/lldb/test/lldbtest.py @@ -717,16 +717,50 @@ def skipUnlessDarwin(func): return skipUnlessPlatform(getDarwinOSTriples())(func) def getPlatform(): - """Returns the target platform the test suite is running on.""" + """Returns the target platform which the tests are running on.""" platform = lldb.DBG.GetSelectedPlatform().GetTriple().split('-')[2] if platform.startswith('freebsd'): platform = 'freebsd' return platform +def getHostPlatform(): + """Returns the host platform running the test suite.""" + # Attempts to return a platform name matching a target Triple platform. + if sys.platform.startswith('linux'): + return 'linux' + elif sys.platform.startswith('win32'): + return 'windows' + elif sys.platform.startswith('darwin'): + return 'darwin' + elif sys.platform.startswith('freebsd'): + return 'freebsd' + else: + return sys.platform + def platformIsDarwin(): """Returns true if the OS triple for the selected platform is any valid apple OS""" return getPlatform() in getDarwinOSTriples() +def skipIfHostIncompatibleWithRemote(func): + """Decorate the item to skip tests if binaries built on this host are incompatible.""" + if isinstance(func, type) and issubclass(func, unittest2.TestCase): + raise Exception("@skipIfHostIncompatibleWithRemote can only be used to decorate a test method") + @wraps(func) + def wrapper(*args, **kwargs): + from unittest2 import case + self = args[0] + host_arch = self.getLldbArchitecture() + host_platform = getHostPlatform() + target_arch = self.getArchitecture() + target_platform = 'darwin' if self.getPlatform() in getDarwinOSTriples() else self.getPlatform() + if not (target_arch == 'x86_64' and host_arch == 'i386') and host_arch != target_arch: + self.skipTest("skipping because target %s is not compatible with host architecture %s" % (target_arch, host_arch)) + elif target_platform != host_platform: + self.skipTest("skipping because target is %s but host is %s" % (target_platform, host_platform)) + else: + func(*args, **kwargs) + return wrapper + def skipIfPlatform(oslist): """Decorate the item to skip tests if running on one of the listed platforms.""" return unittest2.skipIf(getPlatform() in oslist, |

