Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 42878 Details for
Bug 129929
IDE no longer responsive when junit tests are running
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Simpler fix (propagating upwards only)
129929_propagating.patch (text/plain), 9.54 KB, created by
Markus Keller
on 2006-05-29 13:53:21 EDT
(
hide
)
Description:
Simpler fix (propagating upwards only)
Filename:
MIME Type:
Creator:
Markus Keller
Created:
2006-05-29 13:53:21 EDT
Size:
9.54 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.junit >Index: src/org/eclipse/jdt/internal/junit/ui/TestViewer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/TestViewer.java,v >retrieving revision 1.12 >diff -u -r1.12 TestViewer.java >--- src/org/eclipse/jdt/internal/junit/ui/TestViewer.java 5 May 2006 15:01:44 -0000 1.12 >+++ src/org/eclipse/jdt/internal/junit/ui/TestViewer.java 29 May 2006 17:45:37 -0000 >@@ -12,10 +12,10 @@ > package org.eclipse.jdt.internal.junit.ui; > > import java.util.AbstractList; >-import java.util.ArrayList; > import java.util.Arrays; > import java.util.HashSet; > import java.util.Iterator; >+import java.util.LinkedHashSet; > import java.util.LinkedList; > import java.util.List; > import java.util.ListIterator; >@@ -461,34 +461,33 @@ > > private void updateElementInTree(final TestElement testElement) { > if (isShown(testElement)) { >- ArrayList toCreate= null; >- TestElement current= testElement; >- while (! (current instanceof TestRoot)) { >- if (fTreeViewer.testFindItem(current) == null) { >- if (toCreate == null) >- toCreate= new ArrayList(); >- toCreate.add(current); >- } else { >- TestElement parent= current; >- if (toCreate != null) { >- ListIterator iter= toCreate.listIterator(toCreate.size()); // backwards, top first >- while (iter.hasPrevious()) { >- TestElement child= (TestElement) iter.previous(); >- fTreeViewer.add(parent, child); >- parent= child; >- } >- } >- fTreeViewer.update(current, null); >- } >- current= (TestElement) fTreeContentProvider.getParent(current); >- } >- >+ updateShownElementInTree(testElement); > } else { > TestElement current= testElement; > do { >- fTreeViewer.remove(current); >+ if (fTreeViewer.testFindItem(current) != null) >+ fTreeViewer.remove(current); > current= current.getParent(); > } while (! (current instanceof TestRoot) && ! isShown(current)); >+ >+ while (current != null && ! (current instanceof TestRoot)) { >+ fTreeViewer.update(current, null); >+ current= current.getParent(); >+ } >+ } >+ } >+ >+ private void updateShownElementInTree(TestElement testElement) { >+ if (testElement == null || testElement instanceof TestRoot) // paranoia null check >+ return; >+ >+ TestSuiteElement parent= testElement.getParent(); >+ updateShownElementInTree(parent); // make sure parent is shown and up-to-date >+ >+ if (fTreeViewer.testFindItem(testElement) == null) { >+ fTreeViewer.add(parent, testElement); // if not yet in tree: add >+ } else { >+ fTreeViewer.update(testElement, null); // if in tree: update > } > } > >@@ -640,7 +639,7 @@ > } > > private void clearUpdateAndExpansion() { >- fNeedUpdate= new HashSet(); >+ fNeedUpdate= new LinkedHashSet(); > fAutoClose= new LinkedList(); > fAutoExpand= new HashSet(); > } >Index: src/org/eclipse/jdt/internal/junit/ui/TestSessionLabelProvider.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/TestSessionLabelProvider.java,v >retrieving revision 1.8 >diff -u -r1.8 TestSessionLabelProvider.java >--- src/org/eclipse/jdt/internal/junit/ui/TestSessionLabelProvider.java 11 May 2006 16:19:03 -0000 1.8 >+++ src/org/eclipse/jdt/internal/junit/ui/TestSessionLabelProvider.java 29 May 2006 17:45:36 -0000 >@@ -73,12 +73,12 @@ > Status status=testCaseElement.getStatus(); > if (status.isNotRun()) > return fTestRunnerPart.fTestIcon; >+ else if (status.isRunning()) >+ return fTestRunnerPart.fTestRunningIcon; > else if (status.isError()) > return fTestRunnerPart.fTestErrorIcon; > else if (status.isFailure()) > return fTestRunnerPart.fTestFailIcon; >- else if (status.isRunning()) >- return fTestRunnerPart.fTestRunningIcon; > else if (status.isOK()) > return fTestRunnerPart.fTestOkIcon; > else >@@ -88,12 +88,12 @@ > Status status= ((TestSuiteElement) element).getStatus(); > if (status.isNotRun()) > return fTestRunnerPart.fSuiteIcon; >+ else if (status.isRunning()) >+ return fTestRunnerPart.fSuiteRunningIcon; > else if (status.isError()) > return fTestRunnerPart.fSuiteErrorIcon; > else if (status.isFailure()) > return fTestRunnerPart.fSuiteFailIcon; >- else if (status.isRunning()) >- return fTestRunnerPart.fSuiteRunningIcon; > else if (status.isOK()) > return fTestRunnerPart.fSuiteOkIcon; > else >Index: src/org/eclipse/jdt/internal/junit/model/TestSuiteElement.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/model/TestSuiteElement.java,v >retrieving revision 1.5 >diff -u -r1.5 TestSuiteElement.java >--- src/org/eclipse/jdt/internal/junit/model/TestSuiteElement.java 5 May 2006 15:01:44 -0000 1.5 >+++ src/org/eclipse/jdt/internal/junit/model/TestSuiteElement.java 29 May 2006 17:45:36 -0000 >@@ -18,6 +18,7 @@ > public class TestSuiteElement extends TestElement { > > private List/*<TestElement>*/ fChildren; >+ private Status fChildrenStatus; > > public TestSuiteElement(TestSuiteElement parent, String id, String testName, int childrenCount) { > super(parent, id, testName); >@@ -33,14 +34,19 @@ > } > > public Status getStatus() { >- //TODO: Cache failure count in hierarchy? Recheck behavior when introducing filters > Status suiteStatus= getSuiteStatus(); >-// Assert.isTrue(suiteStatus.isNotRun() >-// || (suiteStatus == Status.FAILURE || suiteStatus == Status.ERROR)); >- >+ if (fChildrenStatus != null) { >+ // must combine children and suite status here, since failures can occur e.g. in @AfterClass >+ return Status.combineStatus(fChildrenStatus, suiteStatus); >+ } else { >+ return suiteStatus; >+ } >+ } >+ >+ private Status getCumulatedStatus() { > TestElement[] children= (TestElement[]) fChildren.toArray(new TestElement[fChildren.size()]); // copy list to avoid concurreny problems > if (children.length == 0) >- return suiteStatus; >+ return getSuiteStatus(); > > Status cumulated= children[0].getStatus(); > >@@ -51,7 +57,7 @@ > // not necessary, see special code in Status.combineProgress() > // if (suiteStatus.isErrorOrFailure() && cumulated.isNotRun()) > // return suiteStatus; //progress is Done if error in Suite and no children run >- return Status.combineStatus(cumulated, suiteStatus); >+ return cumulated; > } > > public Status getSuiteStatus() { >@@ -62,4 +68,49 @@ > return super.toString() + " (" + fChildren.size() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ > } > >+ public void childChangedStatus(TestElement child, Status childStatus) { >+ int childCount= fChildren.size(); >+ if (child == fChildren.get(0) && childStatus.isRunning()) { >+ // is first child, and is running -> copy status >+ internalSetChildrenStatus(childStatus); >+ return; >+ } >+ TestElement lastChild= (TestElement) fChildren.get(childCount - 1); >+ if (child == lastChild) { >+ if (childStatus.isDone()) { >+ // all children done, collect cumulative status >+ internalSetChildrenStatus(getCumulatedStatus()); >+ return; >+ } >+ // go on (child could e.g. be a TestSuiteElement with RUNNING_FAILURE) >+ >+ } else if (! lastChild.getStatus().isNotRun()) { >+ // child is not last, but last child has been run -> child has been rerun or is rerunning >+ internalSetChildrenStatus(getCumulatedStatus()); >+ return; >+ } >+ >+ // finally, set RUNNING_FAILURE/ERROR if child has failed but suite has not failed: >+ if (childStatus.isFailure()) { >+ if (fChildrenStatus == null || ! fChildrenStatus.isErrorOrFailure()) { >+ internalSetChildrenStatus(Status.RUNNING_FAILURE); >+ return; >+ } >+ } else if (childStatus.isError()) { >+ if (fChildrenStatus == null || ! fChildrenStatus.isError()) { >+ internalSetChildrenStatus(Status.RUNNING_ERROR); >+ return; >+ } >+ } >+ } >+ >+ private void internalSetChildrenStatus(Status status) { >+ if (fChildrenStatus == status) >+ return; >+ fChildrenStatus= status; >+ TestSuiteElement parent= getParent(); >+ if (parent != null) >+ parent.childChangedStatus(this, getStatus()); >+ } >+ > } >Index: src/org/eclipse/jdt/internal/junit/model/TestElement.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/model/TestElement.java,v >retrieving revision 1.8 >diff -u -r1.8 TestElement.java >--- src/org/eclipse/jdt/internal/junit/model/TestElement.java 5 May 2006 16:09:34 -0000 1.8 >+++ src/org/eclipse/jdt/internal/junit/model/TestElement.java 29 May 2006 17:45:36 -0000 >@@ -155,9 +155,9 @@ > fParent= parent; > fId= id; > fTestName= testName; >+ fStatus= Status.NOT_RUN; > if (parent != null) > parent.addChild(this); >- fStatus= Status.NOT_RUN; > } > > /** >@@ -183,15 +183,18 @@ > //TODO: notify about change? > //TODO: multiple errors/failures per test https://bugs.eclipse.org/bugs/show_bug.cgi?id=125296 > fStatus= status; >+ TestSuiteElement parent= getParent(); >+ if (parent != null) >+ parent.childChangedStatus(this, status); > } > > public void setStatus(Status status, String trace, String expected, String actual) { > //TODO: notify about change? > //TODO: multiple errors/failures per test https://bugs.eclipse.org/bugs/show_bug.cgi?id=125296 >- fStatus= status; > fTrace= trace; > fExpected= expected; > fActual= actual; >+ setStatus(status); > } > > public Status getStatus() {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 129929
:
42042
|
42137
|
42277
| 42878