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

Side by Side Diff: tools/gardening/test/compare_failures_test.dart

Issue 2987253002: Add test to compare-failures (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 | « tools/gardening/pubspec.yaml ('k') | tools/gardening/test/test_client.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 /// Compares the test log of a build step with previous builds.
6 ///
7 /// Use this to detect flakiness of failures, especially timeouts.
8
9 import 'dart:async';
10
11 import 'package:args/args.dart';
12 import 'package:expect/expect.dart';
13 import 'package:gardening/src/buildbot_structures.dart';
14 import 'package:gardening/src/client.dart';
15 import 'package:gardening/src/compare_failures_impl.dart';
16 import 'package:gardening/src/util.dart';
17
18 import 'test_client.dart';
19
20 main(List<String> args) async {
21 ArgParser argParser = createArgParser();
22 argParser.addFlag('force', abbr: 'f');
23 ArgResults argResults = argParser.parse(args);
24 processArgResults(argResults);
25 bool force = argResults['force'];
26
27 BuildbotClient client = argResults['logdog']
28 ? new LogdogBuildbotClient()
29 : new TestClient(force: force);
30
31 await runSingleTest(
32 client,
33 'https://build.chromium.org/p/client.dart/builders/'
34 'vm-kernel-linux-debug-x64-be/builds/1884/steps/'
35 'vm%20tests/logs/stdio',
36 1,
37 {
38 1884: {
39 'dartk-vm debug_x64 corelib_2/map_keys2_test': 'RuntimeError/Pass',
40 },
41 1883: {
42 'dartk-vm debug_x64 corelib_2/map_keys2_test': 'RuntimeError/Pass',
43 'dartk-vm debug_x64 corelib_2/package_resource_test':
44 'Pass/CompileTimeError',
45 },
46 });
47
48 client.close();
49 }
50
51 testSingleResults(
52 Map<int, Map<String, String>> expected, List<BuildResult> results) {
53 Expect.equals(expected.length, results.length);
54 int i = 0;
55 expected.forEach((int buildNumber, Map<String, String> failures) {
56 BuildResult result = results[i++];
57 Expect.equals(failures.length, result.errors.length);
58 failures.forEach((String testName, String resultText) {
59 List<String> nameParts = split(testName, [' ', ' ']);
60 TestConfiguration id =
61 new TestConfiguration(nameParts[0], nameParts[1], nameParts[2]);
62 List<String> resultParts = split(resultText, ['/']);
63 TestFailure failure = result.errors.singleWhere((t) => t.id == id);
64 Expect.equals(failure.expected, resultParts[0]);
65 Expect.equals(failure.actual, resultParts[1]);
66 });
67 });
68 }
69
70 Future runSingleTest(BuildbotClient client, String testUri, int runCount,
71 Map<int, Map<String, String>> expectedResult) async {
72 Map<BuildUri, List<BuildResult>> buildResults =
73 await loadBuildResults(client, [testUri], runCount: runCount);
74 if (LOG) {
75 printBuildResultsSummary(buildResults);
76 }
77 Expect.equals(1, buildResults.length);
78 testSingleResults(expectedResult, buildResults.values.first);
79 }
OLDNEW
« no previous file with comments | « tools/gardening/pubspec.yaml ('k') | tools/gardening/test/test_client.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698