anchor.diff:    final Match match = pattern.firstMatch(subshardName);
     if (match == null || match.groupCount != 2) {
       print('${red}Invalid subshard name "$subshardName". Expected format "[int]_[int]" ex. "1_3"');
  -    // TODO(jmagman): exit(1) here instead once LUCI configs are migrated to d+_d+ subshard format.
  -    return null;
  +    exit(1);
     }
     // One-indexed.
     final int index = int.parse(match.group(1));
  
positive.code:   return null;
  }
  
  /// Parse (zero-)index-named subshards and equally distribute [tests]
  /// between them. Last shard should end in "_last" to catch mismatches
  /// between `.cirrus.yml` and `test.dart`. See [selectShard] for naming details.
  ///
  /// Examples:
  /// build_tests-0-linux
  /// build_tests-1-linux
  /// build_tests-2_last-linux
  Future<void> _selectIndexedSubshard(List<ShardRunner> tests, int numberOfShards) async {
    final int testsPerShard = tests.length ~/ numberOfShards;
    final Map<String, ShardRunner> subshards = <String, ShardRunner>{};
  
    for (int subshard = 0; subshard < numberOfShards; subshard += 1) {
      String last = '';
      List<ShardRunner> sublist;
      if (subshard < numberOfShards - 1) {
        sublist = tests.sublist(subshard * testsPerShard, (subshard + 1) * testsPerShard);
      } else {
        sublist = tests.sublist(subshard * testsPerShard, tests.length);
        // We make sure the last shard ends in _last.
        last = '_last';
      }
      subshards['$subshard$last'] = () async {
        for (final ShardRunner test in sublist)
          await test();
      };
    }
  
    await selectSubshard(subshards);
  }
  
  /// Parse (one-)index/total-named subshards from environment variable SUBSHARD
  /// and equally distribute [tests] between them.
  /// Subshard format is "{index}_{total number of shards}".
  
negative.code: 
  final bool useFlutterTestFormatter = Platform.environment['FLUTTER_TEST_FORMATTER'] == 'true';
  
  const String kShardKey = 'SHARD';
  const String kSubshardKey = 'SUBSHARD';
  
  