aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2018-10-02 12:58:00 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2018-10-02 12:58:00 +0000
commitf1f16202873064cdb76e738fba8bfbb5f2ee530d (patch)
treed4c3b1040120e29ad71e548e633d34b6eb82daac /test
parent65221fb13150fd9dd7b09b8855f9e1e61eba0a55 (diff)
downloadChibiOS-f1f16202873064cdb76e738fba8bfbb5f2ee530d.tar.gz
ChibiOS-f1f16202873064cdb76e738fba8bfbb5f2ee530d.tar.bz2
ChibiOS-f1f16202873064cdb76e738fba8bfbb5f2ee530d.zip
Revision of pipes.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12315 110e8d01-0319-4d1e-a829-52ad28d1bb01
Diffstat (limited to 'test')
-rw-r--r--test/oslib/configuration.xml95
-rw-r--r--test/oslib/source/test/oslib_test_sequence_002.c172
2 files changed, 125 insertions, 142 deletions
diff --git a/test/oslib/configuration.xml b/test/oslib/configuration.xml
index a828b51d0..bf35034d8 100644
--- a/test/oslib/configuration.xml
+++ b/test/oslib/configuration.xml
@@ -479,17 +479,6 @@ static const uint8_t pipe_pattern[] = "0123456789ABCDEF";]]></value>
<steps>
<step>
<description>
- <value></value>
- </description>
- <tags>
- <value></value>
- </tags>
- <code>
- <value><![CDATA[]]></value>
- </code>
- </step>
- <step>
- <description>
<value>Resetting pipe.</value>
</description>
<tags>
@@ -512,10 +501,10 @@ test_assert((pipe1.rdptr == pipe1.buffer) &&
<value></value>
</tags>
<code>
- <value><![CDATA[msg_t msg;
+ <value><![CDATA[size_t n;
-msg = chPipeWriteTimeout(&pipe1, pipe_pattern, PIPE_SIZE, TIME_IMMEDIATE);
-test_assert(msg == MSG_RESET, "not reset");
+n = chPipeWriteTimeout(&pipe1, pipe_pattern, PIPE_SIZE, TIME_IMMEDIATE);
+test_assert(n == 0, "not reset");
test_assert((pipe1.rdptr == pipe1.buffer) &&
(pipe1.wrptr == pipe1.buffer) &&
(pipe1.cnt == 0),
@@ -530,11 +519,11 @@ test_assert((pipe1.rdptr == pipe1.buffer) &&
<value></value>
</tags>
<code>
- <value><![CDATA[msg_t msg;
+ <value><![CDATA[size_t n;
uint8_t buf[PIPE_SIZE];
-msg = chPipeReadTimeout(&pipe1, buf, PIPE_SIZE, TIME_IMMEDIATE);
-test_assert(msg == MSG_RESET, "not reset");
+n = chPipeReadTimeout(&pipe1, buf, PIPE_SIZE, TIME_IMMEDIATE);
+test_assert(n == 0, "not reset");
test_assert((pipe1.rdptr == pipe1.buffer) &&
(pipe1.wrptr == pipe1.buffer) &&
(pipe1.cnt == 0),
@@ -564,10 +553,10 @@ test_assert((pipe1.rdptr == pipe1.buffer) &&
<value></value>
</tags>
<code>
- <value><![CDATA[msg_t msg;
+ <value><![CDATA[size_t n;
-msg = chPipeWriteTimeout(&pipe1, pipe_pattern, PIPE_SIZE, TIME_IMMEDIATE);
-test_assert(msg == PIPE_SIZE, "wrong size");
+n = chPipeWriteTimeout(&pipe1, pipe_pattern, PIPE_SIZE, TIME_IMMEDIATE);
+test_assert(n == PIPE_SIZE, "wrong size");
test_assert((pipe1.rdptr == pipe1.buffer) &&
(pipe1.wrptr == pipe1.buffer) &&
(pipe1.cnt == PIPE_SIZE),
@@ -582,11 +571,11 @@ test_assert((pipe1.rdptr == pipe1.buffer) &&
<value></value>
</tags>
<code>
- <value><![CDATA[msg_t msg;
+ <value><![CDATA[size_t n;
uint8_t buf[PIPE_SIZE];
-msg = chPipeReadTimeout(&pipe1, buf, PIPE_SIZE, TIME_IMMEDIATE);
-test_assert(msg == PIPE_SIZE, "wrong size");
+n = chPipeReadTimeout(&pipe1, buf, PIPE_SIZE, TIME_IMMEDIATE);
+test_assert(n == PIPE_SIZE, "wrong size");
test_assert((pipe1.rdptr == pipe1.buffer) &&
(pipe1.wrptr == pipe1.buffer) &&
(pipe1.cnt == 0),
@@ -602,10 +591,10 @@ test_assert(memcmp(pipe_pattern, buf, PIPE_SIZE) == 0, "content mismatch");]]></
<value></value>
</tags>
<code>
- <value><![CDATA[msg_t msg;
+ <value><![CDATA[size_t n;
-msg = chPipeWriteTimeout(&pipe1, pipe_pattern, 4, TIME_IMMEDIATE);
-test_assert(msg == 4, "wrong size");
+n = chPipeWriteTimeout(&pipe1, pipe_pattern, 4, TIME_IMMEDIATE);
+test_assert(n == 4, "wrong size");
test_assert((pipe1.rdptr != pipe1.wrptr) &&
(pipe1.rdptr == pipe1.buffer) &&
(pipe1.cnt == 4),
@@ -620,10 +609,10 @@ test_assert((pipe1.rdptr != pipe1.wrptr) &&
<value></value>
</tags>
<code>
- <value><![CDATA[msg_t msg;
+ <value><![CDATA[size_t n;
-msg = chPipeWriteTimeout(&pipe1, pipe_pattern, PIPE_SIZE - 4, TIME_IMMEDIATE);
-test_assert(msg == PIPE_SIZE - 4, "wrong size");
+n = chPipeWriteTimeout(&pipe1, pipe_pattern, PIPE_SIZE - 4, TIME_IMMEDIATE);
+test_assert(n == PIPE_SIZE - 4, "wrong size");
test_assert((pipe1.rdptr == pipe1.buffer) &&
(pipe1.wrptr == pipe1.buffer) &&
(pipe1.cnt == PIPE_SIZE),
@@ -638,11 +627,11 @@ test_assert((pipe1.rdptr == pipe1.buffer) &&
<value></value>
</tags>
<code>
- <value><![CDATA[msg_t msg;
+ <value><![CDATA[size_t n;
uint8_t buf[PIPE_SIZE];
-msg = chPipeReadTimeout(&pipe1, buf, 4, TIME_IMMEDIATE);
-test_assert(msg == 4, "wrong size");
+n = chPipeReadTimeout(&pipe1, buf, 4, TIME_IMMEDIATE);
+test_assert(n == 4, "wrong size");
test_assert((pipe1.rdptr != pipe1.buffer) &&
(pipe1.wrptr == pipe1.buffer) &&
(pipe1.cnt == PIPE_SIZE - 4),
@@ -658,11 +647,11 @@ test_assert(memcmp(pipe_pattern, buf, 4) == 0, "content mismatch");]]></value>
<value></value>
</tags>
<code>
- <value><![CDATA[msg_t msg;
+ <value><![CDATA[size_t n;
uint8_t buf[PIPE_SIZE];
-msg = chPipeReadTimeout(&pipe1, buf, PIPE_SIZE - 4, TIME_IMMEDIATE);
-test_assert(msg == PIPE_SIZE - 4, "wrong size");
+n = chPipeReadTimeout(&pipe1, buf, PIPE_SIZE - 4, TIME_IMMEDIATE);
+test_assert(n == PIPE_SIZE - 4, "wrong size");
test_assert((pipe1.rdptr == pipe1.buffer) &&
(pipe1.wrptr == pipe1.buffer) &&
(pipe1.cnt == 0),
@@ -678,10 +667,10 @@ test_assert(memcmp(pipe_pattern, buf, PIPE_SIZE - 4) == 0, "content mismatch");]
<value></value>
</tags>
<code>
- <value><![CDATA[msg_t msg;
+ <value><![CDATA[size_t n;
-msg = chPipeWriteTimeout(&pipe1, pipe_pattern, 5, TIME_IMMEDIATE);
-test_assert(msg == 5, "wrong size");
+n = chPipeWriteTimeout(&pipe1, pipe_pattern, 5, TIME_IMMEDIATE);
+test_assert(n == 5, "wrong size");
test_assert((pipe1.rdptr != pipe1.wrptr) &&
(pipe1.rdptr == pipe1.buffer) &&
(pipe1.cnt == 5),
@@ -696,11 +685,11 @@ test_assert((pipe1.rdptr != pipe1.wrptr) &&
<value></value>
</tags>
<code>
- <value><![CDATA[msg_t msg;
+ <value><![CDATA[size_t n;
uint8_t buf[PIPE_SIZE];
-msg = chPipeReadTimeout(&pipe1, buf, 5, TIME_IMMEDIATE);
-test_assert(msg == 5, "wrong size");
+n = chPipeReadTimeout(&pipe1, buf, 5, TIME_IMMEDIATE);
+test_assert(n == 5, "wrong size");
test_assert((pipe1.rdptr == pipe1.wrptr) &&
(pipe1.wrptr != pipe1.buffer) &&
(pipe1.cnt == 0),
@@ -716,10 +705,10 @@ test_assert(memcmp(pipe_pattern, buf, 5) == 0, "content mismatch");]]></value>
<value></value>
</tags>
<code>
- <value><![CDATA[msg_t msg;
+ <value><![CDATA[size_t n;
-msg = chPipeWriteTimeout(&pipe1, pipe_pattern, PIPE_SIZE, TIME_IMMEDIATE);
-test_assert(msg == PIPE_SIZE, "wrong size");
+n = chPipeWriteTimeout(&pipe1, pipe_pattern, PIPE_SIZE, TIME_IMMEDIATE);
+test_assert(n == PIPE_SIZE, "wrong size");
test_assert((pipe1.rdptr == pipe1.wrptr) &&
(pipe1.wrptr != pipe1.buffer) &&
(pipe1.cnt == PIPE_SIZE),
@@ -734,11 +723,11 @@ test_assert((pipe1.rdptr == pipe1.wrptr) &&
<value></value>
</tags>
<code>
- <value><![CDATA[msg_t msg;
+ <value><![CDATA[size_t n;
uint8_t buf[PIPE_SIZE];
-msg = chPipeReadTimeout(&pipe1, buf, PIPE_SIZE, TIME_IMMEDIATE);
-test_assert(msg == PIPE_SIZE, "wrong size");
+n = chPipeReadTimeout(&pipe1, buf, PIPE_SIZE, TIME_IMMEDIATE);
+test_assert(n == PIPE_SIZE, "wrong size");
test_assert((pipe1.rdptr == pipe1.wrptr) &&
(pipe1.wrptr != pipe1.buffer) &&
(pipe1.cnt == 0),
@@ -779,11 +768,11 @@ test_assert(memcmp(pipe_pattern, buf, PIPE_SIZE) == 0, "content mismatch");]]></
<value></value>
</tags>
<code>
- <value><![CDATA[msg_t msg;
+ <value><![CDATA[size_t n;
uint8_t buf[PIPE_SIZE];
-msg = chPipeReadTimeout(&pipe1, buf, PIPE_SIZE, TIME_IMMEDIATE);
-test_assert(msg == 0, "wrong size");
+n = chPipeReadTimeout(&pipe1, buf, PIPE_SIZE, TIME_IMMEDIATE);
+test_assert(n == 0, "wrong size");
test_assert((pipe1.rdptr == pipe1.buffer) &&
(pipe1.wrptr == pipe1.buffer) &&
(pipe1.cnt == 0),
@@ -798,10 +787,10 @@ test_assert((pipe1.rdptr == pipe1.buffer) &&
<value></value>
</tags>
<code>
- <value><![CDATA[msg_t msg;
+ <value><![CDATA[size_t n;
-msg = chPipeWriteTimeout(&pipe1, pipe_pattern, PIPE_SIZE, TIME_IMMEDIATE);
-test_assert(msg == PIPE_SIZE / 2, "wrong size");
+n = chPipeWriteTimeout(&pipe1, pipe_pattern, PIPE_SIZE, TIME_IMMEDIATE);
+test_assert(n == PIPE_SIZE / 2, "wrong size");
test_assert((pipe1.rdptr == pipe1.wrptr) &&
(pipe1.wrptr == pipe1.buffer) &&
(pipe1.cnt == PIPE_SIZE / 2),
diff --git a/test/oslib/source/test/oslib_test_sequence_002.c b/test/oslib/source/test/oslib_test_sequence_002.c
index 3f72a5055..18af59335 100644
--- a/test/oslib/source/test/oslib_test_sequence_002.c
+++ b/test/oslib/source/test/oslib_test_sequence_002.c
@@ -68,21 +68,20 @@ static const uint8_t pipe_pattern[] = "0123456789ABCDEF";
* conditions are tested.
*
* <h2>Test Steps</h2>
- * - [2.1.1].
- * - [2.1.2] Resetting pipe.
- * - [2.1.3] Writing data, must fail.
- * - [2.1.4] Reading data, must fail.
- * - [2.1.5] Reactivating pipe.
- * - [2.1.6] Filling whole pipe.
- * - [2.1.7] Emptying pipe.
- * - [2.1.8] Small write.
- * - [2.1.9] Filling remaining space.
- * - [2.1.10] Small Read.
- * - [2.1.11] Reading remaining data.
- * - [2.1.12] Small Write.
- * - [2.1.13] Small Read.
- * - [2.1.14] Write wrapping buffer boundary.
- * - [2.1.15] Read wrapping buffer boundary.
+ * - [2.1.1] Resetting pipe.
+ * - [2.1.2] Writing data, must fail.
+ * - [2.1.3] Reading data, must fail.
+ * - [2.1.4] Reactivating pipe.
+ * - [2.1.5] Filling whole pipe.
+ * - [2.1.6] Emptying pipe.
+ * - [2.1.7] Small write.
+ * - [2.1.8] Filling remaining space.
+ * - [2.1.9] Small Read.
+ * - [2.1.10] Reading remaining data.
+ * - [2.1.11] Small Write.
+ * - [2.1.12] Small Read.
+ * - [2.1.13] Write wrapping buffer boundary.
+ * - [2.1.14] Read wrapping buffer boundary.
* .
*/
@@ -92,14 +91,9 @@ static void oslib_test_002_001_setup(void) {
static void oslib_test_002_001_execute(void) {
- /* [2.1.1].*/
+ /* [2.1.1] Resetting pipe.*/
test_set_step(1);
{
- }
-
- /* [2.1.2] Resetting pipe.*/
- test_set_step(2);
- {
chPipeReset(&pipe1);
test_assert((pipe1.rdptr == pipe1.buffer) &&
@@ -108,35 +102,35 @@ static void oslib_test_002_001_execute(void) {
"invalid pipe state");
}
- /* [2.1.3] Writing data, must fail.*/
- test_set_step(3);
+ /* [2.1.2] Writing data, must fail.*/
+ test_set_step(2);
{
- msg_t msg;
+ size_t n;
- msg = chPipeWriteTimeout(&pipe1, pipe_pattern, PIPE_SIZE, TIME_IMMEDIATE);
- test_assert(msg == MSG_RESET, "not reset");
+ n = chPipeWriteTimeout(&pipe1, pipe_pattern, PIPE_SIZE, TIME_IMMEDIATE);
+ test_assert(n == 0, "not reset");
test_assert((pipe1.rdptr == pipe1.buffer) &&
(pipe1.wrptr == pipe1.buffer) &&
(pipe1.cnt == 0),
"invalid pipe state");
}
- /* [2.1.4] Reading data, must fail.*/
- test_set_step(4);
+ /* [2.1.3] Reading data, must fail.*/
+ test_set_step(3);
{
- msg_t msg;
+ size_t n;
uint8_t buf[PIPE_SIZE];
- msg = chPipeReadTimeout(&pipe1, buf, PIPE_SIZE, TIME_IMMEDIATE);
- test_assert(msg == MSG_RESET, "not reset");
+ n = chPipeReadTimeout(&pipe1, buf, PIPE_SIZE, TIME_IMMEDIATE);
+ test_assert(n == 0, "not reset");
test_assert((pipe1.rdptr == pipe1.buffer) &&
(pipe1.wrptr == pipe1.buffer) &&
(pipe1.cnt == 0),
"invalid pipe state");
}
- /* [2.1.5] Reactivating pipe.*/
- test_set_step(5);
+ /* [2.1.4] Reactivating pipe.*/
+ test_set_step(4);
{
chPipeResume(&pipe1);
test_assert((pipe1.rdptr == pipe1.buffer) &&
@@ -145,27 +139,27 @@ static void oslib_test_002_001_execute(void) {
"invalid pipe state");
}
- /* [2.1.6] Filling whole pipe.*/
- test_set_step(6);
+ /* [2.1.5] Filling whole pipe.*/
+ test_set_step(5);
{
- msg_t msg;
+ size_t n;
- msg = chPipeWriteTimeout(&pipe1, pipe_pattern, PIPE_SIZE, TIME_IMMEDIATE);
- test_assert(msg == PIPE_SIZE, "wrong size");
+ n = chPipeWriteTimeout(&pipe1, pipe_pattern, PIPE_SIZE, TIME_IMMEDIATE);
+ test_assert(n == PIPE_SIZE, "wrong size");
test_assert((pipe1.rdptr == pipe1.buffer) &&
(pipe1.wrptr == pipe1.buffer) &&
(pipe1.cnt == PIPE_SIZE),
"invalid pipe state");
}
- /* [2.1.7] Emptying pipe.*/
- test_set_step(7);
+ /* [2.1.6] Emptying pipe.*/
+ test_set_step(6);
{
- msg_t msg;
+ size_t n;
uint8_t buf[PIPE_SIZE];
- msg = chPipeReadTimeout(&pipe1, buf, PIPE_SIZE, TIME_IMMEDIATE);
- test_assert(msg == PIPE_SIZE, "wrong size");
+ n = chPipeReadTimeout(&pipe1, buf, PIPE_SIZE, TIME_IMMEDIATE);
+ test_assert(n == PIPE_SIZE, "wrong size");
test_assert((pipe1.rdptr == pipe1.buffer) &&
(pipe1.wrptr == pipe1.buffer) &&
(pipe1.cnt == 0),
@@ -173,40 +167,40 @@ static void oslib_test_002_001_execute(void) {
test_assert(memcmp(pipe_pattern, buf, PIPE_SIZE) == 0, "content mismatch");
}
- /* [2.1.8] Small write.*/
- test_set_step(8);
+ /* [2.1.7] Small write.*/
+ test_set_step(7);
{
- msg_t msg;
+ size_t n;
- msg = chPipeWriteTimeout(&pipe1, pipe_pattern, 4, TIME_IMMEDIATE);
- test_assert(msg == 4, "wrong size");
+ n = chPipeWriteTimeout(&pipe1, pipe_pattern, 4, TIME_IMMEDIATE);
+ test_assert(n == 4, "wrong size");
test_assert((pipe1.rdptr != pipe1.wrptr) &&
(pipe1.rdptr == pipe1.buffer) &&
(pipe1.cnt == 4),
"invalid pipe state");
}
- /* [2.1.9] Filling remaining space.*/
- test_set_step(9);
+ /* [2.1.8] Filling remaining space.*/
+ test_set_step(8);
{
- msg_t msg;
+ size_t n;
- msg = chPipeWriteTimeout(&pipe1, pipe_pattern, PIPE_SIZE - 4, TIME_IMMEDIATE);
- test_assert(msg == PIPE_SIZE - 4, "wrong size");
+ n = chPipeWriteTimeout(&pipe1, pipe_pattern, PIPE_SIZE - 4, TIME_IMMEDIATE);
+ test_assert(n == PIPE_SIZE - 4, "wrong size");
test_assert((pipe1.rdptr == pipe1.buffer) &&
(pipe1.wrptr == pipe1.buffer) &&
(pipe1.cnt == PIPE_SIZE),
"invalid pipe state");
}
- /* [2.1.10] Small Read.*/
- test_set_step(10);
+ /* [2.1.9] Small Read.*/
+ test_set_step(9);
{
- msg_t msg;
+ size_t n;
uint8_t buf[PIPE_SIZE];
- msg = chPipeReadTimeout(&pipe1, buf, 4, TIME_IMMEDIATE);
- test_assert(msg == 4, "wrong size");
+ n = chPipeReadTimeout(&pipe1, buf, 4, TIME_IMMEDIATE);
+ test_assert(n == 4, "wrong size");
test_assert((pipe1.rdptr != pipe1.buffer) &&
(pipe1.wrptr == pipe1.buffer) &&
(pipe1.cnt == PIPE_SIZE - 4),
@@ -214,14 +208,14 @@ static void oslib_test_002_001_execute(void) {
test_assert(memcmp(pipe_pattern, buf, 4) == 0, "content mismatch");
}
- /* [2.1.11] Reading remaining data.*/
- test_set_step(11);
+ /* [2.1.10] Reading remaining data.*/
+ test_set_step(10);
{
- msg_t msg;
+ size_t n;
uint8_t buf[PIPE_SIZE];
- msg = chPipeReadTimeout(&pipe1, buf, PIPE_SIZE - 4, TIME_IMMEDIATE);
- test_assert(msg == PIPE_SIZE - 4, "wrong size");
+ n = chPipeReadTimeout(&pipe1, buf, PIPE_SIZE - 4, TIME_IMMEDIATE);
+ test_assert(n == PIPE_SIZE - 4, "wrong size");
test_assert((pipe1.rdptr == pipe1.buffer) &&
(pipe1.wrptr == pipe1.buffer) &&
(pipe1.cnt == 0),
@@ -229,27 +223,27 @@ static void oslib_test_002_001_execute(void) {
test_assert(memcmp(pipe_pattern, buf, PIPE_SIZE - 4) == 0, "content mismatch");
}
- /* [2.1.12] Small Write.*/
- test_set_step(12);
+ /* [2.1.11] Small Write.*/
+ test_set_step(11);
{
- msg_t msg;
+ size_t n;
- msg = chPipeWriteTimeout(&pipe1, pipe_pattern, 5, TIME_IMMEDIATE);
- test_assert(msg == 5, "wrong size");
+ n = chPipeWriteTimeout(&pipe1, pipe_pattern, 5, TIME_IMMEDIATE);
+ test_assert(n == 5, "wrong size");
test_assert((pipe1.rdptr != pipe1.wrptr) &&
(pipe1.rdptr == pipe1.buffer) &&
(pipe1.cnt == 5),
"invalid pipe state");
}
- /* [2.1.13] Small Read.*/
- test_set_step(13);
+ /* [2.1.12] Small Read.*/
+ test_set_step(12);
{
- msg_t msg;
+ size_t n;
uint8_t buf[PIPE_SIZE];
- msg = chPipeReadTimeout(&pipe1, buf, 5, TIME_IMMEDIATE);
- test_assert(msg == 5, "wrong size");
+ n = chPipeReadTimeout(&pipe1, buf, 5, TIME_IMMEDIATE);
+ test_assert(n == 5, "wrong size");
test_assert((pipe1.rdptr == pipe1.wrptr) &&
(pipe1.wrptr != pipe1.buffer) &&
(pipe1.cnt == 0),
@@ -257,27 +251,27 @@ static void oslib_test_002_001_execute(void) {
test_assert(memcmp(pipe_pattern, buf, 5) == 0, "content mismatch");
}
- /* [2.1.14] Write wrapping buffer boundary.*/
- test_set_step(14);
+ /* [2.1.13] Write wrapping buffer boundary.*/
+ test_set_step(13);
{
- msg_t msg;
+ size_t n;
- msg = chPipeWriteTimeout(&pipe1, pipe_pattern, PIPE_SIZE, TIME_IMMEDIATE);
- test_assert(msg == PIPE_SIZE, "wrong size");
+ n = chPipeWriteTimeout(&pipe1, pipe_pattern, PIPE_SIZE, TIME_IMMEDIATE);
+ test_assert(n == PIPE_SIZE, "wrong size");
test_assert((pipe1.rdptr == pipe1.wrptr) &&
(pipe1.wrptr != pipe1.buffer) &&
(pipe1.cnt == PIPE_SIZE),
"invalid pipe state");
}
- /* [2.1.15] Read wrapping buffer boundary.*/
- test_set_step(15);
+ /* [2.1.14] Read wrapping buffer boundary.*/
+ test_set_step(14);
{
- msg_t msg;
+ size_t n;
uint8_t buf[PIPE_SIZE];
- msg = chPipeReadTimeout(&pipe1, buf, PIPE_SIZE, TIME_IMMEDIATE);
- test_assert(msg == PIPE_SIZE, "wrong size");
+ n = chPipeReadTimeout(&pipe1, buf, PIPE_SIZE, TIME_IMMEDIATE);
+ test_assert(n == PIPE_SIZE, "wrong size");
test_assert((pipe1.rdptr == pipe1.wrptr) &&
(pipe1.wrptr != pipe1.buffer) &&
(pipe1.cnt == 0),
@@ -314,11 +308,11 @@ static void oslib_test_002_002_execute(void) {
/* [2.2.1] Reading while pipe is empty.*/
test_set_step(1);
{
- msg_t msg;
+ size_t n;
uint8_t buf[PIPE_SIZE];
- msg = chPipeReadTimeout(&pipe1, buf, PIPE_SIZE, TIME_IMMEDIATE);
- test_assert(msg == 0, "wrong size");
+ n = chPipeReadTimeout(&pipe1, buf, PIPE_SIZE, TIME_IMMEDIATE);
+ test_assert(n == 0, "wrong size");
test_assert((pipe1.rdptr == pipe1.buffer) &&
(pipe1.wrptr == pipe1.buffer) &&
(pipe1.cnt == 0),
@@ -328,10 +322,10 @@ static void oslib_test_002_002_execute(void) {
/* [2.2.2] Writing a string larger than pipe buffer.*/
test_set_step(2);
{
- msg_t msg;
+ size_t n;
- msg = chPipeWriteTimeout(&pipe1, pipe_pattern, PIPE_SIZE, TIME_IMMEDIATE);
- test_assert(msg == PIPE_SIZE / 2, "wrong size");
+ n = chPipeWriteTimeout(&pipe1, pipe_pattern, PIPE_SIZE, TIME_IMMEDIATE);
+ test_assert(n == PIPE_SIZE / 2, "wrong size");
test_assert((pipe1.rdptr == pipe1.wrptr) &&
(pipe1.wrptr == pipe1.buffer) &&
(pipe1.cnt == PIPE_SIZE / 2),