Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1008)

Side by Side Diff: tools/gardening/lib/src/buildbot_loading.dart

Issue 2997043002: Include build revision in BuildResult (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/gardening/lib/src/buildbot_structures.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 'dart:async';
6 import 'dart:io'; 6 import 'dart:io';
7 import 'util.dart'; 7 import 'util.dart';
8 8
9 import 'buildbot_structures.dart'; 9 import 'buildbot_structures.dart';
10 import 'cache.dart'; 10 import 'cache.dart';
11 import 'logdog.dart'; 11 import 'logdog.dart';
12 12
13 const String BUILDBOT_BUILDNUMBER = ' BUILDBOT_BUILDNUMBER: '; 13 const String BUILDBOT_BUILDNUMBER = ' BUILDBOT_BUILDNUMBER: ';
14 const String BUILDBOT_REVISION = ' BUILDBOT_REVISION: ';
14 15
15 /// Read the build result for [buildUri]. 16 /// Read the build result for [buildUri].
16 /// 17 ///
17 /// The data is loaded from the cache, if available, otherwise [read] is called 18 /// The data is loaded from the cache, if available, otherwise [read] is called
18 /// to fetch the data and stored in the cache afterwards. 19 /// to fetch the data and stored in the cache afterwards.
19 Future<BuildResult> _readBuildResult( 20 Future<BuildResult> _readBuildResult(
20 BuildUri buildUri, Future<String> read()) async { 21 BuildUri buildUri, Future<String> read()) async {
21 if (buildUri.buildNumber < 0) { 22 if (buildUri.buildNumber < 0) {
22 String text = await read(); 23 String text = await read();
23 BuildResult result = parseTestStepResult(buildUri, text); 24 BuildResult result = parseTestStepResult(buildUri, text);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 new TestConfiguration(configName, archName, testName), status); 72 new TestConfiguration(configName, archName, testName), status);
72 } catch (_) { 73 } catch (_) {
73 return null; 74 return null;
74 } 75 }
75 } 76 }
76 77
77 /// Parses the [buildUri] test log and creates a [BuildResult] for it. 78 /// Parses the [buildUri] test log and creates a [BuildResult] for it.
78 BuildResult parseTestStepResult(BuildUri buildUri, String text) { 79 BuildResult parseTestStepResult(BuildUri buildUri, String text) {
79 log('Parsing results: $buildUri (${text.length} bytes)'); 80 log('Parsing results: $buildUri (${text.length} bytes)');
80 int buildNumber; 81 int buildNumber;
82 String buildRevision;
81 List<String> currentFailure; 83 List<String> currentFailure;
82 bool parsingTimingBlock = false; 84 bool parsingTimingBlock = false;
83 85
84 List<TestStatus> results = <TestStatus>[]; 86 List<TestStatus> results = <TestStatus>[];
85 List<TestFailure> failures = <TestFailure>[]; 87 List<TestFailure> failures = <TestFailure>[];
86 List<Timing> timings = <Timing>[]; 88 List<Timing> timings = <Timing>[];
87 for (String line in text.split('\n')) { 89 for (String line in text.split('\n')) {
88 if (line.startsWith(BUILDBOT_BUILDNUMBER)) { 90 if (line.startsWith(BUILDBOT_BUILDNUMBER)) {
89 buildNumber = 91 buildNumber =
90 int.parse(line.substring(BUILDBOT_BUILDNUMBER.length).trim()); 92 int.parse(line.substring(BUILDBOT_BUILDNUMBER.length).trim());
91 buildUri = buildUri.withBuildNumber(buildNumber); 93 buildUri = buildUri.withBuildNumber(buildNumber);
92 } 94 }
95 if (line.startsWith(BUILDBOT_REVISION)) {
96 buildRevision = line.substring(BUILDBOT_REVISION.length).trim();
97 }
93 if (currentFailure != null) { 98 if (currentFailure != null) {
94 if (line.startsWith('Done ')) { 99 if (line.startsWith('Done ')) {
95 TestStatus status = parseTestStatus(line); 100 TestStatus status = parseTestStatus(line);
96 if (status != null) { 101 if (status != null) {
97 results.add(status); 102 results.add(status);
98 failures.add(new TestFailure(buildUri, currentFailure)); 103 failures.add(new TestFailure(buildUri, currentFailure));
99 currentFailure = null; 104 currentFailure = null;
100 } 105 }
101 } else { 106 } else {
102 currentFailure.add(line); 107 currentFailure.add(line);
(...skipping 11 matching lines...) Expand all
114 parsingTimingBlock = true; 119 parsingTimingBlock = true;
115 } else if (parsingTimingBlock) { 120 } else if (parsingTimingBlock) {
116 if (line.startsWith('0:')) { 121 if (line.startsWith('0:')) {
117 timings.addAll(parseTimings(buildUri, line)); 122 timings.addAll(parseTimings(buildUri, line));
118 } else { 123 } else {
119 parsingTimingBlock = false; 124 parsingTimingBlock = false;
120 } 125 }
121 } 126 }
122 } 127 }
123 return new BuildResult(buildUri, buildNumber ?? buildUri.absoluteBuildNumber, 128 return new BuildResult(buildUri, buildNumber ?? buildUri.absoluteBuildNumber,
124 results, failures, timings); 129 buildRevision, results, failures, timings);
125 } 130 }
126 131
127 /// Create the [Timing]s for the [line] as found in the top-20 timings of a 132 /// Create the [Timing]s for the [line] as found in the top-20 timings of a
128 /// build step stdio log. 133 /// build step stdio log.
129 List<Timing> parseTimings(BuildUri uri, String line) { 134 List<Timing> parseTimings(BuildUri uri, String line) {
130 List<String> parts = split(line, [' - ', ' - ', ' ']); 135 List<String> parts = split(line, [' - ', ' - ', ' ']);
131 String time = parts[0]; 136 String time = parts[0];
132 String stepName = parts[1]; 137 String stepName = parts[1];
133 String configName = parts[2]; 138 String configName = parts[2];
134 String testNames = parts[3]; 139 String testNames = parts[3];
135 List<Timing> timings = <Timing>[]; 140 List<Timing> timings = <Timing>[];
136 for (String name in testNames.split(',')) { 141 for (String name in testNames.split(',')) {
137 name = name.trim(); 142 name = name.trim();
138 int slashPos = name.indexOf('/'); 143 int slashPos = name.indexOf('/');
139 String archName = name.substring(0, slashPos); 144 String archName = name.substring(0, slashPos);
140 String testName = name.substring(slashPos + 1); 145 String testName = name.substring(slashPos + 1);
141 timings.add(new Timing( 146 timings.add(new Timing(
142 uri, 147 uri,
143 time, 148 time,
144 new TestStep( 149 new TestStep(
145 stepName, new TestConfiguration(configName, archName, testName)))); 150 stepName, new TestConfiguration(configName, archName, testName))));
146 } 151 }
147 return timings; 152 return timings;
148 } 153 }
OLDNEW
« no previous file with comments | « no previous file | tools/gardening/lib/src/buildbot_structures.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698