From d9ff829a71d7b5723206e4923bcab6cbe3f5b715 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 7 Mar 2009 15:32:40 +0000 Subject: Fixes to the zero timeout. Added a test case. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@813 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testsem.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/testsem.c b/test/testsem.c index 4f2943964..07fd40840 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -81,13 +81,18 @@ static void sem2_setup(void) { static void sem2_execute(void) { int i; systime_t target_time; + msg_t msg; + + msg= chSemWaitTimeout(&sem1, TIME_ZERO); + test_assert(msg == RDY_TIMEOUT, "#1"); target_time = chSysGetTime() + MS2ST(5 * 500); for (i = 0; i < 5; i++) { test_emit_token('A' + i); - chSemWaitTimeout(&sem1, MS2ST(500)); - test_assert(isempty(&sem1.s_queue), "#1"); /* Queue not empty */ - test_assert(&sem1.s_cnt != 0, "#2"); /* Counter not zero */ + msg = chSemWaitTimeout(&sem1, MS2ST(500)); + test_assert(msg == RDY_TIMEOUT, "#2"); + test_assert(isempty(&sem1.s_queue), "#3"); /* Queue not empty */ + test_assert(&sem1.s_cnt != 0, "#4"); /* Counter not zero */ } test_assert_sequence("ABCDE"); test_assert_time_window(target_time, target_time + ALLOWED_DELAY); -- cgit v1.2.3