From 0b5c313cdaff47b5180b30afd449ba7925169743 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sun, 30 Sep 2018 06:34:55 +0000 Subject: Enhanced tests on pipes, added check on reset state. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12308 110e8d01-0319-4d1e-a829-52ad28d1bb01 --- test/oslib/configuration.xml | 133 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 120 insertions(+), 13 deletions(-) (limited to 'test/oslib/configuration.xml') diff --git a/test/oslib/configuration.xml b/test/oslib/configuration.xml index 723f47727..643a68508 100644 --- a/test/oslib/configuration.xml +++ b/test/oslib/configuration.xml @@ -444,7 +444,9 @@ test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");]]> CH_CFG_USE_PIPES - + +#define PIPE_SIZE 16 static uint8_t buffer[PIPE_SIZE]; static PIPE_DECL(pipe1, buffer, PIPE_SIZE); @@ -506,6 +508,43 @@ uint8_t buf[PIPE_SIZE]; msg = chPipeReadTimeout(&pipe1, buf, PIPE_SIZE, TIME_IMMEDIATE); test_assert(msg == PIPE_SIZE, "wrong size"); +test_assert((pipe1.rdptr == pipe1.buffer) && + (pipe1.wrptr == pipe1.buffer) && + (pipe1.cnt == 0), + "invalid pipe state"); +test_assert(memcmp(pipe_pattern, buf, PIPE_SIZE) == 0, "content mismatch");]]> + + + + + Small write. + + + + + + + + + + + Filling remaining space. + + + + + + - - + Small Read. + + + + + + + + + + + Reading remaining data. - + - - + Small Write. - + - - + Small Read. - + - - + Write wrapping buffer boundary. - + + + + + + Read wrapping buffer boundary. + + + + + + -- cgit v1.2.3