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

Unified Diff: pkg/analyzer/test/src/task/driver_test.dart

Issue 1061803002: Detect and recover from infinite task loops (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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/analyzer/lib/src/task/driver.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/task/driver_test.dart
diff --git a/pkg/analyzer/test/src/task/driver_test.dart b/pkg/analyzer/test/src/task/driver_test.dart
index 17e55dbe40d626081ab3782737f01b46f21bed4e..656906362cb6e30630d17378a5d325481f6e84aa 100644
--- a/pkg/analyzer/test/src/task/driver_test.dart
+++ b/pkg/analyzer/test/src/task/driver_test.dart
@@ -260,6 +260,35 @@ class AnalysisDriverTest extends EngineTestCase {
expect(driver.performAnalysisTask(), false);
}
+ test_performAnalysisTask_infiniteLoop() {
+ AnalysisTarget target = new TestSource();
+ ResultDescriptor resultA = new ResultDescriptor('resultA', -1);
+ ResultDescriptor resultB = new ResultDescriptor('resultB', -2);
+ // configure tasks
+ TestAnalysisTask task1;
+ TestAnalysisTask task2;
+ TaskDescriptor descriptor1 = new TaskDescriptor(
+ 'task1', (context, target) => task1, (target) => {
+ 'inputB': new SimpleTaskInput<int>(target, resultB)
+ }, [resultA]);
+ TaskDescriptor descriptor2 = new TaskDescriptor('task2',
+ (context, target) => task2, (target) => {
+ 'inputA': new SimpleTaskInput<int>(target, resultA)
+ }, [resultB]);
+ task1 = new TestAnalysisTask(context, target, descriptor: descriptor1);
+ task2 = new TestAnalysisTask(context, target, descriptor: descriptor2);
+ manager.addTaskDescriptor(descriptor1);
+ manager.addTaskDescriptor(descriptor2);
+ context.explicitTargets.add(target);
+ manager.addGeneralResult(resultB);
+ // prepare work order
+ expect(driver.performAnalysisTask(), true);
+ expect(driver.performAnalysisTask(), true);
+ CaughtException exception = context.getCacheEntry(target).exception;
+ expect(exception, isNotNull);
+ expect(exception.exception, new isInstanceOf<InfiniteTaskLoopException>());
+ }
+
test_performWorkItem_exceptionInTask() {
AnalysisTarget target = new TestSource();
ResultDescriptor result = new ResultDescriptor('result', null);
« no previous file with comments | « pkg/analyzer/lib/src/task/driver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698