Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/org.eclipse.etrice.runtime.c.tests/src/runtime/RunCRuntimeTestcases.c2
-rw-r--r--tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMessageService.c24
-rw-r--r--tests/org.eclipse.etrice.runtime.c.tests/tmp/testlog/TestCRuntime.etu41
-rw-r--r--tests/org.eclipse.etrice.runtime.c.tests/tmp/testlog/TestEtUnitSpecial.etu4
4 files changed, 49 insertions, 22 deletions
diff --git a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/RunCRuntimeTestcases.c b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/RunCRuntimeTestcases.c
index 4ab86cbb9..df418f396 100644
--- a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/RunCRuntimeTestcases.c
+++ b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/RunCRuntimeTestcases.c
@@ -44,7 +44,7 @@ void RunCRuntimeTestcases(void){
TestEtMemory_runSuite();
TestEtMessage_runSuite();
TestEtMessageQueue_runSuite();
-// TestEtMessageService_runSuite();
+ TestEtMessageService_runSuite();
TestEtUnit_runSuite();
TestEtTimer_runSuite();
TestEtTimeHelpers_runSuite();
diff --git a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMessageService.c b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMessageService.c
index 201514757..07f8acc00 100644
--- a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMessageService.c
+++ b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMessageService.c
@@ -65,6 +65,7 @@ void TestEtMessageService_init(etInt16 id){
EXPECT_EQUAL_PTR(id, "msgService.messagePool.last(2)", &msgBuffer[5*blockSize], msgService.messagePool.last);
EXPECT_EQUAL_PTR(id, "msgService.messagePool.last.next", 0, msgService.messagePool.last->next);
+ etMessageService_destroy(&msgService);
}
void TestEtMessageService_GetPushPopReturn(etInt16 id){
@@ -110,6 +111,8 @@ void TestEtMessageService_GetPushPopReturn(etInt16 id){
etMessageService_returnMessageBuffer(&msgService, rcvMsg2);
EXPECT_EQUAL_INT16(id, "msgService.messagePool.size", 6, msgService.messagePool.size);
+
+ etMessageService_destroy(&msgService);
}
void TestEtMessageService_GetReturn(etInt16 id){
@@ -124,7 +127,7 @@ void TestEtMessageService_GetReturn(etInt16 id){
// get one message too much from pool
etMessage* msg1 = etMessageService_getMessageBuffer(&msgService, sizeof(etMessage));
etMessage* msg2 = etMessageService_getMessageBuffer(&msgService, sizeof(etMessage));
- etMessage* msg3 = etMessageService_getMessageBuffer(&msgService, sizeof(etMessage));
+ etMessage* msg3 = etMessageService_getMessageBuffer(&msgService, sizeof(etMessage)); /* this line triggers an error log */
EXPECT_TRUE(id, "msgService getMessageBuffer", msg1!=NULL);
EXPECT_TRUE(id, "msgService getMessageBuffer", msg2!=NULL);
EXPECT_EQUAL_PTR(id, "msgService getMessageBuffer", msg3, NULL);
@@ -135,9 +138,10 @@ void TestEtMessageService_GetReturn(etInt16 id){
EXPECT_EQUAL_INT16(id, "msgService.messagePool.size", 2, msgService.messagePool.size);
// get message bigger than blocksize
- etMessage* msg4 = etMessageService_getMessageBuffer(&msgService, 33);
+ etMessage* msg4 = etMessageService_getMessageBuffer(&msgService, 33); /* this line triggers an error log */
EXPECT_EQUAL_PTR(id, "msgService getMessageBuffer", msg4, NULL);
+ etMessageService_destroy(&msgService);
}
void TestEtMessageService_execute(etInt16 id){
@@ -162,11 +166,23 @@ void TestEtMessageService_execute(etInt16 id){
etMessageService_pushMessage(&msgService, msg1);
etMessageService_pushMessage(&msgService, msg2);
- /* make sure that receivedEventIDCounter==0 and receivedEventIDs[n]==0*/
- etMessageService_execute(&msgService);
+
+ msgService.thread.stacksize = 1024;
+ msgService.thread.priority = 1;
+ msgService.thread.threadName = "Thread1";
+ msgService.thread.threadFunction = (etThreadFunction) etMessageService_execute;
+ msgService.thread.threadFunctionData = &msgService;
+
+ etMessageService_start(&msgService);
+ etThread_sleep(100); /* wait 100 ms for the delivery */
+
EXPECT_EQUAL_INT16(id, "deliverAllMessages msg1", msg1->evtID, receivedEventIDs[0]);
EXPECT_EQUAL_INT16(id, "deliverAllMessages msg2", msg2->evtID, receivedEventIDs[1]);
EXPECT_EQUAL_INT16(id, "deliverAllMessages receivedEventIDCounter", 2, receivedEventIDCounter);
+
+ etMessageService_stop(&msgService);
+
+ etMessageService_destroy(&msgService);
}
void TestEtMessageService_getMessagePoolLowWaterMark(etInt16 id){
diff --git a/tests/org.eclipse.etrice.runtime.c.tests/tmp/testlog/TestCRuntime.etu b/tests/org.eclipse.etrice.runtime.c.tests/tmp/testlog/TestCRuntime.etu
index 73347e136..ceff20102 100644
--- a/tests/org.eclipse.etrice.runtime.c.tests/tmp/testlog/TestCRuntime.etu
+++ b/tests/org.eclipse.etrice.runtime.c.tests/tmp/testlog/TestCRuntime.etu
@@ -1,12 +1,12 @@
etUnit report
ts start: TestQueue
tc start 1: TestEtQueue_test
-tc end 1: 15
+tc end 1: 13
ts start: TestMemory
tc start 2: TestEtMemory_testFixedSize
-tc end 2: 0
+tc end 2: 11
tc start 3: TestEtMemory_testFreeList
-tc end 3: 0
+tc end 3: 4
ts start: TestMessage
tc start 4: TestEtMessage_testBasicMessage
tc end 4: 0
@@ -14,19 +14,30 @@ ts start: TestEtMessageQueue
tc start 5: TestEtMessageQueue_testPushPop
tc end 5: 0
tc start 6: TestEtMessageQueue_testMassiveMessaging
-tc end 6: 16
-ts start: TestEtUnit
-tc start 7: TestEtUnit_Expect_Order
+tc end 6: 15
+ts start: TestEtMessageService
+tc start 7: TestEtMessageService_init
tc end 7: 0
-tc start 8: TestEtUnit_Expect
+tc start 8: TestEtMessageService_GetPushPopReturn
tc end 8: 0
-ts start: TestEtTimer
-tc start 9: TestEtTimer_lifecycle
-tc end 9: 1513
-tc start 10: TestEtTimer_multiTimer
-tc end 10: 1014
-ts start: TestEtTimeHelpers
-tc start 11: TestEtTimeHelpers_convertToMSec
+tc start 9: TestEtMessageService_GetReturn
+tc end 9: 0
+tc start 10: TestEtMessageService_execute
+tc end 10: 100
+tc start 11: TestEtMessageService_getMessagePoolLowWaterMark
tc end 11: 0
-tc start 12: TestEtTimeHelpers_convertToEtTime
+ts start: TestEtUnit
+tc start 12: TestEtUnit_Expect_Order
tc end 12: 0
+tc start 13: TestEtUnit_Expect
+tc end 13: 0
+ts start: TestEtTimer
+tc start 14: TestEtTimer_lifecycle
+tc end 14: 1500
+tc start 15: TestEtTimer_multiTimer
+tc end 15: 1001
+ts start: TestEtTimeHelpers
+tc start 16: TestEtTimeHelpers_convertToMSec
+tc end 16: 0
+tc start 17: TestEtTimeHelpers_convertToEtTime
+tc end 17: 0
diff --git a/tests/org.eclipse.etrice.runtime.c.tests/tmp/testlog/TestEtUnitSpecial.etu b/tests/org.eclipse.etrice.runtime.c.tests/tmp/testlog/TestEtUnitSpecial.etu
index 71e585534..1da4cc53a 100644
--- a/tests/org.eclipse.etrice.runtime.c.tests/tmp/testlog/TestEtUnitSpecial.etu
+++ b/tests/org.eclipse.etrice.runtime.c.tests/tmp/testlog/TestEtUnitSpecial.etu
@@ -1,4 +1,4 @@
etUnit report
ts start: etUnit
-tc start 13: openAll and closeAll
-tc end 13: 0
+tc start 18: openAll and closeAll
+tc end 18: 0

Back to the top