@@ -34,7 +34,7 @@ class ResilienceTest(object):
34
34
def __init__ (self , target_build_swift , target_run , target_codesign ,
35
35
target_nm , tmp_dir , test_dir , test_src , lib_prefix ,
36
36
lib_suffix , additional_compile_flags ,
37
- no_backward_deployment , no_symbol_diff ):
37
+ backward_deployment , no_symbol_diff ):
38
38
self .target_build_swift = shlex .split (target_build_swift )
39
39
self .target_run = shlex .split (target_run )
40
40
self .target_codesign = shlex .split (target_codesign )
@@ -55,7 +55,7 @@ class ResilienceTest(object):
55
55
self .lib_name = self .lib_src_name [:- 6 ]
56
56
self .lib_src = os .path .join (self .test_dir , 'Inputs' , self .lib_src_name )
57
57
58
- self .no_backward_deployment = no_backward_deployment
58
+ self .backward_deployment = backward_deployment
59
59
self .no_symbol_diff = no_symbol_diff
60
60
61
61
def run (self ):
@@ -138,6 +138,12 @@ class ResilienceTest(object):
138
138
139
139
def compile_main (self ):
140
140
for config in self .config_dir_map :
141
+ # If we're testing backward deployment, we only want to build
142
+ # the app against the new version of the library.
143
+ if self .backward_deployment and \
144
+ config == "BEFORE" :
145
+ continue
146
+
141
147
output_obj = os .path .join (self .config_dir_map [config ], 'main.o' )
142
148
compiler_flags = ['-D' , config , '-c' , self .test_src ,
143
149
'-Xfrontend' , '-enable-class-resilience' ,
@@ -153,11 +159,8 @@ class ResilienceTest(object):
153
159
def configs (self ):
154
160
for config1 in self .config_dir_map :
155
161
for config2 in self .config_dir_map :
156
- # --no-backward-deployment skips testing a new application
157
- # linked against an old library.
158
- if config1 == "BEFORE" and \
159
- config2 == "AFTER" and \
160
- self .no_backward_deployment :
162
+ if self .backward_deployment and \
163
+ config2 == "BEFORE" :
161
164
continue
162
165
163
166
yield (config1 , config2 )
@@ -185,6 +188,9 @@ class ResilienceTest(object):
185
188
'-o' , output_obj
186
189
]
187
190
191
+ if self .is_apple_platform ():
192
+ compiler_flags += ['-Xlinker' , '-bind_at_load' ]
193
+
188
194
command = self .target_build_swift + compiler_flags
189
195
verbose_print_command (command )
190
196
returncode = subprocess .call (command )
@@ -221,7 +227,7 @@ def main():
221
227
parser .add_argument ('--lib-prefix' , required = True )
222
228
parser .add_argument ('--lib-suffix' , required = True )
223
229
parser .add_argument ('--additional-compile-flags' , default = '' )
224
- parser .add_argument ('--no- backward-deployment' , default = False ,
230
+ parser .add_argument ('--backward-deployment' , default = False ,
225
231
action = 'store_true' )
226
232
parser .add_argument ('--no-symbol-diff' , default = False ,
227
233
action = 'store_true' )
@@ -233,7 +239,7 @@ def main():
233
239
args .t , args .S , args .s , args .lib_prefix ,
234
240
args .lib_suffix ,
235
241
args .additional_compile_flags ,
236
- args .no_backward_deployment ,
242
+ args .backward_deployment ,
237
243
args .no_symbol_diff )
238
244
239
245
return resilience_test .run ()
0 commit comments