@@ -23,22 +23,51 @@ def check_load_commands(self, expected_load_command):
23
23
found += 1
24
24
self .assertEquals (found , 1 , "wrong load command" )
25
25
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 )
29
58
lldbutil .run_to_source_breakpoint (self , "break here" ,
30
59
lldb .SBFileSpec ("hello.c" ))
31
- self .check_load_commands (expected_load_command )
32
60
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 )
34
63
35
64
@skipUnlessDarwin
36
65
@skipIfDarwinEmbedded
37
66
@apple_simulator_test ('iphone' )
38
67
def test_ios (self ):
39
68
"""Test running an iOS simulator binary"""
40
69
self .run_with (arch = self .getArchitecture (),
41
- os = 'ios' , env = 'simulator' ,
70
+ os = 'ios' , vers = '' , env = 'simulator' ,
42
71
expected_load_command = 'LC_BUILD_VERSION' )
43
72
44
73
@skipUnlessDarwin
@@ -47,7 +76,7 @@ def test_ios(self):
47
76
def test_tvos (self ):
48
77
"""Test running an tvOS simulator binary"""
49
78
self .run_with (arch = self .getArchitecture (),
50
- os = 'tvos' , env = 'simulator' ,
79
+ os = 'tvos' , vers = '' , env = 'simulator' ,
51
80
expected_load_command = 'LC_BUILD_VERSION' )
52
81
53
82
@skipUnlessDarwin
@@ -58,7 +87,7 @@ def test_tvos(self):
58
87
def test_watchos_i386 (self ):
59
88
"""Test running a 32-bit watchOS simulator binary"""
60
89
self .run_with (arch = 'i386' ,
61
- os = 'watchos' , env = 'simulator' ,
90
+ os = 'watchos' , vers = '' , env = 'simulator' ,
62
91
expected_load_command = 'LC_BUILD_VERSION' )
63
92
64
93
@skipUnlessDarwin
@@ -69,7 +98,7 @@ def test_watchos_i386(self):
69
98
def test_watchos_armv7k (self ):
70
99
"""Test running a 32-bit watchOS simulator binary"""
71
100
self .run_with (arch = 'armv7k' ,
72
- os = 'watchos' , env = 'simulator' ,
101
+ os = 'watchos' , vers = '' , env = 'simulator' ,
73
102
expected_load_command = 'LC_BUILD_VERSION' )
74
103
75
104
@@ -90,17 +119,28 @@ def test_lc_version_min_iphoneos(self):
90
119
"""Test running a back-deploying iOS simulator binary
91
120
with a legacy iOS load command"""
92
121
self .run_with (arch = self .getArchitecture (),
93
- os = 'ios11 .0' , env = 'simulator' ,
122
+ os = 'ios' , vers = '11 .0' , env = 'simulator' ,
94
123
expected_load_command = 'LC_VERSION_MIN_IPHONEOS' )
95
124
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
+
96
136
@skipUnlessDarwin
97
137
@skipIfDarwinEmbedded
98
138
@apple_simulator_test ('iphone' )
99
139
@skipIf (archs = ['i386' ,'x86_64' ])
100
140
def test_ios_backdeploy_apple_silicon (self ):
101
141
"""Test running a back-deploying iOS simulator binary"""
102
142
self .run_with (arch = self .getArchitecture (),
103
- os = 'ios11 .0' , env = 'simulator' ,
143
+ os = 'ios' , vers = '11 .0' , env = 'simulator' ,
104
144
expected_load_command = 'LC_BUILD_VERSION' )
105
145
106
146
@skipUnlessDarwin
@@ -111,7 +151,7 @@ def test_lc_version_min_tvos(self):
111
151
"""Test running a back-deploying tvOS simulator binary
112
152
with a legacy tvOS load command"""
113
153
self .run_with (arch = self .getArchitecture (),
114
- os = 'tvos11 .0' , env = 'simulator' ,
154
+ os = 'tvos' , vers = '11 .0' , env = 'simulator' ,
115
155
expected_load_command = 'LC_VERSION_MIN_TVOS' )
116
156
117
157
@skipUnlessDarwin
@@ -121,7 +161,7 @@ def test_lc_version_min_tvos(self):
121
161
def test_tvos_backdeploy_apple_silicon (self ):
122
162
"""Test running a back-deploying tvOS simulator binary"""
123
163
self .run_with (arch = self .getArchitecture (),
124
- os = 'tvos11 .0' , env = 'simulator' ,
164
+ os = 'tvos' , vers = '11 .0' , env = 'simulator' ,
125
165
expected_load_command = 'LC_BUILD_VERSION' )
126
166
127
167
@skipUnlessDarwin
@@ -133,7 +173,7 @@ def test_lc_version_min_watchos(self):
133
173
"""Test running a back-deploying watchOS simulator binary
134
174
with a legacy watchOS load command"""
135
175
self .run_with (arch = 'i386' ,
136
- os = 'watchos4 .0' , env = 'simulator' ,
176
+ os = 'watchos' , vers = '4 .0' , env = 'simulator' ,
137
177
expected_load_command = 'LC_VERSION_MIN_WATCHOS' )
138
178
139
179
@skipUnlessDarwin
@@ -144,5 +184,5 @@ def test_lc_version_min_watchos(self):
144
184
def test_watchos_backdeploy_apple_silicon (self ):
145
185
"""Test running a back-deploying watchOS simulator binary"""
146
186
self .run_with (arch = 'armv7k' ,
147
- os = 'watchos4 .0' , env = 'simulator' ,
187
+ os = 'watchos' , vers = '4 .0' , env = 'simulator' ,
148
188
expected_load_command = 'LC_BUILD_VERSION' )
0 commit comments