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

Side by Side Diff: pkg/analysis_server/test/integration/analysis/reanalyze_concurrent_test.dart

Issue 678413003: Avoid analysis server crash when reanalyze invoked during analysis. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Change bool to only be true when performOperation pending. Created 6 years, 1 month 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 | Annotate | Revision Log
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.
4
5 /**
6 * This test verifies that if reanalysis is performed while reanalysis is in
7 * progress, no problems occur. See dartbug.com/21448.
8 */
9 library test.integration.analysis.reanalyze_concurrent;
10
11 import 'dart:async';
12
13 import 'package:analysis_server/src/protocol.dart';
14 import 'package:unittest/unittest.dart';
15
16 import '../../reflective_tests.dart';
17 import '../integration_tests.dart';
18
19 @ReflectiveTestCase()
20 class Test extends AbstractAnalysisServerIntegrationTest {
21 test_reanalyze_concurrent() {
22 String pathname = sourcePath('test.dart');
23 String text = '''
24 // Do a bunch of imports so that analysis has some work to do.
25 import 'dart:io';
26 import 'dart:convert';
27 import 'dart:async';
28
29 main() {}''';
30 writeFile(pathname, text);
31 standardAnalysisSetup();
32 return analysisFinished.then((_) {
33 sendAnalysisReanalyze();
34 // Wait for reanalysis to start.
35 return onServerStatus.first.then((_) {
36 sendAnalysisReanalyze();
37 return analysisFinished.then((_) {
38 // Now that reanalysis has finished, no further analysis should occur.
39 onServerStatus.listen((ServerStatusParams data) {
40 if (data.analysis != null) {
41 if (data.analysis.isAnalyzing) {
42 // Most likely what happened is that the first reanalyze
43 // completed before the second reanalyze had a chance to start,
44 // and we are just now starting the second reanalyze. If this i s
45 // the case, then the test isn't testing what it's meant to test
46 // (because we are trying to test what happens when one reanalyz e
47 // starts while another is in progress). In which case we will
48 // need to give the analyzer more work to do.
49 fail('First reanalyze finished before second started.');
50 }
51 }
52 });
53 // Give the server an extra second to make sure it doesn't take any
54 // more actions.
55 return new Future.delayed(new Duration(seconds: 1));
56 });
57 });
58 });
59 }
60 }
61
62 main() {
63 runReflectiveTests(Test);
64 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/analysis_server_test.dart ('k') | pkg/analysis_server/test/integration/analysis/test_all.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698