| 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 /// Checks that all active test steps in [buildGroups] can be read from http. | 5 /// Checks that all active test steps in [buildGroups] can be read from http. |
| 6 | 6 |
| 7 import 'package:args/args.dart'; | 7 import 'package:args/args.dart'; |
| 8 import 'package:expect/expect.dart'; | 8 import 'package:expect/expect.dart'; |
| 9 import 'package:gardening/src/bot.dart'; | 9 import 'package:gardening/src/bot.dart'; |
| 10 import 'package:gardening/src/buildbot_data.dart'; | 10 import 'package:gardening/src/buildbot_data.dart'; |
| 11 import 'package:gardening/src/buildbot_structures.dart'; | 11 import 'package:gardening/src/buildbot_structures.dart'; |
| 12 import 'package:gardening/src/util.dart'; | 12 import 'package:gardening/src/util.dart'; |
| 13 | 13 |
| 14 main(List<String> args) async { | 14 main(List<String> args) async { |
| 15 ArgParser argParser = createArgParser(); | 15 ArgParser argParser = createArgParser(); |
| 16 ArgResults argResults = argParser.parse(args); | 16 ArgResults argResults = argParser.parse(args); |
| 17 processArgResults(argResults); | 17 processArgResults(argResults); |
| 18 bool useLogdog = argResults['logdog']; | 18 bool useLogdog = argResults['logdog']; |
| 19 | 19 |
| 20 Bot bot = new Bot(logdog: useLogdog); | 20 Bot bot = new Bot(logdog: useLogdog); |
| 21 | 21 |
| 22 List<String> failingUris = <String>[]; | 22 List<String> failingUris = <String>[]; |
| 23 List<String> missingBuildNumbers = <String>[]; |
| 23 List<BuildUri> buildUris = <BuildUri>[]; | 24 List<BuildUri> buildUris = <BuildUri>[]; |
| 24 for (BuildGroup buildGroup in buildGroups) { | 25 for (BuildGroup buildGroup in buildGroups) { |
| 25 for (BuildSubgroup buildSubgroup in buildGroup.subgroups) { | 26 for (BuildSubgroup buildSubgroup in buildGroup.subgroups) { |
| 26 if (!useLogdog && !buildSubgroup.isActive) continue; | 27 if (!useLogdog && !buildSubgroup.isActive) continue; |
| 27 buildUris.addAll(buildSubgroup.createUris(bot.mostRecentBuildNumber)); | 28 buildUris.addAll(buildSubgroup.createUris(bot.mostRecentBuildNumber)); |
| 28 } | 29 } |
| 29 } | 30 } |
| 30 List<BuildResult> buildResults = await bot.readResults(buildUris); | 31 List<BuildResult> buildResults = await bot.readResults(buildUris); |
| 31 for (int index = 0; index < buildResults.length; index++) { | 32 for (int index = 0; index < buildResults.length; index++) { |
| 32 BuildUri buildUri = buildUris[index]; | 33 BuildUri buildUri = buildUris[index]; |
| 33 BuildResult result = buildResults[index]; | 34 BuildResult result = buildResults[index]; |
| 34 if (result == null) { | 35 if (result == null) { |
| 35 failingUris.add('$buildUri'); | 36 failingUris.add('$buildUri'); |
| 37 } else { |
| 38 if (result.buildNumber == null) { |
| 39 missingBuildNumbers.add('$buildUri'); |
| 40 } |
| 41 Expect.isNotNull(result.buildRevision, "No build revision in $buildUri"); |
| 36 } | 42 } |
| 37 } | 43 } |
| 38 // TODO(johnniwinther): Find out why these steps cannot be read. | 44 // TODO(johnniwinther): Find out why these steps cannot be read. |
| 39 Expect.setEquals([ | 45 Expect.setEquals([ |
| 40 '/builders/pkg-mac10.11-release-be/builds/-1/' | 46 '/builders/pkg-mac10.11-release-be/builds/-1/' |
| 41 'steps/third_party/pkg_tested unit tests', | 47 'steps/third_party/pkg_tested unit tests', |
| 42 '/builders/pkg-linux-release-be/builds/-1/steps/' | 48 '/builders/pkg-linux-release-be/builds/-1/steps/' |
| 43 'third_party/pkg_tested unit tests', | 49 'third_party/pkg_tested unit tests', |
| 44 '/builders/pkg-win7-release-be/builds/-1/steps/' | 50 '/builders/pkg-win7-release-be/builds/-1/steps/' |
| 45 'third_party/pkg_tested unit tests', | 51 'third_party/pkg_tested unit tests', |
| 46 ], failingUris, | 52 ], failingUris, |
| 47 "Unexpected failing buildbot uris:\n ${failingUris.join('\n ')}"); | 53 "Unexpected failing buildbot uris:\n ${failingUris.join('\n ')}"); |
| 48 | 54 |
| 55 Expect.setEquals( |
| 56 [], |
| 57 missingBuildNumbers, |
| 58 "Unexpected missing build numbers in:\n " |
| 59 "${missingBuildNumbers.join('\n ')}"); |
| 60 |
| 49 bot.close(); | 61 bot.close(); |
| 50 } | 62 } |
| OLD | NEW |