@@ -250,6 +250,32 @@ def gen_target(output_target_name, test_configs):
250
250
add_footer (f )
251
251
252
252
253
+ def gen_target_shlib (output_target_name , test_configs ):
254
+ with open (output_target_name , "w" ) as f :
255
+ headers = set ()
256
+ for config in test_configs :
257
+ headers .update (config .get ("includes_shlib" , []))
258
+ add_headers (f , custom_headers = headers , thrift_headers = [])
259
+
260
+ from textwrap import dedent
261
+
262
+ for config in test_configs :
263
+ ns = config ["suite" ]
264
+ f .write (
265
+ dedent (
266
+ f"""
267
+ { config .get ("raw_definitions_shlib" , "" )}
268
+ namespace { ns } {{
269
+ #pragma clang diagnostic push
270
+ #pragma clang diagnostic ignored \" -Wunused-private-field\"
271
+ { config .get ("definitions_shlib" , "" )}
272
+ #pragma clang diagnostic pop
273
+ }} // namespace { ns }
274
+ """
275
+ )
276
+ )
277
+
278
+
253
279
def get_probe_name (probe_type , test_suite , test_case , args ):
254
280
func_name = get_target_oid_func_name (test_suite , test_case )
255
281
return probe_type + ":" + func_name + ":" + args
@@ -447,15 +473,19 @@ def gen_thrift(test_configs):
447
473
448
474
449
475
def main ():
450
- if len (sys .argv ) < 4 :
451
- print ("Usage: gen_tests.py OUTPUT_TARGET OUTPUT_RUNNER INPUT1 [INPUT2 ...]" )
476
+ if len (sys .argv ) < 5 :
477
+ print (
478
+ "Usage: gen_tests.py OUTPUT_TARGET OUTPUT_SHLIB OUTPUT_RUNNER INPUT1 [INPUT2 ...]"
479
+ )
452
480
exit (1 )
453
481
454
482
output_target = sys .argv [1 ]
455
- output_runner = sys .argv [2 ]
456
- inputs = sys .argv [3 :]
483
+ output_target_shlib = sys .argv [2 ]
484
+ output_runner = sys .argv [3 ]
485
+ inputs = sys .argv [4 :]
457
486
458
487
print (f"Output target: { output_target } " )
488
+ print (f"Output shlib: { output_target_shlib } " )
459
489
print (f"Output runner: { output_runner } " )
460
490
print (f"Input files: { inputs } " )
461
491
@@ -484,6 +514,7 @@ def main():
484
514
)
485
515
486
516
gen_target (output_target , test_configs )
517
+ gen_target_shlib (output_target_shlib , test_configs )
487
518
gen_runner (output_runner , test_configs )
488
519
gen_thrift (test_configs )
489
520
0 commit comments