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

Unified Diff: pkg/analysis_server/test/benchmarks_test.dart

Issue 2986293002: Redo our benchmarks; add a benchmark/benchmarks.dart tool. (Closed)
Patch Set: copyright year 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/benchmark/readme.md ('k') | pkg/analysis_server/test/completion_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/benchmarks_test.dart
diff --git a/pkg/analysis_server/test/benchmarks_test.dart b/pkg/analysis_server/test/benchmarks_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..370c088c05c8f347772ef4feffb89a83c151ee61
--- /dev/null
+++ b/pkg/analysis_server/test/benchmarks_test.dart
@@ -0,0 +1,59 @@
+// Copyright (c) 2014, 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.=> defineTests();
+
+/// This tests the benchmarks in benchmark/benchmark.test, and ensures that our
+/// benchmarks can run.
+
+import 'dart:convert';
+import 'dart:io';
+
+import 'package:path/path.dart' as path;
+import 'package:test/test.dart';
+
+void main() => defineTests();
+
+void defineTests() {
+ group('benchmarks', () {
+ final List<String> benchmarks = _listBenchmarks();
+
+ test('can list', () {
+ expect(benchmarks, isNotEmpty);
+ });
+
+ for (String benchmarkId in benchmarks) {
+ test(benchmarkId, () {
+ ProcessResult r = Process.runSync(
+ Platform.resolvedExecutable,
+ [
+ path.join('benchmark', 'benchmarks.dart'),
+ 'run',
+ '--repeat=1',
+ '--quick',
+ benchmarkId
+ ],
+ workingDirectory: _serverSourcePath,
+ );
+ expect(r.exitCode, 0,
+ reason: 'exit: ${r.exitCode}\n${r.stdout}\n${r.stderr}');
+ });
+ }
+ });
+}
+
+List<String> _listBenchmarks() {
+ ProcessResult result = Process.runSync(
+ Platform.resolvedExecutable,
+ [path.join('benchmark', 'benchmarks.dart'), 'list', '--machine'],
+ workingDirectory: _serverSourcePath,
+ );
+ Map m = JSON.decode(result.stdout);
+ List benchmarks = m['benchmarks'];
+ return benchmarks.map((b) => b['id']).toList();
+}
+
+String get _serverSourcePath {
+ String script = Platform.script.toFilePath(windows: Platform.isWindows);
+ String pkgPath = path.normalize(path.join(path.dirname(script), '..', '..'));
+ return path.join(pkgPath, 'analysis_server');
+}
« no previous file with comments | « pkg/analysis_server/benchmark/readme.md ('k') | pkg/analysis_server/test/completion_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698