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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2014, 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.=> defineTests();
4
5 /// This tests the benchmarks in benchmark/benchmark.test, and ensures that our
6 /// benchmarks can run.
7
8 import 'dart:convert';
9 import 'dart:io';
10
11 import 'package:path/path.dart' as path;
12 import 'package:test/test.dart';
13
14 void main() => defineTests();
15
16 void defineTests() {
17 group('benchmarks', () {
18 final List<String> benchmarks = _listBenchmarks();
19
20 test('can list', () {
21 expect(benchmarks, isNotEmpty);
22 });
23
24 for (String benchmarkId in benchmarks) {
25 test(benchmarkId, () {
26 ProcessResult r = Process.runSync(
27 Platform.resolvedExecutable,
28 [
29 path.join('benchmark', 'benchmarks.dart'),
30 'run',
31 '--repeat=1',
32 '--quick',
33 benchmarkId
34 ],
35 workingDirectory: _serverSourcePath,
36 );
37 expect(r.exitCode, 0,
38 reason: 'exit: ${r.exitCode}\n${r.stdout}\n${r.stderr}');
39 });
40 }
41 });
42 }
43
44 List<String> _listBenchmarks() {
45 ProcessResult result = Process.runSync(
46 Platform.resolvedExecutable,
47 [path.join('benchmark', 'benchmarks.dart'), 'list', '--machine'],
48 workingDirectory: _serverSourcePath,
49 );
50 Map m = JSON.decode(result.stdout);
51 List benchmarks = m['benchmarks'];
52 return benchmarks.map((b) => b['id']).toList();
53 }
54
55 String get _serverSourcePath {
56 String script = Platform.script.toFilePath(windows: Platform.isWindows);
57 String pkgPath = path.normalize(path.join(path.dirname(script), '..', '..'));
58 return path.join(pkgPath, 'analysis_server');
59 }
OLDNEW
« 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