OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
| 5 import 'dart:async'; |
5 import 'buildbot_structures.dart'; | 6 import 'buildbot_structures.dart'; |
| 7 import 'logdog.dart' as logdog; |
| 8 import 'util.dart'; |
6 | 9 |
7 /// Data describing the steps of the buildbots. | 10 /// Data describing the steps of the buildbots. |
8 const List<BuildGroup> buildGroups = const <BuildGroup>[ | 11 const List<BuildGroup> buildGroups = const <BuildGroup>[ |
9 const BuildGroup( | 12 const BuildGroup( |
10 groupName: 'vm', | 13 groupName: 'vm', |
11 subgroups: const <BuildSubgroup>[ | 14 subgroups: const <BuildSubgroup>[ |
12 const BuildSubgroup(shardNames: const <String>[ | 15 const BuildSubgroup(shardNames: const <String>[ |
13 'vm-mac-debug-simdbc64-be', | 16 'vm-mac-debug-simdbc64-be', |
14 ], testSteps: const <String>[ | 17 ], testSteps: const <String>[ |
15 'vm tests', | 18 'vm tests', |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 'dart2js-linux-d8-minified-2-5-be', | 340 'dart2js-linux-d8-minified-2-5-be', |
338 'dart2js-linux-d8-minified-3-5-be', | 341 'dart2js-linux-d8-minified-3-5-be', |
339 'dart2js-linux-d8-minified-4-5-be', | 342 'dart2js-linux-d8-minified-4-5-be', |
340 'dart2js-linux-d8-minified-5-5-be', | 343 'dart2js-linux-d8-minified-5-5-be', |
341 ], testSteps: const <String>[ | 344 ], testSteps: const <String>[ |
342 'dart2js d8 tests', | 345 'dart2js d8 tests', |
343 'dart2js d8 observatory_ui tests', | 346 'dart2js d8 observatory_ui tests', |
344 'dart2js d8 package tests', | 347 'dart2js d8 package tests', |
345 'dart2js d8 co19 tests', | 348 'dart2js d8 co19 tests', |
346 'dart2js d8 extra tests', | 349 'dart2js d8 extra tests', |
| 350 'dart2js-with-kernel d8 tests', |
347 'dart2js d8 fast-startup tests', | 351 'dart2js d8 fast-startup tests', |
348 'dart2js d8 observatory_ui fast-startup tests', | 352 'dart2js d8 observatory_ui fast-startup tests', |
349 'dart2js d8 package fast-startup tests', | 353 'dart2js d8 package fast-startup tests', |
350 'dart2js d8 co19 fast-startup tests', | 354 'dart2js d8 co19 fast-startup tests', |
351 'dart2js d8 extra fast-startup tests', | 355 'dart2js d8 extra fast-startup tests', |
352 'dart2js d8 fast-startup checked tests', | 356 'dart2js d8 fast-startup checked tests', |
353 'dart2js d8 observatory_ui fast-startup checked tests', | 357 'dart2js d8 observatory_ui fast-startup checked tests', |
354 'dart2js d8 package fast-startup checked tests', | 358 'dart2js d8 package fast-startup checked tests', |
355 'dart2js d8 co19 fast-startup checked tests', | 359 'dart2js d8 co19 fast-startup checked tests', |
356 'dart2js d8 extra fast-startup checked tests', | 360 'dart2js d8 extra fast-startup checked tests', |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 'analyzer_cli unit tests', | 475 'analyzer_cli unit tests', |
472 'front end unit tests', | 476 'front end unit tests', |
473 ]), | 477 ]), |
474 ], | 478 ], |
475 ), | 479 ), |
476 const BuildGroup( | 480 const BuildGroup( |
477 groupName: 'dart-sdk', | 481 groupName: 'dart-sdk', |
478 subgroups: const <BuildSubgroup>[ | 482 subgroups: const <BuildSubgroup>[ |
479 const BuildSubgroup(shardNames: const <String>[ | 483 const BuildSubgroup(shardNames: const <String>[ |
480 'dart-sdk-linux-be', | 484 'dart-sdk-linux-be', |
481 ], testSteps: const <String>[ | |
482 'annotated_steps', | |
483 ]), | |
484 const BuildSubgroup(shardNames: const <String>[ | |
485 'dart-sdk-windows-be', | 485 'dart-sdk-windows-be', |
486 ], testSteps: const <String>[ | |
487 'annotated_steps', | |
488 ]), | |
489 const BuildSubgroup(shardNames: const <String>[ | |
490 'dart-sdk-mac-be', | 486 'dart-sdk-mac-be', |
491 ], testSteps: const <String>[ | 487 ], testSteps: const <String>[ |
492 'annotated_steps', | 488 'generate_sdks', |
493 ]), | 489 ]), |
494 const BuildSubgroup(shardNames: const <String>[ | 490 const BuildSubgroup(shardNames: const <String>[ |
495 'sdk-trigger-be', | 491 'sdk-trigger-be', |
496 ], testSteps: const <String>[ | 492 ], testSteps: const <String>[ |
497 '', // This subgroup triggers other tests. | 493 '', // This subgroup triggers other tests. |
498 ]), | 494 ]), |
499 ], | 495 ], |
500 ), | 496 ), |
501 const BuildGroup( | 497 const BuildGroup( |
502 groupName: 'dartium-inc', | 498 groupName: 'dartium-inc', |
503 subgroups: const <BuildSubgroup>[ | 499 subgroups: const <BuildSubgroup>[ |
504 const BuildSubgroup(shardNames: const <String>[ | 500 const BuildSubgroup(shardNames: const <String>[ |
505 'dartium-linux-x64-inc-be', | 501 'dartium-linux-x64-inc-be', |
506 ], testSteps: const <String>[ | |
507 'annotated steps', | |
508 ]), | |
509 const BuildSubgroup(shardNames: const <String>[ | |
510 'dartium-mac-x64-inc-be', | 502 'dartium-mac-x64-inc-be', |
511 ], testSteps: const <String>[ | |
512 'annotated steps', | |
513 ]), | |
514 const BuildSubgroup(shardNames: const <String>[ | |
515 'dartium-win-ia32-inc-be', | 503 'dartium-win-ia32-inc-be', |
516 ], testSteps: const <String>[ | 504 ], testSteps: const <String>[ |
517 'annotated steps', | 505 'drt_layout_unchecked_tests', |
| 506 'drt_layout_checked_tests', |
| 507 'dartium_core_unchecked_tests', |
| 508 'dartium_core_checked_tests', |
518 ]), | 509 ]), |
519 ], | 510 ], |
520 ), | 511 ), |
521 const BuildGroup( | 512 const BuildGroup( |
522 groupName: 'dart2js-linux', | 513 groupName: 'dart2js-linux', |
523 subgroups: const <BuildSubgroup>[ | 514 subgroups: const <BuildSubgroup>[ |
524 const BuildSubgroup(shardNames: const <String>[ | 515 const BuildSubgroup(shardNames: const <String>[ |
525 'dart2js-linux-chromeff-1-4-be', | 516 'dart2js-linux-chromeff-1-4-be', |
526 'dart2js-linux-chromeff-2-4-be', | 517 'dart2js-linux-chromeff-2-4-be', |
527 'dart2js-linux-chromeff-3-4-be', | 518 'dart2js-linux-chromeff-3-4-be', |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 /// | 821 /// |
831 /// Set this to `false` to preserve data for older build structures. The data | 822 /// Set this to `false` to preserve data for older build structures. The data |
832 /// will continuously be available through logdog. | 823 /// will continuously be available through logdog. |
833 final bool isActive; | 824 final bool isActive; |
834 | 825 |
835 const BuildSubgroup({this.shardNames, this.testSteps, this.isActive: true}); | 826 const BuildSubgroup({this.shardNames, this.testSteps, this.isActive: true}); |
836 | 827 |
837 Map<String, String> get logDogPaths { | 828 Map<String, String> get logDogPaths { |
838 Map<String, String> paths = <String, String>{}; | 829 Map<String, String> paths = <String, String>{}; |
839 for (String shardName in shardNames) { | 830 for (String shardName in shardNames) { |
840 paths[shardName] = 'chromium/bb/client.dart/$shardName'; | 831 paths[shardName] = getLogDogPath(shardName); |
841 } | 832 } |
842 return paths; | 833 return paths; |
843 } | 834 } |
844 | 835 |
845 /// Returns the [BuildUri] corresponding to the build steps for all shards | 836 /// Returns the [BuildUri] corresponding to the build steps for all shards |
846 /// in this subgroup. | 837 /// in this subgroup. |
847 List<BuildUri> createUris(int buildNumber) { | 838 List<BuildUri> createUris(int buildNumber) { |
848 List<BuildUri> uriList = <BuildUri>[]; | 839 List<BuildUri> uriList = <BuildUri>[]; |
849 for (String shardName in shardNames) { | 840 for (String shardName in shardNames) { |
850 uriList.addAll(createShardUris(shardName, buildNumber)); | 841 uriList.addAll(createShardUris(shardName, buildNumber)); |
851 } | 842 } |
852 return uriList; | 843 return uriList; |
853 } | 844 } |
854 | 845 |
855 List<BuildUri> createShardUris(String shardName, int buildNumber) { | 846 List<BuildUri> createShardUris(String shardName, int buildNumber) { |
856 List<BuildUri> uriList = <BuildUri>[]; | 847 List<BuildUri> uriList = <BuildUri>[]; |
857 for (String testStep in testSteps) { | 848 for (String testStep in testSteps) { |
858 uriList.add(new BuildUri.fromData(shardName, buildNumber, testStep)); | 849 uriList.add(new BuildUri.fromData(shardName, buildNumber, testStep)); |
859 } | 850 } |
860 return uriList; | 851 return uriList; |
861 } | 852 } |
862 } | 853 } |
| 854 |
| 855 /// Computes the logdog path for a build bot with the given [botName]. |
| 856 String getLogDogPath(String botName) { |
| 857 return 'chromium/bb/client.dart/$botName'; |
| 858 } |
| 859 |
| 860 /// Pulls the list of the build numbers (in decreasing order) of the available |
| 861 /// builds for [botName] using logdog. |
| 862 Future<List<int>> lookupBotBuildNumbers(String botName) async { |
| 863 String subgroupPath = getLogDogPath(botName); |
| 864 List<int> buildNumbers = <int>[]; |
| 865 log('Lookup build numbers for $subgroupPath'); |
| 866 String text = await logdog.ls(subgroupPath); |
| 867 for (String line in text.split('\n')) { |
| 868 line = line.trim(); |
| 869 if (line.isNotEmpty) { |
| 870 buildNumbers.add(int.parse(line)); |
| 871 } |
| 872 } |
| 873 buildNumbers.sort((a, b) => -a.compareTo(b)); |
| 874 return buildNumbers; |
| 875 } |
| 876 |
| 877 /// Returns the index of [buildNumber] in the decreasing list of |
| 878 /// [absoluteBuildNumbers]. |
| 879 /// |
| 880 /// If [buildNumber] is negative it is interpreted as a relative number; -1 |
| 881 /// is the last build number (the largest), -2 is the second-to-last build |
| 882 /// number etc. |
| 883 /// |
| 884 /// If [buildNumber] is non-negative and not in [absoluteBuildNumbers], the |
| 885 /// index of the next available build number: looking up 3 in [5, 4, 2, 1] |
| 886 /// returns index 2 (the index of 2). |
| 887 /// |
| 888 /// If no index is found, `null` is returned. |
| 889 int getBuildNumberIndex(List<int> absoluteBuildNumbers, int buildNumber) { |
| 890 if (buildNumber < 0) { |
| 891 int buildNumberIndex = -buildNumber - 1; |
| 892 if (buildNumberIndex < absoluteBuildNumbers.length) { |
| 893 return buildNumberIndex; |
| 894 } else { |
| 895 return null; |
| 896 } |
| 897 } else { |
| 898 for (int i = 0; i < absoluteBuildNumbers.length; i++) { |
| 899 if (absoluteBuildNumbers[i] <= buildNumber) return i; |
| 900 } |
| 901 return null; |
| 902 } |
| 903 } |
| 904 |
| 905 Future<int> lookupAbsoluteBuildNumber( |
| 906 String botName, int relativeBuildNumber) async { |
| 907 if (relativeBuildNumber >= 0) return relativeBuildNumber; |
| 908 List<int> absoluteBuildNumbers = await lookupBotBuildNumbers(botName); |
| 909 int buildNumberIndex = |
| 910 getBuildNumberIndex(absoluteBuildNumbers, relativeBuildNumber); |
| 911 return buildNumberIndex != null |
| 912 ? absoluteBuildNumbers[buildNumberIndex] |
| 913 : null; |
| 914 } |
| 915 |
| 916 Map<BuildSubgroup, List<String>> findSubgroupsByName(String name) { |
| 917 Map<BuildSubgroup, List<String>> subgroups = <BuildSubgroup, List<String>>{}; |
| 918 for (BuildGroup group in buildGroups) { |
| 919 if (group.groupName == name) { |
| 920 for (BuildSubgroup subgroup in group.subgroups) { |
| 921 subgroups[subgroup] = subgroup.shardNames; |
| 922 } |
| 923 } else { |
| 924 for (BuildSubgroup subgroup in group.subgroups) { |
| 925 List<String> shardNames = <String>[]; |
| 926 for (String shardName in subgroup.shardNames) { |
| 927 if (shardName.contains(name)) { |
| 928 shardNames.add(shardName); |
| 929 } |
| 930 } |
| 931 if (shardNames.isNotEmpty) { |
| 932 subgroups[subgroup] = shardNames; |
| 933 } |
| 934 } |
| 935 } |
| 936 } |
| 937 return subgroups; |
| 938 } |
| 939 |
| 940 Map<BuildSubgroup, List<String>> findSubgroupsByStep(String stepName) { |
| 941 Map<BuildSubgroup, List<String>> subgroups = <BuildSubgroup, List<String>>{}; |
| 942 for (BuildGroup group in buildGroups) { |
| 943 for (BuildSubgroup subgroup in group.subgroups) { |
| 944 List<String> stepNames = <String>[]; |
| 945 for (String step in subgroup.testSteps) { |
| 946 if (step.contains(stepName)) { |
| 947 stepNames.add(step); |
| 948 } |
| 949 } |
| 950 if (stepNames.isNotEmpty) { |
| 951 subgroups[subgroup] = stepNames; |
| 952 } |
| 953 } |
| 954 } |
| 955 return subgroups; |
| 956 } |
OLD | NEW |