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 TestMacCatalyst(TestBase): 10 11 @skipIf(macos_version=["<", "10.15"]) 12 @skipUnlessDarwin 13 @skipIfDarwinEmbedded 14 def test_macabi(self): 15 """Test the x86_64-apple-ios-macabi target linked against a macos dylib""" 16 self.build() 17 log = self.getBuildArtifact('packets.log') 18 self.expect("log enable gdb-remote packets -f "+log) 19 lldbutil.run_to_source_breakpoint(self, "break here", 20 lldb.SBFileSpec('main.c')) 21 self.expect("image list -t -b", 22 patterns=[self.getArchitecture() + 23 r'.*-apple-ios.*-macabi a\.out']) 24 self.expect("fr v s", substrs=["Hello macCatalyst"]) 25 self.expect("p s", substrs=["Hello macCatalyst"]) 26 self.check_debugserver(log) 27 28 def check_debugserver(self, log): 29 """scan the debugserver packet log""" 30 process_info = lldbutil.packetlog_get_process_info(log) 31 self.assertIn('ostype', process_info) 32 self.assertEquals(process_info['ostype'], 'maccatalyst') 33 34 aout_info = None 35 dylib_info = lldbutil.packetlog_get_dylib_info(log) 36 for image in dylib_info['images']: 37 if image['pathname'].endswith('a.out'): 38 aout_info = image 39 self.assertTrue(aout_info) 40 self.assertEquals(aout_info['min_version_os_name'], 'maccatalyst') 41