1import lldb 2from lldbsuite.test.lldbtest import * 3from lldbsuite.test.decorators import * 4import lldbsuite.test.lldbutil as lldbutil 5import os 6import unittest2 7 8 9class TestMacCatalystAppWithMacOSFramework(TestBase): 10 11 @skipIf(macos_version=["<", "10.15"]) 12 @skipUnlessDarwin 13 @skipIfDarwinEmbedded 14 # There is a Clang driver change missing on llvm.org. 15 @expectedFailureAll(bugnumber="rdar://problem/54986190>") 16 def test(self): 17 """Test the x86_64-apple-ios-macabi target linked against a macos dylib""" 18 self.build() 19 log = self.getBuildArtifact('packets.log') 20 self.expect("log enable gdb-remote packets -f "+log) 21 lldbutil.run_to_source_breakpoint(self, "break here", 22 lldb.SBFileSpec('main.c')) 23 arch = self.getArchitecture() 24 self.expect("image list -t -b", 25 patterns=[arch + r'.*-apple-ios.*-macabi a\.out', 26 arch + r'.*-apple-macosx.* libfoo.dylib[^(]']) 27 self.expect("fr v s", "Hello macCatalyst") 28 self.expect("p s", "Hello macCatalyst") 29 self.check_debugserver(log) 30 31 def check_debugserver(self, log): 32 """scan the debugserver packet log""" 33 process_info = lldbutil.packetlog_get_process_info(log) 34 self.assertIn('ostype', process_info) 35 self.assertEquals(process_info['ostype'], 'maccatalyst') 36 37 aout_info = None 38 libfoo_info = None 39 dylib_info = lldbutil.packetlog_get_dylib_info(log) 40 for image in dylib_info['images']: 41 if image['pathname'].endswith('a.out'): 42 aout_info = image 43 if image['pathname'].endswith('libfoo.dylib'): 44 libfoo_info = image 45 self.assertTrue(aout_info) 46 self.assertTrue(libfoo_info) 47 self.assertEquals(aout_info['min_version_os_name'], 'maccatalyst') 48 self.assertEquals(libfoo_info['min_version_os_name'], 'macosx') 49