@@ -29,8 +29,8 @@ Contains macros used throughout the repo.
29
29
30
30
load ("//bazel:cc_grpc_library.bzl" , "cc_grpc_library" )
31
31
load ("//bazel:copts.bzl" , "GRPC_DEFAULT_COPTS" )
32
- load ("//bazel:experiments.bzl" , "EXPERIMENTS" , "EXPERIMENT_ENABLES" )
33
- load ("//bazel:test_experiments.bzl" , "TEST_EXPERIMENTS" , "TEST_EXPERIMENT_ENABLES" )
32
+ load ("//bazel:experiments.bzl" , "EXPERIMENTS" , "EXPERIMENT_ENABLES" , "EXPERIMENT_POLLERS" )
33
+ load ("//bazel:test_experiments.bzl" , "TEST_EXPERIMENTS" , "TEST_EXPERIMENT_ENABLES" , "TEST_EXPERIMENT_POLLERS" )
34
34
load ("@build_bazel_rules_apple//apple:ios.bzl" , "ios_unit_test" )
35
35
load ("@build_bazel_rules_apple//apple/testing/default_runner:ios_test_runner.bzl" , "ios_test_runner" )
36
36
load ("@com_google_protobuf//bazel:upb_proto_library.bzl" , "upb_proto_library" , "upb_proto_reflection_library" )
@@ -279,8 +279,10 @@ def ios_cc_test(
279
279
deps = ios_test_deps ,
280
280
)
281
281
282
- def expand_tests (name , srcs , deps , tags , args , exclude_pollers , uses_polling , uses_event_engine , flaky ):
283
- """Common logic used to parameterize tests for every poller and EventEngine and experiment.
282
+ def expand_poller_config (name , srcs , deps , tags , args , exclude_pollers , uses_polling , uses_event_engine , flaky ):
283
+ """Common logic used to parameterize tests for every poller and EventEngine.
284
+
285
+ Used by expand_tests (repeatedly) to form base lists of pollers for each experiment.
284
286
285
287
Args:
286
288
name: base name of the test
@@ -297,6 +299,7 @@ def expand_tests(name, srcs, deps, tags, args, exclude_pollers, uses_polling, us
297
299
Returns:
298
300
A list of dictionaries containing modified values of name, srcs, deps, tags, and args.
299
301
"""
302
+
300
303
poller_config = []
301
304
302
305
# See work_stealing_thread_pool.cc for details.
@@ -373,6 +376,27 @@ def expand_tests(name, srcs, deps, tags, args, exclude_pollers, uses_polling, us
373
376
"flaky" : flaky ,
374
377
})
375
378
379
+ return poller_config
380
+
381
+ def expand_tests (name , srcs , deps , tags , args , exclude_pollers , uses_polling , uses_event_engine , flaky ):
382
+ """Common logic used to parameterize tests for every poller and EventEngine and experiment.
383
+
384
+ Args:
385
+ name: base name of the test
386
+ srcs: source files
387
+ deps: base deps
388
+ tags: base tags
389
+ args: base args
390
+ flaky: base flaky
391
+ exclude_pollers: list of poller names to exclude for this set of tests.
392
+ uses_polling: set to False if the test is not sensitive to polling methodology.
393
+ uses_event_engine: set to False if the test is not sensitive to
394
+ EventEngine implementation differences
395
+
396
+ Returns:
397
+ A list of dictionaries containing modified values of name, srcs, deps, tags, and args.
398
+ """
399
+
376
400
experiments = {}
377
401
378
402
# buildifier: disable=uninitialized
@@ -421,13 +445,28 @@ def expand_tests(name, srcs, deps, tags, args, exclude_pollers, uses_polling, us
421
445
tags .append ("no_test_ios" )
422
446
return tags
423
447
424
- experiment_config = list (poller_config )
448
+ base_params = {
449
+ "name" : name ,
450
+ "srcs" : srcs ,
451
+ "deps" : deps ,
452
+ "tags" : tags ,
453
+ "args" : args ,
454
+ "exclude_pollers" : exclude_pollers ,
455
+ "uses_polling" : uses_polling ,
456
+ "uses_event_engine" : uses_event_engine ,
457
+ "flaky" : flaky ,
458
+ }
459
+
460
+ experiment_config = expand_poller_config (** base_params )
425
461
experiment_enables = {k : v for k , v in EXPERIMENT_ENABLES .items () + TEST_EXPERIMENT_ENABLES .items ()}
462
+ experiment_pollers = EXPERIMENT_POLLERS + TEST_EXPERIMENT_POLLERS
426
463
for mode , config in mode_config .items ():
427
464
enabled_tags , disabled_tags = config
428
465
if enabled_tags != None :
429
466
for experiment in experiments [mode ].keys ():
430
- for config in poller_config :
467
+ experiment_params = dict (base_params )
468
+ experiment_params ["uses_polling" ] = uses_polling and (experiment in experiment_pollers )
469
+ for config in expand_poller_config (** experiment_params ):
431
470
config = dict (config )
432
471
config ["name" ] = config ["name" ] + "@experiment=" + experiment
433
472
env = dict (config ["env" ])
@@ -443,7 +482,9 @@ def expand_tests(name, srcs, deps, tags, args, exclude_pollers, uses_polling, us
443
482
experiment_config .append (config )
444
483
if disabled_tags != None :
445
484
for experiment in experiments [mode ].keys ():
446
- for config in poller_config :
485
+ experiment_params = dict (base_params )
486
+ experiment_params ["uses_polling" ] = uses_polling and (experiment in experiment_pollers )
487
+ for config in expand_poller_config (** experiment_params ):
447
488
config = dict (config )
448
489
config ["name" ] = config ["name" ] + "@experiment=no_" + experiment
449
490
env = dict (config ["env" ])
0 commit comments