forked from OSchip/llvm-project
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
This commit is contained in:
parent
931120846e
commit
80b080723f
|
@ -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")
|
||||
|
|
|
@ -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:^{
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue