@@ -23,22 +23,51 @@ def check_load_commands(self, expected_load_command):
2323 found += 1
2424 self .assertEquals (found , 1 , "wrong load command" )
2525
26-
27- def run_with (self , arch , os , env , expected_load_command ):
28- self .build (dictionary = {'TRIPLE' : arch + '-apple-' + os + '-' + env })
26+ def check_debugserver (self , log , expected_platform , expected_version ):
27+ """scan the debugserver packet log"""
28+ logfile = open (log , "r" )
29+ dylib_info = None
30+ response = False
31+ for line in logfile :
32+ if response :
33+ while line [0 ] != '$' :
34+ line = line [1 :]
35+ line = line [1 :]
36+ # Unescape '}'.
37+ dylib_info = json .loads (line .replace ('}]' ,'}' )[:- 4 ])
38+ response = False
39+ if 'send packet: $jGetLoadedDynamicLibrariesInfos:{' in line :
40+ response = True
41+
42+ self .assertTrue (dylib_info )
43+ aout_info = None
44+ for image in dylib_info ['images' ]:
45+ if image ['pathname' ].endswith ('a.out' ):
46+ aout_info = image
47+ self .assertTrue (aout_info )
48+ self .assertEquals (aout_info ['min_version_os_name' ], expected_platform )
49+ if expected_version :
50+ self .assertEquals (aout_info ['min_version_os_sdk' ], expected_version )
51+
52+
53+ def run_with (self , arch , os , vers , env , expected_load_command ):
54+ self .build (dictionary = {'TRIPLE' : arch + '-apple-' + os + vers + '-' + env })
55+ self .check_load_commands (expected_load_command )
56+ log = self .getBuildArtifact ('packets.log' )
57+ self .expect ("log enable gdb-remote packets -f " + log )
2958 lldbutil .run_to_source_breakpoint (self , "break here" ,
3059 lldb .SBFileSpec ("hello.c" ))
31- self .check_load_commands (expected_load_command )
3260 self .expect ('image list -b -t' ,
33- patterns = ['a\.out ' + arch + '-apple-' + os + '.*-' + env ])
61+ patterns = ['a\.out ' + arch + '-apple-' + os + vers + '.*-' + env ])
62+ self .check_debugserver (log , os + env , vers )
3463
3564 @skipUnlessDarwin
3665 @skipIfDarwinEmbedded
3766 @apple_simulator_test ('iphone' )
3867 def test_ios (self ):
3968 """Test running an iOS simulator binary"""
4069 self .run_with (arch = self .getArchitecture (),
41- os = 'ios' , env = 'simulator' ,
70+ os = 'ios' , vers = '' , env = 'simulator' ,
4271 expected_load_command = 'LC_BUILD_VERSION' )
4372
4473 @skipUnlessDarwin
@@ -47,7 +76,7 @@ def test_ios(self):
4776 def test_tvos (self ):
4877 """Test running an tvOS simulator binary"""
4978 self .run_with (arch = self .getArchitecture (),
50- os = 'tvos' , env = 'simulator' ,
79+ os = 'tvos' , vers = '' , env = 'simulator' ,
5180 expected_load_command = 'LC_BUILD_VERSION' )
5281
5382 @skipUnlessDarwin
@@ -58,7 +87,7 @@ def test_tvos(self):
5887 def test_watchos_i386 (self ):
5988 """Test running a 32-bit watchOS simulator binary"""
6089 self .run_with (arch = 'i386' ,
61- os = 'watchos' , env = 'simulator' ,
90+ os = 'watchos' , vers = '' , env = 'simulator' ,
6291 expected_load_command = 'LC_BUILD_VERSION' )
6392
6493 @skipUnlessDarwin
@@ -69,7 +98,7 @@ def test_watchos_i386(self):
6998 def test_watchos_armv7k (self ):
7099 """Test running a 32-bit watchOS simulator binary"""
71100 self .run_with (arch = 'armv7k' ,
72- os = 'watchos' , env = 'simulator' ,
101+ os = 'watchos' , vers = '' , env = 'simulator' ,
73102 expected_load_command = 'LC_BUILD_VERSION' )
74103
75104
@@ -90,17 +119,28 @@ def test_lc_version_min_iphoneos(self):
90119 """Test running a back-deploying iOS simulator binary
91120 with a legacy iOS load command"""
92121 self .run_with (arch = self .getArchitecture (),
93- os = 'ios11 .0' , env = 'simulator' ,
122+ os = 'ios' , vers = '11 .0' , env = 'simulator' ,
94123 expected_load_command = 'LC_VERSION_MIN_IPHONEOS' )
95124
125+ @skipUnlessDarwin
126+ @skipIfDarwinEmbedded
127+ @apple_simulator_test ('iphone' )
128+ @skipIf (archs = ['arm64' ,'arm64e' ])
129+ def test_ios_backdeploy_x86 (self ):
130+ """Test running a back-deploying iOS simulator binary
131+ with a legacy iOS load command"""
132+ self .run_with (arch = self .getArchitecture (),
133+ os = 'ios' , vers = '13.0' , env = 'simulator' ,
134+ expected_load_command = 'LC_BUILD_VERSION' )
135+
96136 @skipUnlessDarwin
97137 @skipIfDarwinEmbedded
98138 @apple_simulator_test ('iphone' )
99139 @skipIf (archs = ['i386' ,'x86_64' ])
100140 def test_ios_backdeploy_apple_silicon (self ):
101141 """Test running a back-deploying iOS simulator binary"""
102142 self .run_with (arch = self .getArchitecture (),
103- os = 'ios11 .0' , env = 'simulator' ,
143+ os = 'ios' , vers = '11 .0' , env = 'simulator' ,
104144 expected_load_command = 'LC_BUILD_VERSION' )
105145
106146 @skipUnlessDarwin
@@ -111,7 +151,7 @@ def test_lc_version_min_tvos(self):
111151 """Test running a back-deploying tvOS simulator binary
112152 with a legacy tvOS load command"""
113153 self .run_with (arch = self .getArchitecture (),
114- os = 'tvos11 .0' , env = 'simulator' ,
154+ os = 'tvos' , vers = '11 .0' , env = 'simulator' ,
115155 expected_load_command = 'LC_VERSION_MIN_TVOS' )
116156
117157 @skipUnlessDarwin
@@ -121,7 +161,7 @@ def test_lc_version_min_tvos(self):
121161 def test_tvos_backdeploy_apple_silicon (self ):
122162 """Test running a back-deploying tvOS simulator binary"""
123163 self .run_with (arch = self .getArchitecture (),
124- os = 'tvos11 .0' , env = 'simulator' ,
164+ os = 'tvos' , vers = '11 .0' , env = 'simulator' ,
125165 expected_load_command = 'LC_BUILD_VERSION' )
126166
127167 @skipUnlessDarwin
@@ -133,7 +173,7 @@ def test_lc_version_min_watchos(self):
133173 """Test running a back-deploying watchOS simulator binary
134174 with a legacy watchOS load command"""
135175 self .run_with (arch = 'i386' ,
136- os = 'watchos4 .0' , env = 'simulator' ,
176+ os = 'watchos' , vers = '4 .0' , env = 'simulator' ,
137177 expected_load_command = 'LC_VERSION_MIN_WATCHOS' )
138178
139179 @skipUnlessDarwin
@@ -144,5 +184,5 @@ def test_lc_version_min_watchos(self):
144184 def test_watchos_backdeploy_apple_silicon (self ):
145185 """Test running a back-deploying watchOS simulator binary"""
146186 self .run_with (arch = 'armv7k' ,
147- os = 'watchos4 .0' , env = 'simulator' ,
187+ os = 'watchos' , vers = '4 .0' , env = 'simulator' ,
148188 expected_load_command = 'LC_BUILD_VERSION' )
0 commit comments