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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/benchmark/perf/completion_timing_tests.dart
diff --git a/pkg/analysis_server/benchmark/perf/completion_timing_tests.dart b/pkg/analysis_server/benchmark/perf/completion_timing_tests.dart
new file mode 100644
index 0000000000000000000000000000000000000000..6ff587a18f5793aad94a49d45176b3fe10f36af6
--- /dev/null
+++ b/pkg/analysis_server/benchmark/perf/completion_timing_tests.dart
@@ -0,0 +1,86 @@
+// Copyright (c) 2015, 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.
+
+library server.performance.analysis.timing;
+
+import 'dart:async';
+import 'dart:io';
+
+import 'package:args/args.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+import 'package:unittest/unittest.dart';
+
+import '../../test/utils.dart';
+import 'performance_tests.dart';
+
+/**
+ * Pass in the directory of the source to be analyzed as option `--source`,
+ * specify a priority file with `--priority` and an offset for completions
+ * with a `--offset`.
+ */
+main(List<String> arguments) {
+ initializeTestEnvironment();
+ ArgParser parser = _createArgParser();
+ var args = parser.parse(arguments);
+ if (args[SOURCE_OPTION] == null) {
+ print('path to source directory must be specified');
+ exit(1);
+ }
+ source = args[SOURCE_OPTION];
+ priorityFile = args[PRIORITY_FILE_OPTION];
+ offset = args[COMPLETION_OFFSET];
+
+ unittestConfiguration.timeout = new Duration(minutes: 20);
+
+ defineReflectiveTests(CompletionTimingTest);
+}
+
+const PRIORITY_FILE_OPTION = 'priority';
+const SOURCE_OPTION = 'source';
+const COMPLETION_OFFSET = 'offset';
+
+String priorityFile;
+String source;
+int offset;
+
+ArgParser _createArgParser() => new ArgParser()
+ ..addOption(SOURCE_OPTION, help: 'full path to source directory for analysis')
+ ..addOption(PRIORITY_FILE_OPTION, help: 'full path to a priority file')
+ ..addOption(COMPLETION_OFFSET, help: 'offset in file for code completions');
+
+@reflectiveTest
+class CompletionTimingTest extends AbstractAnalysisServerPerformanceTest {
+ List<Duration> timings = <Duration>[];
+
+ @override
+ Future setUp() => super.setUp().then((_) {
+ sourceDirectory = new Directory(source);
+ subscribeToStatusNotifications();
+ });
+
+ Future test_timing() {
+// debugStdio();
+
+ expect(priorityFile, isNotNull,
+ reason: 'A priority file must be specified for completion testing.');
+ expect(offset, isNotNull,
+ reason: 'An offset must be specified for completion testing.');
+
+ stopwatch.start();
+
+ onCompletionResults.listen((_) {
+ timings.add(new Duration(milliseconds: stopwatch.elapsed.inMilliseconds));
+ });
+
+ setAnalysisRoot();
+ sendAnalysisSetPriorityFiles([priorityFile]);
+ sendCompletionGetSuggestions(priorityFile, offset);
+
+ return analysisFinished.then((_) {
+ print('analysis completed in ${stopwatch.elapsed}');
+ timings.forEach((timing) => print('notification at : ${timings}'));
+ stopwatch.reset();
+ });
+ }
+}
« 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