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 mydir = TestBase.compute_mydir(__file__) 12 13 @skipIf(macos_version=["<", "10.15"]) 14 @skipUnlessDarwin 15 @skipIfDarwinEmbedded 16 def test_macabi(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 self.expect("image list -t -b", 24 patterns=[self.getArchitecture() + 25 r'.*-apple-ios.*-macabi a\.out']) 26 self.expect("fr v s", substrs=["Hello macCatalyst"]) 27 self.expect("p s", substrs=["Hello macCatalyst"]) 28 self.check_debugserver(log) 29 30 def check_debugserver(self, log): 31 """scan the debugserver packet log""" 32 process_info = lldbutil.packetlog_get_process_info(log) 33 self.assertIn('ostype', process_info) 34 self.assertEquals(process_info['ostype'], 'maccatalyst') 35 36 aout_info = None 37 dylib_info = lldbutil.packetlog_get_dylib_info(log) 38 for image in dylib_info['images']: 39 if image['pathname'].endswith('a.out'): 40 aout_info = image 41 self.assertTrue(aout_info) 42 self.assertEquals(aout_info['min_version_os_name'], 'maccatalyst') 43