aboutsummaryrefslogtreecommitdiffstats
path: root/test/oslib/configuration.xml
diff options
context:
space:
mode:
Diffstat (limited to 'test/oslib/configuration.xml')
-rw-r--r--test/oslib/configuration.xml145
1 files changed, 143 insertions, 2 deletions
diff --git a/test/oslib/configuration.xml b/test/oslib/configuration.xml
index 643a68508..a828b51d0 100644
--- a/test/oslib/configuration.xml
+++ b/test/oslib/configuration.xml
@@ -456,7 +456,7 @@ static const uint8_t pipe_pattern[] = "0123456789ABCDEF";]]></value>
<cases>
<case>
<brief>
- <value>Filling and emptying a pipe, non blocking.</value>
+ <value>Pipes normal API, non-blocking tests.</value>
</brief>
<description>
<value>The pipe functionality is tested by loading and emptying it, all conditions are tested.</value>
@@ -473,12 +473,91 @@ static const uint8_t pipe_pattern[] = "0123456789ABCDEF";]]></value>
<value/>
</teardown_code>
<local_variables>
- <value><![CDATA[unsigned i;]]></value>
+ <value></value>
</local_variables>
</various_code>
<steps>
<step>
<description>
+ <value></value>
+ </description>
+ <tags>
+ <value></value>
+ </tags>
+ <code>
+ <value><![CDATA[]]></value>
+ </code>
+ </step>
+ <step>
+ <description>
+ <value>Resetting pipe.</value>
+ </description>
+ <tags>
+ <value></value>
+ </tags>
+ <code>
+ <value><![CDATA[chPipeReset(&pipe1);
+
+test_assert((pipe1.rdptr == pipe1.buffer) &&
+ (pipe1.wrptr == pipe1.buffer) &&
+ (pipe1.cnt == 0),
+ "invalid pipe state");]]></value>
+ </code>
+ </step>
+ <step>
+ <description>
+ <value>Writing data, must fail.</value>
+ </description>
+ <tags>
+ <value></value>
+ </tags>
+ <code>
+ <value><![CDATA[msg_t msg;
+
+msg = chPipeWriteTimeout(&pipe1, pipe_pattern, PIPE_SIZE, TIME_IMMEDIATE);
+test_assert(msg == MSG_RESET, "not reset");
+test_assert((pipe1.rdptr == pipe1.buffer) &&
+ (pipe1.wrptr == pipe1.buffer) &&
+ (pipe1.cnt == 0),
+ "invalid pipe state");]]></value>
+ </code>
+ </step>
+ <step>
+ <description>
+ <value>Reading data, must fail.</value>
+ </description>
+ <tags>
+ <value></value>
+ </tags>
+ <code>
+ <value><![CDATA[msg_t msg;
+uint8_t buf[PIPE_SIZE];
+
+msg = chPipeReadTimeout(&pipe1, buf, PIPE_SIZE, TIME_IMMEDIATE);
+test_assert(msg == MSG_RESET, "not reset");
+test_assert((pipe1.rdptr == pipe1.buffer) &&
+ (pipe1.wrptr == pipe1.buffer) &&
+ (pipe1.cnt == 0),
+ "invalid pipe state");]]></value>
+ </code>
+ </step>
+ <step>
+ <description>
+ <value>Reactivating pipe.</value>
+ </description>
+ <tags>
+ <value></value>
+ </tags>
+ <code>
+ <value><![CDATA[chPipeResume(&pipe1);
+test_assert((pipe1.rdptr == pipe1.buffer) &&
+ (pipe1.wrptr == pipe1.buffer) &&
+ (pipe1.cnt == 0),
+ "invalid pipe state");]]></value>
+ </code>
+ </step>
+ <step>
+ <description>
<value>Filling whole pipe.</value>
</description>
<tags>
@@ -669,6 +748,68 @@ test_assert(memcmp(pipe_pattern, buf, PIPE_SIZE) == 0, "content mismatch");]]></
</step>
</steps>
</case>
+ <case>
+ <brief>
+ <value>Pipe timeouts.</value>
+ </brief>
+ <description>
+ <value>The pipe API is tested for timeouts.</value>
+ </description>
+ <condition>
+ <value>
+ </value>
+ </condition>
+ <various_code>
+ <setup_code>
+ <value><![CDATA[chPipeObjectInit(&pipe1, buffer, PIPE_SIZE / 2);]]></value>
+ </setup_code>
+ <teardown_code>
+ <value/>
+ </teardown_code>
+ <local_variables>
+ <value></value>
+ </local_variables>
+ </various_code>
+ <steps>
+ <step>
+ <description>
+ <value>Reading while pipe is empty.</value>
+ </description>
+ <tags>
+ <value></value>
+ </tags>
+ <code>
+ <value><![CDATA[msg_t msg;
+uint8_t buf[PIPE_SIZE];
+
+msg = chPipeReadTimeout(&pipe1, buf, PIPE_SIZE, TIME_IMMEDIATE);
+test_assert(msg == 0, "wrong size");
+test_assert((pipe1.rdptr == pipe1.buffer) &&
+ (pipe1.wrptr == pipe1.buffer) &&
+ (pipe1.cnt == 0),
+ "invalid pipe state");]]></value>
+ </code>
+ </step>
+ <step>
+ <description>
+ <value>Writing a string larger than pipe buffer.</value>
+ </description>
+ <tags>
+ <value></value>
+ </tags>
+ <code>
+ <value><![CDATA[msg_t msg;
+
+msg = chPipeWriteTimeout(&pipe1, pipe_pattern, PIPE_SIZE, TIME_IMMEDIATE);
+test_assert(msg == PIPE_SIZE / 2, "wrong size");
+test_assert((pipe1.rdptr == pipe1.wrptr) &&
+ (pipe1.wrptr == pipe1.buffer) &&
+ (pipe1.cnt == PIPE_SIZE / 2),
+ "invalid pipe state");]]></value>
+ </code>
+ </step>
+ </steps>
+ </case>
</cases>
</sequence>
<sequence>