Author: friss Date: Wed Oct 9 16:52:31 2019 New Revision: 374262 URL: http://llvm.org/viewvc/llvm-project?rev=374262&view=rev Log: 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. Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/main.m lldb/trunk/packages/Python/lldbsuite/test/lldbplatformutil.py Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py?rev=374262&r1=374261&r2=374262&view=diff ============================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py Wed Oct 9 16:52:31 2019 @@ -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") Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/main.m URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/main.m?rev=374262&r1=374261&r2=374262&view=diff ============================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/main.m (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/main.m Wed Oct 9 16:52:31 2019 @@ -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:^{ Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbplatformutil.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbplatformutil.py?rev=374262&r1=374261&r2=374262&view=diff ============================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lldbplatformutil.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/lldbplatformutil.py Wed Oct 9 16:52:31 2019 @@ -17,6 +17,7 @@ from six.moves.urllib import parse as ur # 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 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits