summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite
diff options
context:
space:
mode:
authorFrederic Riss <friss@apple.com>2019-10-09 23:52:31 +0000
committerFrederic Riss <friss@apple.com>2019-10-09 23:52:31 +0000
commit80b080723ff7f8a0097d76a322b241514a7f3864 (patch)
treee1ba1a2f1665cdc0d28c4fe77f77de8d7863a452 /lldb/packages/Python/lldbsuite
parent931120846e5f9c5ff9a70ee8a2fa4dfdd468f753 (diff)
downloadbcm5719-llvm-80b080723ff7f8a0097d76a322b241514a7f3864.tar.gz
bcm5719-llvm-80b080723ff7f8a0097d76a322b241514a7f3864.zip
TestMTCSimple.py: allow the test to run on Darwin embedded platforms
The test needed some updates to run using a different UI toolkit and with a different libMTC, but it should run fine on a device. llvm-svn: 374262
Diffstat (limited to 'lldb/packages/Python/lldbsuite')
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py21
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/mtc/simple/main.m8
-rw-r--r--lldb/packages/Python/lldbsuite/test/lldbplatformutil.py4
3 files changed, 20 insertions, 13 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py b/lldb/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py
index 0b4c0d1e0fa..e530c47d2d3 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py
@@ -15,19 +15,12 @@ class MTCSimpleTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipUnlessDarwin
- @skipIfDarwinEmbedded # Test file depends on AppKit which is not present on iOS etc.
def test(self):
self.mtc_dylib_path = findMainThreadCheckerDylib()
- if self.mtc_dylib_path == "":
- self.skipTest("This test requires libMainThreadChecker.dylib.")
-
+ self.assertTrue(self.mtc_dylib_path != "")
self.build()
self.mtc_tests()
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
-
@skipIf(archs=['i386'])
def mtc_tests(self):
# Load the test
@@ -41,7 +34,11 @@ class MTCSimpleTestCase(TestBase):
thread = process.GetSelectedThread()
frame = thread.GetSelectedFrame()
- self.expect("thread info", substrs=['stop reason = -[NSView superview] must be used from main thread only'])
+ view = "NSView" if lldbplatformutil.getPlatform() == "macosx" else "UIView"
+
+ self.expect("thread info",
+ substrs=['stop reason = -[' + view +
+ ' superview] must be used from main thread only'])
self.expect(
"thread info -s",
@@ -51,7 +48,7 @@ class MTCSimpleTestCase(TestBase):
json_line = '\n'.join(output_lines[2:])
data = json.loads(json_line)
self.assertEqual(data["instrumentation_class"], "MainThreadChecker")
- self.assertEqual(data["api_name"], "-[NSView superview]")
- self.assertEqual(data["class_name"], "NSView")
+ self.assertEqual(data["api_name"], "-[" + view + " superview]")
+ self.assertEqual(data["class_name"], view)
self.assertEqual(data["selector"], "superview")
- self.assertEqual(data["description"], "-[NSView superview] must be used from main thread only")
+ self.assertEqual(data["description"], "-[" + view + " superview] must be used from main thread only")
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/mtc/simple/main.m b/lldb/packages/Python/lldbsuite/test/functionalities/mtc/simple/main.m
index 651347cf74e..a967dee4692 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/mtc/simple/main.m
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/mtc/simple/main.m
@@ -1,8 +1,14 @@
#import <Foundation/Foundation.h>
+#if __has_include(<AppKit/AppKit.h>)
#import <AppKit/AppKit.h>
+#define XXView NSView
+#else
+#import <UIKit/UIKit.h>
+#define XXView UIView
+#endif
int main() {
- NSView *view = [[NSView alloc] init];
+ XXView *view = [[XXView alloc] init];
dispatch_group_t g = dispatch_group_create();
dispatch_group_enter(g);
[NSThread detachNewThreadWithBlock:^{
diff --git a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
index 6e382d28c1e..56b9febbd72 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
@@ -17,6 +17,7 @@ from six.moves.urllib import parse as urlparse
# LLDB modules
from . import configuration
import lldb
+import lldbsuite.test.lldbplatform as lldbplatform
def check_first_register_readable(test_case):
@@ -145,6 +146,9 @@ def findMainThreadCheckerDylib():
if not platformIsDarwin():
return ""
+ if getPlatform() in lldbplatform.translate(lldbplatform.darwin_embedded):
+ return "/Developer/usr/lib/libMainThreadChecker.dylib"
+
with os.popen('xcode-select -p') as output:
xcode_developer_path = output.read().strip()
mtc_dylib_path = '%s/usr/lib/libMainThreadChecker.dylib' % xcode_developer_path
OpenPOWER on IntegriCloud