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

Unified Diff: tools/gardening/test/compare_failures_test.dart

Issue 2987253002: Add test to compare-failures (Closed)
Patch Set: Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gardening/pubspec.yaml ('k') | tools/gardening/test/test_client.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gardening/test/compare_failures_test.dart
diff --git a/tools/gardening/test/compare_failures_test.dart b/tools/gardening/test/compare_failures_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..d7cc9e526cbb2d730915cf65e37cd121ebe00b37
--- /dev/null
+++ b/tools/gardening/test/compare_failures_test.dart
@@ -0,0 +1,79 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// Compares the test log of a build step with previous builds.
+///
+/// Use this to detect flakiness of failures, especially timeouts.
+
+import 'dart:async';
+
+import 'package:args/args.dart';
+import 'package:expect/expect.dart';
+import 'package:gardening/src/buildbot_structures.dart';
+import 'package:gardening/src/client.dart';
+import 'package:gardening/src/compare_failures_impl.dart';
+import 'package:gardening/src/util.dart';
+
+import 'test_client.dart';
+
+main(List<String> args) async {
+ ArgParser argParser = createArgParser();
+ argParser.addFlag('force', abbr: 'f');
+ ArgResults argResults = argParser.parse(args);
+ processArgResults(argResults);
+ bool force = argResults['force'];
+
+ BuildbotClient client = argResults['logdog']
+ ? new LogdogBuildbotClient()
+ : new TestClient(force: force);
+
+ await runSingleTest(
+ client,
+ 'https://build.chromium.org/p/client.dart/builders/'
+ 'vm-kernel-linux-debug-x64-be/builds/1884/steps/'
+ 'vm%20tests/logs/stdio',
+ 1,
+ {
+ 1884: {
+ 'dartk-vm debug_x64 corelib_2/map_keys2_test': 'RuntimeError/Pass',
+ },
+ 1883: {
+ 'dartk-vm debug_x64 corelib_2/map_keys2_test': 'RuntimeError/Pass',
+ 'dartk-vm debug_x64 corelib_2/package_resource_test':
+ 'Pass/CompileTimeError',
+ },
+ });
+
+ client.close();
+}
+
+testSingleResults(
+ Map<int, Map<String, String>> expected, List<BuildResult> results) {
+ Expect.equals(expected.length, results.length);
+ int i = 0;
+ expected.forEach((int buildNumber, Map<String, String> failures) {
+ BuildResult result = results[i++];
+ Expect.equals(failures.length, result.errors.length);
+ failures.forEach((String testName, String resultText) {
+ List<String> nameParts = split(testName, [' ', ' ']);
+ TestConfiguration id =
+ new TestConfiguration(nameParts[0], nameParts[1], nameParts[2]);
+ List<String> resultParts = split(resultText, ['/']);
+ TestFailure failure = result.errors.singleWhere((t) => t.id == id);
+ Expect.equals(failure.expected, resultParts[0]);
+ Expect.equals(failure.actual, resultParts[1]);
+ });
+ });
+}
+
+Future runSingleTest(BuildbotClient client, String testUri, int runCount,
+ Map<int, Map<String, String>> expectedResult) async {
+ Map<BuildUri, List<BuildResult>> buildResults =
+ await loadBuildResults(client, [testUri], runCount: runCount);
+ if (LOG) {
+ printBuildResultsSummary(buildResults);
+ }
+ Expect.equals(1, buildResults.length);
+ testSingleResults(expectedResult, buildResults.values.first);
+}
« 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