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

Side by Side Diff: pkg/analysis_server/benchmark/perf/completion_timing_tests.dart

Issue 1393693003: add completion tests (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: remove unused code Created 5 years, 2 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/perf/analysis_timing_tests.dart ('k') | no next file » | 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) 2015, 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 library server.performance.analysis.timing;
6
7 import 'dart:async';
8 import 'dart:io';
9
10 import 'package:args/args.dart';
11 import 'package:test_reflective_loader/test_reflective_loader.dart';
12 import 'package:unittest/unittest.dart';
13
14 import '../../test/utils.dart';
15 import 'performance_tests.dart';
16
17 /**
18 * Pass in the directory of the source to be analyzed as option `--source`,
19 * specify a priority file with `--priority` and an offset for completions
20 * with a `--offset`.
21 */
22 main(List<String> arguments) {
23 initializeTestEnvironment();
24 ArgParser parser = _createArgParser();
25 var args = parser.parse(arguments);
26 if (args[SOURCE_OPTION] == null) {
27 print('path to source directory must be specified');
28 exit(1);
29 }
30 source = args[SOURCE_OPTION];
31 priorityFile = args[PRIORITY_FILE_OPTION];
32 offset = args[COMPLETION_OFFSET];
33
34 unittestConfiguration.timeout = new Duration(minutes: 20);
35
36 defineReflectiveTests(CompletionTimingTest);
37 }
38
39 const PRIORITY_FILE_OPTION = 'priority';
40 const SOURCE_OPTION = 'source';
41 const COMPLETION_OFFSET = 'offset';
42
43 String priorityFile;
44 String source;
45 int offset;
46
47 ArgParser _createArgParser() => new ArgParser()
48 ..addOption(SOURCE_OPTION, help: 'full path to source directory for analysis')
49 ..addOption(PRIORITY_FILE_OPTION, help: 'full path to a priority file')
50 ..addOption(COMPLETION_OFFSET, help: 'offset in file for code completions');
51
52 @reflectiveTest
53 class CompletionTimingTest extends AbstractAnalysisServerPerformanceTest {
54 List<Duration> timings = <Duration>[];
55
56 @override
57 Future setUp() => super.setUp().then((_) {
58 sourceDirectory = new Directory(source);
59 subscribeToStatusNotifications();
60 });
61
62 Future test_timing() {
63 // debugStdio();
64
65 expect(priorityFile, isNotNull,
66 reason: 'A priority file must be specified for completion testing.');
67 expect(offset, isNotNull,
68 reason: 'An offset must be specified for completion testing.');
69
70 stopwatch.start();
71
72 onCompletionResults.listen((_) {
73 timings.add(new Duration(milliseconds: stopwatch.elapsed.inMilliseconds));
74 });
75
76 setAnalysisRoot();
77 sendAnalysisSetPriorityFiles([priorityFile]);
78 sendCompletionGetSuggestions(priorityFile, offset);
79
80 return analysisFinished.then((_) {
81 print('analysis completed in ${stopwatch.elapsed}');
82 timings.forEach((timing) => print('notification at : ${timings}'));
83 stopwatch.reset();
84 });
85 }
86 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/benchmark/perf/analysis_timing_tests.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698