def combine_config()

in scripts/gha/summarize_test_results.py [0:0]


def combine_config(platform, config, config_value, k):
  config_before_combination = config.copy()
  logging.info("platform: %s; config: %s; config_value: %s", platform, config, config_value)
  if k == 1 and platform in ("android", "ios", "tvos"):
    # config_name = test_device here
    k = -1
  config_name = BUILD_CONFIGS[platform][k]
  # if certain config failed for all values, add message "All *"
  if len(config_value) > 1 and len(config) == len(config_value):
    config = ["All %d %s" % (len(config_value), config_name)]
  elif config_name == "ios_device":
    ftl_devices = set(filter(lambda device: TEST_DEVICES.get(device).get("type") in "real", config_value))
    simulators = set(filter(lambda device: TEST_DEVICES.get(device).get("type") in "virtual", config_value))
    if len(ftl_devices) > 1 and ftl_devices.issubset(set(config)):
      config.insert(0, "All %d FTL Devices" % len(ftl_devices))
      config = [x for x in config if (x not in ftl_devices)]
    if len(simulators) > 1 and simulators.issubset(set(config)):
      config.insert(0, "All %d Simulators" % len(simulators))
      config = [x for x in config if (x not in simulators)]
  elif config_name == "android_device":
    ftl_devices = set(filter(lambda device: TEST_DEVICES.get(device).get("type") in "real", config_value))
    emulators = set(filter(lambda device: TEST_DEVICES.get(device).get("type") in "virtual", config_value))
    if len(ftl_devices) > 1 and ftl_devices.issubset(set(config)):
      config.insert(0, "All %d FTL Devices" % len(ftl_devices))
      config = [x for x in config if (x not in ftl_devices)]
    if len(emulators) > 1 and emulators.issubset(set(config)):
      config.insert(0, "All %d Emulators" % len(emulators))
      config = [x for x in config if (x not in emulators)]
  # if certain config failed for more than 1 value but not all, add message "x/y" which means "x" out of "y" configs has errors.
  if len(config_value) > 1 and config_before_combination == config:
    config = ["%d/%d %s: %s" % (len(config), len(config_value), config_name, flat_config(config))]

  return config