Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew M Finkbeiner2013-07-09 14:50:44 -0400
committerAndrew M Finkbeiner2013-07-09 14:51:39 -0400
commit643dafab728a0748c6d2fe4a0039e69c1a8877f4 (patch)
tree80c0cab3306444f5ab267d72a244621a244602eb
parent92831feee82893530a6e49c3de0f551f0c777fdc (diff)
downloadorg.eclipse.osee-643dafab728a0748c6d2fe4a0039e69c1a8877f4.tar.gz
org.eclipse.osee-643dafab728a0748c6d2fe4a0039e69c1a8877f4.tar.xz
org.eclipse.osee-643dafab728a0748c6d2fe4a0039e69c1a8877f4.zip
bug[ats_PL2XK]: Fix aborts for waits outside of testcases
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/TestRunThread.java46
1 files changed, 16 insertions, 30 deletions
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/TestRunThread.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/TestRunThread.java
index 668b8f0932..e129fd86b3 100644
--- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/TestRunThread.java
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/TestRunThread.java
@@ -11,7 +11,6 @@
package org.eclipse.osee.ote.core.framework.testrun;
import java.util.List;
-import java.util.concurrent.locks.ReentrantLock;
import java.util.logging.Level;
import org.eclipse.osee.framework.jdk.core.type.IPropertyStore;
@@ -35,7 +34,6 @@ public class TestRunThread extends OseeTestThread {
private final ITestRunListenerDataProvider dataProvider;
private final IPropertyStore propertyStore;
private volatile boolean abort = false;
- private final ReentrantLock lock = new ReentrantLock();
private final ResultBuilder rb = new ResultBuilder(false);
public TestRunThread(IPropertyStore propertyStore, TestScript test, TestEnvironment env, ITestRunListenerProvider listenerProvider, ITestRunListenerDataProvider dataProvider) {
@@ -64,13 +62,11 @@ public class TestRunThread extends OseeTestThread {
}
rb.append(listenerProvider.notifyPreTestCase(dataProvider.createOnPreTestCase(propertyStore, test,
testCase)));
- lock.lock();
try {
testCase.baseDoTestCase(getEnvironment());
if (Thread.interrupted()) {
throw new InterruptedException("Thread probably aborted");
}
-
} catch (Throwable ex) {
if (abort) {
addAbortResult(null);
@@ -96,11 +92,8 @@ public class TestRunThread extends OseeTestThread {
"Exception running Test Case [" + testCase != null ? testCase.getClass().getName() : "uknown (null test case)" + "]",
ex);
}
- } finally {
- lock.unlock();
- }
- rb.append(listenerProvider.notifyPostTestCase(dataProvider.createOnPostTestCase(propertyStore, test,
- testCase)));
+ }
+ rb.append(listenerProvider.notifyPostTestCase(dataProvider.createOnPostTestCase(propertyStore, test, testCase)));
}
}
} finally {
@@ -129,23 +122,20 @@ public class TestRunThread extends OseeTestThread {
if (Thread.currentThread() == this.getThread()) {
throw new TestException("", Level.SEVERE);
}
- if (lock.isLocked()) {
- // test case is in process
- int count = 0;
- do{
- this.interrupt();
- try{
- this.join(10);
- } catch (InterruptedException ex){
- }
- count++;
- } while (this.isAlive() && count < 200);
+ int count = 0;
+ do{
+ this.interrupt();
+ try{
+ this.join(10);
+ } catch (InterruptedException ex){
+ }
+ count++;
+ } while (this.isAlive() && count < 200);
+ if (this.isAlive()) {
+ OseeLog.reportStatus(new BaseStatus(TestEnvironment.class.getName(), Level.SEVERE,
+ "Waited 60s for test to abort but the thread did not die."));
+ return false;
}
- if (this.isAlive()) {
- OseeLog.reportStatus(new BaseStatus(TestEnvironment.class.getName(), Level.SEVERE,
- "Waited 60s for test to abort but the thread did not die."));
- return false;
- }
return true;
}
@@ -159,11 +149,7 @@ public class TestRunThread extends OseeTestThread {
if (Thread.currentThread() == this.getThread()) {
throw new TestException("", Level.SEVERE);
}
- //
- if (lock.isLocked()) {
- // test case is in process
- this.interrupt();
- }
+ this.interrupt();
return true;
}

Back to the top