Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2013-05-08 03:26:47 -0400
committerHenrik Rentz-Reichert2013-05-08 03:26:47 -0400
commitb21dc15d2371792aee9a3b0c60ce2e77a40502da (patch)
tree0a51f4d40c4f9b3000a479ceb7c02b38a4a3da2c /runtime/org.eclipse.etrice.runtime.java/src/org/eclipse
parent1e880adfb4f740c7de77f360483975ef097cd84e (diff)
downloadorg.eclipse.etrice-b21dc15d2371792aee9a3b0c60ce2e77a40502da.tar.gz
org.eclipse.etrice-b21dc15d2371792aee9a3b0c60ce2e77a40502da.tar.xz
org.eclipse.etrice-b21dc15d2371792aee9a3b0c60ce2e77a40502da.zip
[runtime.java] renamed test semaphore
Diffstat (limited to 'runtime/org.eclipse.etrice.runtime.java/src/org/eclipse')
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/etunit/EtUnit.java2
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/SubSystemClassBase.java26
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/SubSystemRunnerBase.java24
3 files changed, 28 insertions, 24 deletions
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/etunit/EtUnit.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/etunit/EtUnit.java
index 900fa80e0..bdf50dcd8 100644
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/etunit/EtUnit.java
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/etunit/EtUnit.java
@@ -289,7 +289,7 @@ public class EtUnit {
}
public static void etUnit_testFinished(int id) {
- RTServices.getInstance().getSubSystem().testFinished(etUnit_isSuccess(id)?0:1);
+ RTServices.getInstance().getSubSystem().terminate(etUnit_isSuccess(id)?0:1);
}
private static void etUnit_handleExpect(int id, boolean result, String resulttext, String exp, String act) {
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/SubSystemClassBase.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/SubSystemClassBase.java
index 39a0b703a..6234d6a90 100644
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/SubSystemClassBase.java
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/SubSystemClassBase.java
@@ -36,8 +36,8 @@ public abstract class SubSystemClassBase extends RTObject implements IEventRecei
protected static final int IFITEM_RTSystemPort = 0;
// for tests only
- private TestSemaphore testSem=null;
- private int testErrorCode;
+ private TestSemaphore terminateSem=null;
+ private int terminateCode;
public SubSystemClassBase(IRTObject parent, String name) {
super(parent, name);
@@ -137,24 +137,24 @@ public abstract class SubSystemClassBase extends RTObject implements IEventRecei
}
// this is to run integration tests
- public synchronized void setTestSemaphore(TestSemaphore sem){
- testErrorCode = -1;
- testSem=sem;
+ public synchronized void setTerminateSemaphore(TestSemaphore sem){
+ terminateCode = -1;
+ terminateSem=sem;
}
- public synchronized int getTestErrorCode(){
- return testErrorCode;
+ public synchronized int getTerminateCode(){
+ return terminateCode;
}
- public void testFinished(int errorCode){
- if (testSem != null) {
- System.out.println("org.eclipse.etrice.runtime.java.modelbase.SubSystemClassBase.testFinished(int): before releasing semaphore");
+ public void terminate(int errorCode){
+ if (terminateSem != null) {
+ //System.out.println("org.eclipse.etrice.runtime.java.modelbase.SubSystemClassBase.testFinished(int): before releasing semaphore");
//testSem.printWaitingThreads();
synchronized (this) {
- testErrorCode = errorCode;
- testSem.release(1);
+ terminateCode = errorCode;
+ terminateSem.release(1);
}
- System.out.println("org.eclipse.etrice.runtime.java.modelbase.SubSystemClassBase.testFinished(int): semaphore released");
+ //System.out.println("org.eclipse.etrice.runtime.java.modelbase.SubSystemClassBase.testFinished(int): semaphore released");
//testSem.printWaitingThreads();
Thread.yield();
}
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/SubSystemRunnerBase.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/SubSystemRunnerBase.java
index 14148e001..7d444a013 100644
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/SubSystemRunnerBase.java
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/SubSystemRunnerBase.java
@@ -13,9 +13,10 @@ import java.io.InputStreamReader;
public class SubSystemRunnerBase {
private static final String OPTION_RUN_AS_TEST = "-run_as_test";
+ private static final String OPTION_HEADLESS = "-headless";
- private static boolean test = false;
- protected static TestSemaphore testSem = new TestSemaphore(0);
+ private static boolean headless = false;
+ protected static TestSemaphore terminateSem = new TestSemaphore(0);
protected static void run(SubSystemClassBase main_component, String[] args) {
@@ -23,21 +24,24 @@ public class SubSystemRunnerBase {
for (String arg : args) {
if (arg.equals(OPTION_RUN_AS_TEST)) {
-
System.out.println("*** running as test");
- test = true;
+ headless = true;
+ }
+ else if (arg.equals(OPTION_HEADLESS)) {
+ System.out.println("*** running headless");
+ headless = true;
}
}
- if (test)
- main_component.setTestSemaphore(testSem);
+ if (headless)
+ main_component.setTerminateSemaphore(terminateSem);
main_component.init(); // lifecycle init
main_component.start(); // lifecycle start
// application runs until quit
- if (test)
- waitForTestcase();
+ if (headless)
+ waitForTerminate();
else
waitForQuit();
@@ -67,10 +71,10 @@ public class SubSystemRunnerBase {
}
}
- public static void waitForTestcase() {
+ public static void waitForTerminate() {
try{
System.out.println("=== waitForTestcase: before acq. semaphore, thread "+Thread.currentThread().getName());
- testSem.acquire(1);
+ terminateSem.acquire(1);
System.out.println("=== waitForTestcase: after acq. semaphore, thread "+Thread.currentThread().getName());
}catch(InterruptedException e){
System.out.println("Semaphore fault !");

Back to the top