Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
PolyORB-HI-C
Commits
54d50bdb
Commit
54d50bdb
authored
Jun 25, 2018
by
yoogx
Browse files
* Added test for gqueue being full
For openaadl/ocarina#166
parent
af2f3bd7
Changes
3
Hide whitespace changes
Inline
Side-by-side
examples/aadlv2/torture_gqueue/README.md
View file @
54d50bdb
...
...
@@ -90,6 +90,13 @@ constitutes a control assay.
## Periodic Test details
Each time messages are sent by the periodic task and received by itself.
The Per Port P3 is linked to the Per Port P4.
The Per Port P5 is linked to the Per Port P6.
Test Periodic 1 :
This time, two messages are sent on the port P3 towards port P4 of the
periodic task : the task are sending messages to itself.
...
...
@@ -112,3 +119,13 @@ incrementation is of 1 at each awakening, it is easy to recover the
previous value sent thanks to the assertion : reception == sent_lvl -
number + j + 1. The value is then dequeued to get to the following
value.
Test Periodic 2 :
This time two messages are as well sent to the periodic task to itself.
The goal is to verify whether, if the queue is full, an error message is well sent.
We set up a reception port with a size of 1 and we sent 2 messages to this port.
If a message is printed, then the test is passed.
The user is able to see it itself on the console.
examples/aadlv2/torture_gqueue/torture.aadl
View file @
54d50bdb
...
...
@@ -15,6 +15,8 @@ public
P2
:
out
event
data
port
int
;
P3
:
out
event
data
port
int
;
P4
:
in
event
data
port
int
{
Queue_Size
=>
42
;};
P5
:
out
event
data
port
int
;
P6
:
in
event
data
port
int
{
Queue_Size
=>
1
;};
properties
Dispatch_Protocol
=>
Periodic
;
Period
=>
1000
ms
;
...
...
@@ -56,6 +58,7 @@ public
C2
:
port
Per_thread
.
P1
->
Spo_thread
.
P2
;
C3
:
port
Spo_thread
.
P3
->
Spo_thread
.
P4
;
C4
:
port
Per_thread
.
P3
->
Per_thread
.
P4
;
C5
:
port
Per_thread
.
P5
->
Per_thread
.
P6
;
end
Torture_Software
.
impl
;
...
...
examples/aadlv2/torture_gqueue/torture.c
View file @
54d50bdb
...
...
@@ -44,11 +44,15 @@ int number = 0;
int
count_p1
;
int
count_p2
;
int
count_p4
;
int
count_p5
;
int
count_p6
;
__po_hi_local_port_t
port_p1
=
LOCAL_PORT
(
spo_thread
,
p1
);
__po_hi_local_port_t
port_p2
=
LOCAL_PORT
(
spo_thread
,
p2
);
__po_hi_local_port_t
port_p4
=
LOCAL_PORT
(
per_thread
,
p4
);
__po_hi_local_port_t
port_p3
=
LOCAL_PORT
(
per_thread
,
p3
);
__po_hi_local_port_t
port_p5
=
LOCAL_PORT
(
per_thread
,
p5
);
__po_hi_local_port_t
port_p6
=
LOCAL_PORT
(
per_thread
,
p6
);
/*
* Semaphore used to coordinate the period and sporad tasks : At the
...
...
@@ -68,9 +72,7 @@ void period(__po_hi_task_id self) {
sem_unlink
(
"/aadl"
);
semaphore
=
sem_open
(
"/aadl"
,
O_CREAT
|
O_EXCL
,
S_IRUSR
|
S_IWUSR
,
1
);
}
init
=
false
;
}
/* *** Boolean and semaphore launching the following test with
...
...
@@ -85,8 +87,9 @@ void period(__po_hi_task_id self) {
__po_hi_request_t
r1
;
__po_hi_request_t
r2
;
/*****************************************************************************/
/* *** Initial Test of the different functions *** */
/* *** Test of gqueue with one message *** */
if
(
number
<
2
){
/* Message sent on Period Port 1 to Sporad port 2 */
sent_lvl
=
lvl
;
...
...
@@ -118,6 +121,7 @@ void period(__po_hi_task_id self) {
&
r2
);
}
/*****************************************************************************/
/* *** Test of two messages sent on one port *** */
/* Transmission */
count_p4
=
__po_hi_gqueue_get_count
(
self
,
port_p4
);
...
...
@@ -164,17 +168,49 @@ void period(__po_hi_task_id self) {
sem_post
(
semaphore
);
}
/* ****Test of awaited behavior of a sporadic task**** */
if
(
number
>
2
){
int
a
=
42
;
r1
.
port
=
REQUEST_PORT
(
per_thread
,
p1
);
r1
.
PORT_VARIABLE
(
per_thread
,
p1
)
=
a
;
__po_hi_gqueue_store_out
(
self
,
LOCAL_PORT
(
per_thread
,
p1
),
&
r1
);
__po_hi_send_output
(
self
,
REQUEST_PORT
(
per_thread
,
p1
));
a
++
;
/*****************************************************************************/
/* *** Test of gqueue error message *** */
/* Transmission */
count_p6
=
__po_hi_gqueue_get_count
(
self
,
port_p6
);
if
((
number
==
3
)
&&
(
count_p6
==
0
)){
printf
(
"
\n\n
*** TEST PERIODIC 2 ***
\n
"
);
count_p6
=
__po_hi_gqueue_get_count
(
self
,
port_p6
);
assert
(
count_p6
==
0
);
for
(
int
i
=
1
;
i
<
number
;
i
++
){
sent_lvl
=
lvl
;
r1
.
port
=
REQUEST_PORT
(
per_thread
,
p5
);
r1
.
PORT_VARIABLE
(
per_thread
,
p5
)
=
lvl
;
lvl
++
;
#if defined (TEST_VERBOSE)
printf
(
"
\n
Storeout P1 to P2, task id = %d, port id = %d"
,
self
,
LOCAL_PORT
(
per_thread
,
p5
));
#endif
__po_hi_gqueue_store_out
(
self
,
LOCAL_PORT
(
per_thread
,
p5
),
&
r1
);
__po_hi_send_output
(
self
,
REQUEST_PORT
(
per_thread
,
p5
));
}
}
/* Reception */
count_p6
=
__po_hi_gqueue_get_count
(
self
,
port_p6
);
if
((
number
==
3
)
&&
(
count_p6
==
1
)){
printf
(
"
\n
*** An error message should appear ***
\n\n
"
);
count_p6
=
__po_hi_gqueue_get_count
(
self
,
port_p6
);
for
(
int
j
=
0
;
j
<
count_p6
;
j
++
)
{
__po_hi_gqueue_next_value
(
self
,
port_p6
);
}
printf
(
"
\n
*** If so, error message test passed ***
\n\n
"
);
first_iteration
=
true
;
sem_post
(
semaphore
);
}
if
(
number
>
3
){
sem_unlink
(
"/aadl"
);
sem_close
(
semaphore
);
exit
(
0
);
}
}
...
...
@@ -194,12 +230,7 @@ void sporad(__po_hi_task_id self) {
/* FIFO test on reception port P2 */
test_sporad_5
(
self
);
}
/* Test to observe the awaited behavior of a sporadic task */
if
(
number
>
2
){
sem_unlink
(
"/aadl"
);
sem_close
(
semaphore
);
exit
(
0
);
}
/* Boolean and semaphore launching the next type of test */
first_iteration
=
true
;
sem_post
(
semaphore
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment