6161import subprocess
6262import sys
6363
64+ from integration_testing import config_reader
65+
6466# Note that desktop is used for fallback,
6567# if there is no direct match for a key.
6668DEFAULT_WORKFLOW = "desktop"
@@ -334,12 +336,26 @@ def filter_values_on_diff(parm_key, value, auto_diff):
334336 return value
335337
336338
339+ def filter_platforms_on_apis (platforms , apis ):
340+ if "tvOS" in platforms :
341+ config = config_reader .read_config ()
342+ supported_apis = [api for api in apis if config .get_api (api ).tvos_target ]
343+ if not supported_apis :
344+ platforms .remove ("tvOS" )
345+
346+ return platforms
347+
348+
337349def main ():
338350 args = parse_cmdline_args ()
339351 if args .override :
340352 # If it is matrix parm, convert CSV string into a list
341353 if not args .config :
342354 args .override = args .override .split (',' )
355+ if args .parm_key == "platform" and args .apis :
356+ # e.g. args.apis = "\"admob,analytics\""
357+ args .override = filter_platforms_on_apis (args .override , args .apis .strip ('"' ).split (',' ))
358+
343359 print_value (args .override )
344360 return
345361
@@ -365,6 +381,8 @@ def parse_cmdline_args():
365381 parser .add_argument ('-o' , '--override' , help = 'Override existing value with provided value' )
366382 parser .add_argument ('-d' , '--device' , action = 'store_true' , help = 'Get the device type, used with -k $device' )
367383 parser .add_argument ('-t' , '--device_type' , default = ['real' , 'virtual' ], help = 'Test on which type of mobile devices' )
384+ parser .add_argument ('--apis' , default = PARAMETERS ["integration_tests" ]["config" ]["apis" ],
385+ help = 'Exclude platform based on apis. Certain platform does not support all apis. e.g. tvOS does not support messaging' )
368386 args = parser .parse_args ()
369387 return args
370388
0 commit comments