aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Haug2018-07-18 13:19:40 -0400
committerJuergen Haug2018-07-18 13:19:40 -0400
commit33e12d15db7f984eae3350d992c797e85362c9ed (patch)
treeabbcf46bc4630f3c03b593a77e0d8807aaea9ff6
parentc33073c10865923d47f00981b04169929f32bcd9 (diff)
downloadorg.eclipse.etrice-33e12d15db7f984eae3350d992c797e85362c9ed.tar.gz
org.eclipse.etrice-33e12d15db7f984eae3350d992c797e85362c9ed.tar.xz
org.eclipse.etrice-33e12d15db7f984eae3350d992c797e85362c9ed.zip
[etUnit] fixed test case timing for java
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.c10
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/etunit/EtUnit.java5
2 files changed, 7 insertions, 8 deletions
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.c b/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.c
index bfc8dc2e2..36d3c219a 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.c
@@ -167,12 +167,7 @@ etInt16 etUnit_openTestCase(const char* testCaseName) {
}
void etUnit_closeTestCase(etInt16 id) {
- etTime time;
- OrderInfo* info;
- getTimeFromTarget(&time);
- etTimeHelpers_subtract(&time, &etUnit_lastTestCaseTime);
-
- info = getOrderInfo(id);
+ OrderInfo* info = getOrderInfo(id);
if(info != NULL){
if (info->currentIndex != info->size) {
etUnit_handleExpect(id, ET_FALSE, "EXPECT_ORDER was not completed", NULL, NULL, 0, 0);
@@ -180,6 +175,9 @@ void etUnit_closeTestCase(etInt16 id) {
}
if (etUnit_reportfile != NULL) {
+ etTime time;
+ getTimeFromTarget(&time);
+ etTimeHelpers_subtract(&time, &etUnit_lastTestCaseTime);
etLogger_fprintf(etUnit_reportfile, "tc end %d: %d\n", id, etTimeHelpers_convertToMSec(&time));
}
}
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 a35241119..e8cabfe51 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
@@ -37,6 +37,7 @@ public class EtUnit {
private static BufferedWriter out = null;
private static long etUnit_startTime;
+ private static long etUnit_lastTestCaseTime;
private static int etUnit_nextCaseId = 1;
private static HashSet<Integer> failed = new HashSet<Integer>();
private static HashMap<Integer, OrderInfo> orderInfo = new HashMap<Integer, OrderInfo>();
@@ -105,14 +106,13 @@ public class EtUnit {
} catch (IOException e) {
e.printStackTrace();
}
+ etUnit_lastTestCaseTime = System.currentTimeMillis();
}
return caseId;
}
public static void etUnit_closeTestCase(int id) {
- long time = System.currentTimeMillis() - etUnit_startTime;
-
OrderInfo info = orderInfo.get(id);
if (info!=null) {
if (info.current != info.list.length) {
@@ -121,6 +121,7 @@ public class EtUnit {
}
if (out!=null) {
+ long time = System.currentTimeMillis() - etUnit_lastTestCaseTime;
try {
out.write("tc end "+id+": "+time+"\n");
out.flush();